How to associate a Composition with a Folder?

I have never used FOLDERs in anger. Just cannot figure out how to associate a composition/contribution with a FOLDER, either in Better Ehrscape or the openEHR REST API.

Any pointers?

Well a Contribution causes modifications to the Folders structure, just like any other structure. Contribution = version change set record.

1 Like

Hi Ian,

this example is from the integration tests of EHRbase. Should hopefully work:

{
  "_type": "FOLDER",
  "name": {
    "_type": "DV_TEXT",
    "value": "root"
  },
  "archetype_node_id": "openEHR-EHR-FOLDER.generic.v1",
  "folders": [
    {
      "_type": "FOLDER",
      "name": {
        "_type": "DV_TEXT",
        "value": "subfolder 1"
      },
      "archetype_node_id": "openEHR-EHR-FOLDER.generic.v1"
    },
    {
      "_type": "FOLDER",
      "name": {
        "_type": "DV_TEXT",
        "value": "subfolder 2"
      },
      "archetype_node_id": "openEHR-EHR-FOLDER.generic.v1"
    }
  ],
	"items": [
      {
  		"id": {
  			"_type": "HIER_OBJECT_ID",
  			"value": "d936409e-901f-4994-8d33-ed104d46015b"
  		},
  		"namespace": "my.system.id",
  		"type": "VERSIONED_COMPOSITION"
  	}
  ]
}
4 Likes

In my understanding, the composition is linked to the root folder. If you need to associate compositions with a sub folder, you can create an item array under that also.

1 Like

Thanks, @Dileep_V_S. It works as you suggested, and even with “items”: or without it.