How many FOLDER trees can be associated with the same EHR

How many FOLDER trees can be associated with the same EHR at the same time?
In other words, EHR 0…1 FOLDER_tree OR EHR 0…n FOLDER_tree?

Figure 20. High-level Structure of the openEHR EHR

This figure seems to imply a single EHR could have more than one folder trees at the same time.

For an EHR already having a Directory FOLDER, when trying to POST an second FOLDER tree JSON to EHRBase Server via openEHR Tool, I got the following error (409):

{"error":"Conflict","message":"EHR with id 80a71040-3d37-42f3-a86a-ce5405138ce0 already contains a directory."} 

You can see here that EHR.folders has cardinality *.

1 Like

The directory endpoint access the directory of the ehr which is the first folder :

" directory: Optional directory structure for this EHR. If present, this is a reference to the first member of folders ."

1 Like

Thank you very much, @thomas.beale and @stefanspiska. Forgive me please. Honestly, I’m still confused about: What kind of folder hierarchy a single EHR can have, i.e., mono-/multi-hierarchy? What is the relationship between directory and folders? Two separate but related attributes of the EHR class? Or is Directory just a synonym of the very first folder (root) in the first folder tree? Especially the cardinality of the attribute folders, 0…1, looks strange for me.

Now I can understand the 409 error above because I was trying to POST a second directory, violating its cardinality 0…1. Am I correct?

Directory is just a reference to folders[0]

So post Directory is create folders[0] which gives you an error if already exist.

I belive at one time only Directory existed and folders was added late and then Directory became simple folders[0] die first element in the list.

2 Likes

Thanks, @stefanspiska. I see, it’s a reference relationship.

For folders[0], the index [0] means threre can exist more than one folder tree side-by-side?

Another confusing stuff for me is: there is no POST /Update/Delete operations for folders on the openEHR Tool UI:

<li class="nav-item dropdown dropend">
            <a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" >
              Directory
            </a>
            <ul class="dropdown-menu" >
              <li><a class="dropdown-item" href="pdir.html">Post Directory</a></li>
              <li><a class="dropdown-item" href="udir.html">Update Directory</a></li>
              <li><a class="dropdown-item" href="gdir.html">GET Folder/Directory</a></li>
              <li><a class="dropdown-item" href="ddir.html">Delete Directory</a></li>
            </ul>
</li>

I think you find this strange because what you have circled is NOT the cardinality, but just the existence (or occurrences) of the folders attribute, i.e. folders may or may not exist (aka is optional).

Then, if it exists, the cardinality of the folders List is *, i.e. the folders List can contain any number of OBJECT_REFs (each pointing to the root of a Folder structure, with the first member being the “directory”).

Hope this clarifies this bit.

1 Like

Indeed, I was confusing the two attributes of the EHR class with the “physical” folder structures.

@sebastian.garde Thanks a lot for your clarification.

That 0…1 means optionality, not cardinality. It means there could be not even a folders container. if there is something there, it is a List, which is a container, i.e. 0…* items.

1 Like

Some other useful info: the EHR.folders was added in RM 1.1.0, previously we only had EHR.directory. The REST specs is lagging behind, as it does not have yet operation for folders. What you see there ion EHRbase is just the REST for directory “resource”. This missing piece of specs is anyway planned to be addressed soon, and hopefully it will be also supported by CDRs.

2 Likes

It gets vividly clearer and more interesting. Thank you so much, @thomas.beale and @thomas.beale.

Interesting post and very helpful, as I am still struggling to understand how folders can be used in openEHR, and now I also know why there is no REST API call for such folders.

I am curious to learn how “administrative cases” and “medical episodes” are managed in openEHR. Here are the definitions of both terms for context:

  • Administrative Case: This organizes a patient’s medical treatment from an administrative viewpoint. It includes multiple hospitalizations or outpatient treatments at different times that are grouped under a single administrative case for billing, insurance, or other management purposes.
  • Medical Episode: This organizes a patient’s medical treatment from a clinical perspective. It may include various hospitalizations or outpatient treatments, potentially spread across different administrative cases, but grouped based on a specific clinical condition or treatment process.

These would be AQL queries providing details for a report that will update as the case or episode progresses. Could they have a generic structure?

I hope, that I interpreted your answer as a response to my post :sweat_smile:

Based on your insight, this means, that the organization of administrative cases and medical episodes need to be managed in the application using predefined AQL queries (logic layer) and not at the openEHR using associations or tags (persistence level).

Can you tell me, if I did understand your insight correctly?

@Lucas

Folders allow grouping of Composition into logical groups so yes you could use that to modele say a episode of care see: Representation of Episodes of Care and Encounters in folders

1 Like

On the Spec page for the EHR Model, there is a figure that shows examples for using folders to organize episode data.

1 Like