OCTRI / fhir2hpo

Library for converting FHIR messages to HPO
MIT License
7 stars 2 forks source link

Handle Component LOINCs #20

Closed aeyates closed 6 years ago

aeyates commented 6 years ago

This is a fairly major redesign. The aim was to recognize that an Observation may contain LOINC information and corresponding values/interpretations in either the "code" section or in the "component" section and that an observation may consist of multiple LOINCs and their corresponding values. For example, the LOINC "2345-7", Glucose in Serum, might exist as a standalone observation but can also be part of the LOINC Panel "24320-4", Basic metabolic 1998 panel - Serum or Plasma. In the second case, the LOINC and value could be provided in the components array of the observation along with other tests in the panel. With these changes, the Glucose measurement can now be converted regardless of where it is reported.

kingmanzhang commented 6 years ago

Just throw in some additional thoughts on how to handle observations with components (i.e. panels): It is possible to check whether a LOINC is a panel easily. https://github.com/TheJacksonLaboratory/loinc2hpoAnnotation/blob/master/Data/LoincPanel/loincpanelAnnotation.tsv This table lists all panels and their components. The components have already been annotated whether they are mandatory or optional when a physician orders them. What we need to do is for each panel, annotate whether each component CAN be mapped to an HPO term, and which components are required to map the entire panel to an HPO term.

If an observation is a panel, we need to we trigger a class specific for itself. I have an ugly prototype. https://github.com/monarch-initiative/loinc2hpo/blob/develop/loinc2hpo-core/src/main/java/org/monarchinitiative/loinc2hpo/fhir/FHIRLoincPanelConversionLogic/BloodPressurePanel.java. I should have a method to return conversion result for individual components as well.

This is not necessarily the best way. Just some initial ideas.

aeyates commented 6 years ago

@kingmanzhang Thanks for your feedback. Agreed - this is definitely not the whole story. As I was looking through LOINC's published Panels and Forms doc, I noticed that many of the standalone tests we had already annotated could also be part of a larger panel. It seemed easiest to address that use case first, since it only meant expanding where we search in an observation. While we could use the Panels and Forms info to define the main LOINC we're looking for and which component LOINCs are required or optional, this felt overly rigid to me. For the tests we've already annotated, they are tied to a single result and HPO Term, so converting them is trivial. For time series type panels, we'll need a more complex annotation that does take these relationships into account. I'll check out your prototype, and let's plan to discuss our approach offline. Thanks!