Package com.framed.interop.mapping
Class ObservationMapping
java.lang.Object
com.framed.interop.mapping.ObservationMapping
Bidirectional mapping between FRAMED channels and
CodedConcepts, loaded from a JSON file.
Keys are channel identifiers in one of two forms, resolved most-specific first:
"<className>.<deviceID>.<channelID>"— device-specific"<className>.<channelID>"— applies to any device
The reverse index (code -> channel) is used for inbound HL7: a received observation's
code is mapped back to the FRAMED channel coordinates it should be published under.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA resolved FRAMED channel coordinate decoded from a mapping key. -
Method Summary
Modifier and TypeMethodDescriptionchannelForCode(String code) Reverse-maps an incoming code to the FRAMED channel it should be published under.static ObservationMappingfromJson(org.json.JSONObject json) Builds a mapping from an already-parsed JSON object (testing-friendly).static ObservationMappingLoads a mapping from the given JSON file.Looks up the concept for a FRAMED channel, most-specific key first.intsize()
-
Method Details
-
load
Loads a mapping from the given JSON file.- Parameters:
path- path to the mapping JSON (object ofchannelKey -> concept)- Returns:
- the loaded mapping
- Throws:
IOException- if the file cannot be read
-
fromJson
Builds a mapping from an already-parsed JSON object (testing-friendly).- Parameters:
json- object ofchannelKey -> { code, system, display, unit, valueType, mdc, kind }(mdcandkindare optional, seeCodedConcept)- Returns:
- the constructed mapping
-
lookup
Looks up the concept for a FRAMED channel, most-specific key first.- Parameters:
className- the channel's class namedeviceID- the producing device idchannelID- the channel id- Returns:
- the concept, or empty if the channel is not mapped
-
channelForCode
Reverse-maps an incoming code to the FRAMED channel it should be published under.- Parameters:
code- the observation code (e.g. LOINC)- Returns:
- the channel coordinates, or empty if the code is unknown
-
size
public int size()- Returns:
- the number of mapped channels.
-
