@kosmik, will you be able to join us? Please see https://wiki.openmrs.org/display/RES/Design+Forum for connection details.
Yes @raff, I will be joining. Seems like I just forgot to tell anyone.
Thanks for joining the call. The key takeaways are:
-
Fix MetadataTerm.metadataClass and MetadataTerm.metadataUuid to be optional in order to be able to create a mapping, which does not yet point to any metadata in the system and can be configured at some later point. MAP-13
-
MetadataSet will not be included in the first version of a module as there is no agreement on the approach to take.
Thanks for the summary, @raff.
I will be going away on my midwinter holiday now and will get back to work on this module after a week or two. I will then concentrate on finishing the few minor issues that we still have (not including MetadataSet).
Any ideas on how will we proceed with working on the MetadataSet feature set (or something else of that nature if MetadataSet is deemed invalid)? Personally, I have noticed that I have problems grasping the functional requirements side of things here as I donāt have the required experience with OpenMRS. Thus I would be very happy to concentrate on the technical side/programming and leave the āwhyā to others.
Iām not sure this is 100% finalized (so maybe itās convenient that @kosmik will be off for a week or two).
There is a key difference between MetadataSource/MetadataTerm in this module vs. ConceptSource/ConceptReferenceTerm in core. For concepts in core the term and the mapping are separate things (term = source + code; mapping = concept + term), whereas in this module, the term and the mapping are combined together (term = source + code + ref-to-metadata).
The implication of this is that a MetadataTerm can only point to a single metadata (versus multiple concepts can be mapped to the same reference term). Iām fine with this model, and it generally follows from Mikeās use case, that a module creates a term to represent something it needs to be able to look up (e.g. āwhich encounter type should represent āadmissionāā).
But I understood Burke (and Wyclif) to be uncomfortable with using this module to do this kind of configuration, because itās supposed to do mapping. Was I understanding that right? Or are we all on the same page about using this for the āsingle metadataā use case, and the disagreement is just about sets (e.g. āwhich encounter types (plural) should close a visitā?
Hi all,
New to OpenMRS - I just recently touched base with @raff and @kosmik and began reviewing the project history and notes (including the June and Dec 2015 design forums).
Based on Mikkoās thoughts above regarding the requirements (same here) and some of my own regarding the logical design (below), I think it may be worthwhile to capture the business requirements a bit more formally first (not too formal, just enough to clarify and aid understanding) and then iterate on the design before going too much further in implementation. Iām no expert in this regard but would like to help out with this if possible.
To @darius 's point above, my impression of the 1:1 mapping between metadata_term
and openmrs_metadata
is that if it is fully-qualified (namespace qualified), the relationship actually becomes many-to-one at the table/object level. I think that this started coming out nicely in the draft logical model, but hit a small snag:
So I started to look at this a bit more, and hereās where Iām at so far:
Granted, ORM (using Hibernate) will obviate some of the relational constructs, but my goal is to try to understand the model better. That said, I think Iām at a point that Iād like to go back to the requirements before continuing as well.
To summarize: new guy wants to help, thinks getting slightly more detailed requirements and a logical model āon paperā might be helpful.
@jasonvena, Let me refer to some of your comments from the diagram:
- Metadata_term uniqueness is based on source and code thus a composite unique constraint should be defined for 2 columns metadata_source_id and code.
- What is the term_surrogate_id for? metadata_term_id should be the primary key
- Metadata_reference_uuid is not a foreign key. We will not use a database key as we will be referencing different tables based on metadata_class, which will point to the correct table (location, provider_attribute_type, etc.) and metadata_reference_uuid, which will point to the exact row.
The rest seems right to me. Weāll skip metadata_set for now.
Thanks for reviewing @raff much appreciated Review by item:
OK - a good clarification of which attributes are involved in the composite unique constraint, thanks.
Since metadata_term_id
no longer participates in the composite uniqueness constraint, there is no 2NF violation if used as primary key. No need for another surrogate.
[quote=āraff, post:27, topic:3315ā] Metadata_reference_uuid is not a foreign key. We will not use a database key as we will be referencing different tables based on metadata_class, which will point to the correct table (location, provider_attribute_type, etc.) and metadata_reference_uuid, which will point to the exact row. [/quote] The design page seemed to indicate that this is an addition to, and not a replacement for, the FK relationship (āinstead of justā), thanks for clarifying
Agreed - metadata_set
ās relationship with metadata_term
does not appear to be completely decided. At present itās both a many-to-many and an inheritance relationship, so design clarification may help to simplify things a bit.
Actually I chose to rename MetadataTerm as MetadataTermMapping earlier as it defines both the term and the mapping (at least in the original design). We might choose to tweak the terminology if the model/logic changes.
This is still unclear to me: How will the metadata mappings be defined in practice when looking at it from the perspective of a OpenMRS installation?
- Does a module include liquibase updates (or whatever) that populate the database with terms and mappings so that the administrator does not need to do anything?
- Or does the module only define the terms so that the administrator must take care of defining the mappings? (This implies that mapping is optional in the data model)
- Something completely different?
Iām not sure but maybe there is a misunderstanding here? I admit the diagram might not be intuitive as I have used one-to-one relationships in the meaning āa extends bā. I added a note on the design page: āNote that in this diagram, the one-to-one mapping between metadata_source and openmrs_metadata, for example, indicates an inheritance in object design terms: MetadataSource inherits the fields of OpenmrsMetadata. In the database schema, this relationship will be implemented so that the relation metadata_source, for example, includes all the columns of openmrs_metadata.ā
Hi Mikko, I do see what youāre saying but the diagram notation used (Information Engineering or IE) has standardized meanings and unfortunately doesnāt indicate the desired extension relationship.
Something Iāve come to appreciate from my draft relational data model above (and in thinking about Rafalās feedback) is that we might want to start diagramming at a higher level of abstraction in the system using a more generalized notation like UML. We really canāt express ORM well using an IE diagram, and since the relationship between metadata_term
and openmrs_metadata
is not determined by relational db constraints at all (see Rafalās 3rd bullet above), thereās not much of a story to tell unless we frame it in a bigger context.
As there are still design decisions outstanding, Iāll continue to think about possible ways to communicate diagramatically in a standards-based way, which hopefully would make life easier for everybody!
I agree. A UML class diagram would support communication much better as a relational diagram is in my opinion more useful when discussing about db implementation details.
There might be a lesson to be learned here. When this project landed on my desk I made the naive assumption that the (undocumented) functional requirements have already been so well thought of that we only needed to focus on the implementation details. Now that we have hit a couple uncertainties/disagreements it would be very helpful if someone had documented the original requirements based on which the initial implementation design had evolved.
I see 2 possibilities:
- Some modules may install its own metadata, which is typically done in moduleās activator on startup. In such a case a module will install metadata only if a mapping does not exist in the system yet. Following installation of metadata in moduleās activator, both terms and mappings can be created by a module using API calls to MetadataMappingService. If metadata cannot be installed due to any reason e.g. duplicate names validation error, then the module may decide to create just terms and let an administrator set mappings to metadata, which exist in the system.
- Some modules will only come with terms (added on startup from moduleās activator), expecting an administrator to set mappings to metadata, which exist in the system.
Are there are any other outstanding design issues, which I am missing?
Thanks, this helps a lot. Actually I went so far as to create a wiki page for gathering this kind of use cases or workflows: Metadata Mapping - Ideas for Use Cases - Documentation - OpenMRS Wiki
Feel free to write you ideas and comments there. I know this comes a bit late in the process but I thought we would still benefit from any kind of written descriptions of what this module is about and what is out of scope. So why not give it a try? Am I making any sense to any of you out there?
Excluding sets, I canāt think of anything urgent except for @dariusās post which leaves some things hanging in the air as no one has commented on them:
I recall we talked about this on some design call and as Darius says these mappings seem to differ from concept mappings which gets confusing at one point because it becomes had to distinguish them from tagging and we never seemed to come to an agreement when it comes to the sets
I started another thread for access control related design. @raff, care to comment?
Good idea. I just added a use case diagram there to try to provide some perspective on what the moduleās requirements look like.
Hopefully at some point we can generalize that page into something like a ādesign playgroundā for the module, a place to exchange design/purpose/scope ideas informally and prior to any official design documentation. To Wyclifās point, I agree that the relationships between the existing metadata-associated initiatives are confusing - having a place to āthink out loudā about them could help!
Great stuff!
Ok, letās try to pull a release together.
The only remaining confusion seems to be whether a MetadataTermMappingās reference to a OpenmrsMetadata should be optional or not. I say we make it optional, publish an alpha release and see how it goes. If everyone is happy we do a proper release, otherwise we try something else.
We have 3 tickets in design/progress for version 1.1.0: https://issues.openmrs.org/issues/?jql=fixVersion%20%3D%201.1.0%20AND%20project%20%3D%20MAP%20ORDER%20BY%20key%20ASC%2C%20status%20DESC
One of those tickets is still unassigned (nudge nudge).