Templates for application form development

I’ve been recently messing around with ADL-designer, and thinking more about how to do application building with templates. A few things are becoming clearer to me. Firstly, templates based on COMPOSITION (or PARTY, PERSON etc, for demographics) are potentially good for data capture, but don’t in general make sense for data retrieval.

For a retrieval data set, e.g. a screen containing a combination of demographics, EHR clinical, other info, we need another kind of container. Let’s call this DATA_SET for the moment, and assume it is defined as follows:

class DATA_SET inherit LOCATABLE
content: LOCATABLE [*]
end

Then an archetype of this could be built for a screen, and it could insert SECTIONS purely for display purposes. Maybe it could include style information. So let’s imagine that instead of just SECTIONs we could use something a bit smarter, like DATA_GROUP. We could then create a template like the following (each included archetype is actually an overlay based on an underlying archetype):

DATA_SET[id1] matches {
content matches {
DATA_GROUP[id2] matches {
name matches {[at20]} -- "Patient details"
style matches {1} -- area; from an enumeration of tabs|menu|area|etc
items matches {
use_archetype PERSON[id3, openEHR-EHR-PERSON.ovl_patient_details_1.v1]
}
}
DATA_GROUP[id4] matches {
name matches {[at21]} -- "Clinical"
style matches {1} -- area; from an enumeration of tabs|menu|area|etc
items matches {
DATA_GROUP[id6] matches {
name matches {[at22]} -- "First trimester"
style matches {0} -- tabs
items matches {
use_archetype OBSERVATION [id7, openEHR-EHR-OBERVATION.ovl_first_trimester_summary_1.v1]
}
}
DATA_GROUP[id8] matches {
name matches {[at23]} -- "Second trimester"
style matches {0} -- tabs
items matches {
use_archetype OBSERVATION [id9, openEHR-EHR-OBERVATION.ovl_second_trimester_summary_1.v1]
}
}
DATA_GROUP[id10] matches {
name matches {[at24]} -- "Third trimester, first part"
style matches {0} -- tabs
items matches {
use_archetype OBSERVATION [id11, openEHR-EHR-OBERVATION.ovl_third_trimester_summary_1.v1] -- overlay 1
}
}
DATA_GROUP[id12] matches {
name matches {[at25]} -- "Third trimester, last month"
style matches {0} -- tabs
items matches {
use_archetype OBSERVATION [id13, openEHR-EHR-OBERVATION.ovl_first_trimester_summary_2.v1] -- overlay 2
}
}
}
}
}
}
``

Notice that now we have demographic data (magenta) and EHR data (blue) easily mixed in; we have a rough screen layout defined, something like two HBOX areas, with the second one having tabs inside for the various pregnancy trimesters.

In this construction, the only real data are the included archetypes; the outer DATA_SET and DATA_GROUPs are just defined structures that are created on the fly by a screen renderer. Different types of DATA_GROUP could be used to provide the UI hints we often talk about - use tabs, use a box with a name, and so on - people familiar with the typical UI elements like HBOX, VBOX, TREE, MENU, MENU_ITEM, DATE_FIELD, TEXT_FIELD (the names differ across UI toolkits) will see that this approach could be used to more or less fully define whole screens. A similar thing could be done to define messages or documents.

Paths through such a structure would effectively be paths to parts of a form (or a message), and could be referenced in other sections of the template to control visualisation.

We could embed the generating queries as well for example:

DATA_SET[id1] matches {
content matches {
DATA_GROUP[id2] matches {
name matches {[at20]} -- first trimester
query matches {
**"SELECT obs**
**FROM**
**EHR[$ehr_id] CONTAINS**
**summary** **COMPOSITION[openEHR-EHR-COMPOSITION.pregnancy_summary.v1]**
**WHERE**
**summary/context/start_dat****e** **>** ``<b>$current_date - P1Y</b>
**"**
}
style matches {0} -- tabs; from an enumeration of tabs|menu|etc
items matches {
use_archetype OBSERVATION [id3, openEHR-EHR-OBERVATION.ovl_first_trimester_summary_1.v1]
}
}
etc
}
}

Doing the above requires adding some new classes to the RM, or a Presentation Model part of openEHR. It seems to me it would make application software development much easier, and substantially more automatable.

I am aware that other people with far more app/UI experience than I have worked intensively on specifying UI forms, application elements and so on, and have some very smart tools for such purposes. I am therefore not really claiming anything new here, just considering ways to formalise such ideas in a way that would make use of existing tools and formalisms that we have.

thoughts?

  • thomas

If it was to me to design, I would not change the RM. In fact, I think the RM has already classes which do not belong there in my opinion.

I think of AuthoredResources, TranslationDetails, they belong in the AOM.

The RM should not be a myriad of classes used left/right in the OpenEhr system.

We should leave the idea of OpenEhr being a single system. It is an anti-pattern in the microservices paradigm.

Too many dependencies, too much code replication, the monolithic kernel paradigm should be left.

So I favour an AOM with no shared dependencies with the EHR RM. The same idea for the Form classes. Have an own class system with no dependencies outside the system.

But the idea of a Form RM / template I think is very good, and can be a great help for software designers when tooling supports it.

I will study the specs tomorrow, this was what came to mind when I saw your post

Best regards
Bert

these things are generic and are in the , allowing them to be re-used where needed. (They were in the AOM but are needed outside of there). - thomas

I know Thomas, but they have dependencies to other classes in the RM. To data types, to support. By the way, I have never seen use for translation details except for the archetype metadata. But maybe i missed it. That is possible, if so, excuse me for this example.

The terminology service also has dependencies to rm data types, only because of codephrase. Wouldn’t it be possible to avoid that? This also creates a circular dependency at construction of several RM classes. They need the OpenEhr terminology when constructed, and the terminology needs the RM codephrase.

The archetype_Id is inherited from object_id, but why is that necessary? What is the advantage?

Of course it is not only design, it is also the developers, they create those large libraries, but they are inspired by the theoretical architecture-plan, and maybe they need to do that to avoid circular library references.

There is, in my opinion a need to split the RM. Rongs did that a few years ago, he had an Ehr-RM and a (was it…) common RM. A step in a good direction.

So splitting up the RM instead of making it larger would be my idea. The first is not easy to do, but the second is, and helps us avoiding further problems and avoiding creating unnecessary large libraries.

Bert

I think SET has a lot of applications, including result sets. Of course that should interior from LOCATABLE to be archetypable.

I’m not sure on the types associated with the UI. I have a specification for UITenplates that includes some of that, I can share it :slight_smile:

I’m interested in moving this idea forward.

Please let me know how I can help.

Sorry for moving away from the original subject. It was old annoyance coming up when thinking about some RM issues.

Maybe when having a strict separation between the common and some other parts the problems I mentioned partly disappear.

Anyway, it is not yet the moment to discuss such details in the first announcement of a good plan.

Best regards
Bert

I think any existing UI/template specification / app modelling would be useful to share - possibly on the wiki - let me know if you need a page there.

My aim would be to get closer to an IDE application building tool for clinical people to at least build a POC application that works, something like Balsamiq but with real data connections built in. Marand's EhrExplorer does some of this, and it would also be useful to extract some of the semantics of that tool into a standard specification to support this kind of thing.

- thomas

This is an Interesting topic!

Standardised methods for representing application GUI behaviour/appearance in an open vendor neutral way is one of the few still missing pieces in the openEHR ecosystem needed in order to avoid vendor lock in.

Some clever choise of split point is likely fruitful since some parts are closer to openEHR data/query definitions and some will be closer to GUI-implementation/visualisation/layout frameworks (like Angular etc) that should likely not be reinvented by openEHR but that (sometimes at an annoying speed) keep changing versions and popularity faster than the RM/AM/AQL related data definition framework should…

When designing this, perhaps some (2-5) existing currently popular GUI frameworks could be initial targets for output from the process, and the selection could be updated over time. Perhaps for example https://angular.io/ and https://reactjs.org/ are two starting candidates for experimentation? (Both have partially declarative design, but other suggestions are of course welcome) Then mechanisms in those platforms could be reused rather than reinvented.

Also looking at the things done in the format used/shared by Marand and DIPS is an interesting input for gathering requirements.

//Erik Sundvall

sön 18 feb. 2018 kl. 11:51 skrev Thomas Beale <thomas.beale@openehr.org>:

When designing this, perhaps some (2-5) existing currently popular GUI frameworks could be initial targets for output from the process, and the selection could be updated over time. Perhaps for example https://angular.io/ and https://reactjs.org/ are two starting candidates for experimentation? (Both have partially declarative design, but other suggestions are of course welcome) Then mechanisms in those platforms could be reused rather than reinvented.

yes - this is the sort of thing I have in mind. The tool would function as follows:

  • represent UI forms and ?other UI behaviours (some screen workflow) as archetypes+templates of classes that generically represent such things
  • use one or a set of templates to represent an application
  • generate the OPTs of these templates, as ADL2 or JSON, YAML, whatever is convenient
  • perform OPT => GUI transform, injecting some UI styling profile info, to get directly consumable artefacts for the UI framework.

experts on the UI side will be able to help refine the details of this.

THe ‘smart split’ of data / UI semantics will be the key to making this workable.

  • thomas

I think I must have been run out of credit, since my emails yesterday. But still I take my chance. I must warn, Angular is a very complex environment, with much more functionality then just showing GUI’s. I am afraid you load a lot of complexity which will not pay out. By the way, I thought that Marand still uses AngularJS, I don’t know how I got this information, but check it before deciding for it. AngularJS which is the previous version, and is in fact not further developed and not maintained. This for generating Angular code or ReactJS code (which is even more complex because it is a whole different paradigm) There are many disadvantages of using a complex framework. The disadvantage of using Angular or React is that it is not something that works with easy generated code, except when you want to impose the use of Angular to the OpenEhr developers, which will become contradictory with the word “Open”. I think it is best to offer the developer as much freedom as necessary, it makes the effort to create this also longer usable and ask for less maintenance. Therefor I wouldn’t go the way of an existing framework anyway, it is much easier to generate javascript (as simple as possible) and GUI identifiers together with the necessary REST-calls The generated javascript can be quite simple, a GUI-control, an identifier to read the content, and a REST-call which uses the content to do its thing. When developers want, they an copy and paste the generated javascript into their web-framework in order to maintain the own graphical layout and application functionality around the generated code. Integration will become much easier. You could optionally make it more complex (as a second step goal) and still work for the simple copy/past situation. This complexity could be in validating datasets in the browser by Javascript/Typescript, so there will be only network activity when the dataset is validated and OK. That would really do the user-experience good, especially on mobile devices. But this second step could be a later target, first having the simple javascripts generated and the REST calls generated would be a good target to start with. Best regards Bert

Best regards
Bert

And sorry for the sloppy English (when reading back), on Sundays it is worse then on weekdays when I am in working mode. But I think my message is still understandable, so, have a nice Sunday-evening.
:wink:

Bert

I have a pdf spec in Spanish, this was a university project to have platform independent GUI definitions based on opts, while creating technology specific GUI generators for data entry and display. I mentioned this a while ago on the lists but catched not much attention.

Need to do a little translation work :slight_smile:

Wops, pressed send button too early.

We have experimented with lforms and conversions from archetypes are really straightforward

Is it an idea to annotate nodes with instructions for display.

Gerard Freriks
+31 620347088
gfrer@luna.nl

Kattensingel 20
2801 CA Gouda
the Netherlands

I’ve created a new wiki page here on this topic, with the original post contents as background. If others would like to share existing methods or ideas for formalisation of visual or other data sets, I suggest to make a sub-page, and then put a link and short summary description at the bottom of the page I have created.

  • thomas

sön 18 feb. 2018 kl. 23:10 skrev GF <gfrer@luna.nl>:

Is it an idea to annotate nodes with instructions for display.

Yes, using (mostly shared/standardised) annotations for GUI-rendering hints in templates (or layers of templates) has been a major idea in previous GUI-related discussions in openEHR mailing lists.

//Erik

(We should link to some old list posts on the topic in that wiki page Tom created)

Personally I think having special templates/archetypes for display is better. Templates are create per purpose, and mixing purposes in a single template does seem good idea to me

Personally I would prefer if no visualization attributes ended up in the EHR RM, but I’m fine if we want to create an additional RM to handle visualization (and we create templates of that model that point to the EHR model)

I agree on this! (again sloppy English in my previous message, this time changing the meaning, I changed the quote below, I am awake now, will not happen again, excuse me)