Sorry I’m being dumb but I can see a way to allocate a composition to a folder in the REST API - help?
Since the Directory endpoint always updates the whole structure you simple put it in the Folder structure which represents the directory .
So call EHR API openEHR specs
with
{
"_type": "FOLDER",
"name": {
"_type": "DV_TEXT",
"value": "root"
},
"archetype_node_id": "openEHR-EHR-FOLDER.generic.v1",
"folders": [
{
"_type": "FOLDER",
"name": {
"_type": "DV_TEXT",
"value": "history"
},
"archetype_node_id": "openEHR-EHR-FOLDER.generic.v1",
"folders": [
{
"_type": "FOLDER",
"name": {
"_type": "DV_TEXT",
"value": "family"
},
"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"
}
]
}
]
}
]
}
so
- Create Directory if not exists.
- get old Directory from openehr server
- edit the json representing the Directory
- Update the whole structure.
The ehrbase sdk has some tools to help with that https://github.com/ehrbase/openEHR_SDK/blob/develop/client/src/test/java/org/ehrbase/openehr/sdk/client/openehrclient/defaultrestclient/DefaultDirectoryCrudEndpointTestIT.java
SEC might want to have a look at adding an endpoint that edits specific FOLDERs. Similar to what we do with compositions. Especially in complex systems with authorisations per FOLDER this is an issue. But it’s also error pronken I think to let every client always change the entire directory.
Yes you are right, that’s on the REST “roadmap” actually, and requires RM 1.1.0+.
That has been already discussed. We proposed an API for that, I think there is a ticket on the openEHR JIRA.
Might my question How to retrieve and update a subfolder in the FOLDER Structure? be related to this?
Related JIRA ticket Issue navigator - openEHR JIRA
Thanks a lot, @pablo.