Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: update design to match source code: MetadataTerm -> MetadataTermMapping

...

  • metadata_source is used to define a unique source (authority) for each namespace of metadata terms.
    • name should be fully qualified and universally unique.
  • metadata_term table _mapping table provides both the term and its mapping to local metadata.
    • code should be unique within the given source.
    • metadata_class refers to the Java class for the metadata.
    • metadata_reference is a unique reference to the metadata within the class (e.g., uuid)
  • metadata_set is used to define relating grouping of metadata similar to what OpenMRS has traditionally done within global properties and similar to FHIR's ValueSet for metadata terms.
    • sort_weight is used to optionally give members of a metadata set a reliable sequence.

...

Retire term:
Code Block
java
java
List<MetadataTerm>List<MetadataTermMapping> termstermMappings = metadataService.getMetadataTermsgetMetadataTermMappings(location);
metadataService.retireMapping(termstermMappings.get(0), "some reason");
Create term: 
Code Block
java
java
MetadataSource source = metadataService.getSourceByName("SOME-SOURCE");
MetadataTermMetadataTermMapping termtermMapping = new MetadataTermMetadataTermMapping(source, "CODE", location);
metadataService.saveMetadataTermsaveMetadataTermMapping(termtermMapping);
Create terms in bulk:
Code Block
java
java
List<MetadataTerm>List<MetadataTermMapping> termstermMappings = Arrays.asList(mapping1, mapping2, mapping3);
metadataService.saveMetadataTermssaveMetadataTermMappings(termstermMappings);
Get term by source and code:
Code Block
java
java
MetadataTermMetadataTermMapping termtermMapping = metadataService.getMetdataTermgetMetadataTermMapping(mappingSource, "CODE");
Get terms by source:
Code Block
java
java
List<MetadataTerm>List<MetadataTermMapping> termstermMappings = metadataService.getMetadataTermsgetMetadataTermMappings(source);
Get term by uuid:
Code Block
java
java
MetadataTermMetadataTermMapping mappingtermMapping = metadataService.getMetadataTermByUuidgetMetadataTermMappingByUuid(String uuid);
Get source by uuid:
Code Block
java
java
MetadataSource source = metadataService.getMetadataSourceByUuid(String uuid);

...

MetadataTermMapping, MetadataSource, MetadataSet should support all CRUD operations.