EMRAPI changed from looking at global properties to metadata mappings. We upgraded to the ref app v 2.6 and can’t figure out how to add the extra patient identifiers to the patient header. The database states that there’s a metadata set responsible for the patient identifiers. How do I create that metadata set and where should I place it?
@jmaxy figured it out today. Setting the global property alone didn’t work in EMRAPI 1.21.0. We had to adjust the database by adding a metadatamapping set member for each identifier.
Notes:
@raff, @dkayiwa The metadatamapping OWA didn’t propertly display the emr.extraPatientIdentifiers metadata set. We could search by it in the bottom of the UI, but we couldn’t edit it. It looks like we can only edit unmapped identifiers that are in the top part of the OWA UI.
When OpenMRS starts, the metadatamapping_metadata_term_mapping table has an entry for emr.extraPatientIdentifierTypes with code = emr.extraPatientIdentifierTypes, metadataClass = org.openmrs.module.metadatamapping.MetadataSet metadataUUID =feb674fc-36c3-4c87-8d9e-6479b4849923 This means that the extra patient identifier types are mapped to a metadata set with that UUID.
The metadatamapping_metadata_set table has one entry with that UUID.
We realized that we needed to create a metadatamapping_metadata_set_member for each patient identifier. So, we added two rows and it worked. Here are the liquibase changesets
Thanks @craigappl for the detailed feedback. Is having to do the liquibase changeset specific to your implementation, or would it be required by all the others?
Actually, @mksd, what is the use case here? Is there any reason you can’t first fetch the set by code? There’s a utility method here in this case:
Which is used here?
That being said, it’s not a huge deal to add a hard-coded uuid if it’s helpful… we just can’t assume that it’s set to this value across all implementations…
It looks like implementations assume that this specific metadata set’s internal ID is 1, and that seems unreliable (see here and here for iSanté Plus).
Our story is that we need to manage metadata sets with Iniz, and hence we need to specify a fixed external key to that specific set created by EMR API.
Any preference for the naming of the constants? GP keys seem to be prefixed with GP_, should we do MM_.