Been struggling with this idea for a while, maybe others can help me out.
Since FOLDER is LOCATABLE, it can, and actually should, be archetyped, and since most systems work with templates, there should actually be FOLDER OPTs out there saying how the internal structure of different FOLDERs should look like.
The first challenge with FOLDERs is they are a recursive structure, though is like SECTION or CLUSTER, there is one big difference: for SECTIONs and CLUSTERs the structure is stable once a COMPOSITION is created, and we have an OPT for each type of COMPOSITION.
When we create an EHR.directory instance, itâs a FOLDER, that should have an OPT, though itâs internal structure will keep changing while subfolders are added (at any level of the EHR.directory tree structure) and items are added to the FOLDERs (also at any level).
Creating an OPT for a FOLDER is easy, but then what happens with itâs subfolders at the FOLDER.folders list? Each of those should also be archetyped, but is that archetype mentioned in the top-level/root FOLDER OPT? It could, but then, the folders at the 3rd, 4th and so on, levels, should be also archetype in the same OPT? Or each subfolder could have indeed its own OPT?
It would be easy to say, letâs create a FOLDER archetype that allows anything in its folders attribute, but that wonât help when we want to query the folder structure, since we need concrete archetype ids, constraints and paths to know how to query the structure.
Another option is to have a FOLDER archetype that in the folders attribute has a SLOT to the same archetype ID, creating a recursive archetype dependency (this could also be a CONSTRAINT_REF to the root of the archetype), then use the archetype as-is in the OPT. The issue is if someone needs to add a constraint, then another archetype ID, or version of the current one, should be added to the allowed archetypes in the archetype slot, and this again should allow that new constraint in the first level of the folders, but also in the Nth level, unless a specific constraint doesnât allow certain archetype IDs, letâs say, at the 3rd level.
What I want to capture as modeling requirements is:
- the need of OPTs to formally comply with the openEHR specs
- the ability of allowing FOLDER-based queries in AQL and other querying formalisms
- enable systems to create FOLDERs at any level of the EHR.directory, for any EHR, and allow to vary the internal structure of EHR.directory from EHR to EHR (different EHRs could have different OPTs for EHR.directory)
Iâm just not sure what is a good way of modeling for FOLDERs to allow editing the structure without just having a dummy FOLDER archetype just to be compliant with the specs. I would like to add real constraints to FOLDER archetypes, like the names, but allow users to create folders too.
I guess all this comes from the not-so-explored world of FOLDERs in clinical modeling and querying (we still have open discussions about how AQL over FOLDERs could work and I think itâs because we didnât use OPTs for FOLDERs extensively).