LinuxForHealth / hl7v2-fhir-converter

Converts HL7 v2 Messages to FHIR Resources
Apache License 2.0
88 stars 34 forks source link

LAB ORU messages does not contain Specimen information #60

Closed mkazia closed 3 years ago

mkazia commented 3 years ago

The Specimen segments from ORU messages are not included in the converted FHIR bundles.

This HL7 message

MSH|^~\&|SomeSystem||TransformationAgent||201410060645||ORU^R01|182|T|2.5||
PID|1||10006579^^^1^MR^1||DUCK^DONALD^D||19241010|M||1|111 DUCK ST^^FOWL^CA^999990000^^M|1|8885551212|8885551212|1|2||40007716^^^AccMgr^VN^1|123121234|||||||||||NO
OBR|2|88502218|82503246|24317-0^Hemogram and platelet count, automated^LN||||||^COLLECT^JOHN|P|| |||^URO^^^^DR|||||||201410060929||F|F|||||||&CYTO&JANE^201410060929
OBX|1|NM|11156-7^LEUKOCYTES^LN||||||||I|
OBX|2|NM|11273-0^ERYTHROCYTES^LN||4.06|tera.l-1||N|||P|||201410060627
OBX|3|NM|20509-6^HEMOGLOBIN^LN||||||||I|
OBX|4|NM|20570-8^HEMATOCRIT^LN||40.1|%||N|||P|||201410060830
OBX|5|NM|11125-2^PLATELETS^LN||221|giga.l-1||N|||F|||201410060830
SPM|1|SpecimenID||BLD|||||||P||||||201410060535|201410060821||Y||||||1
OBR|1|855238581|890775544|26464-8^Differential WBC Count, buffy coat^LN||||||^COLLECT^JOHN|P| ||||^URO^^^^DR|||||||201410060929|||F|||||||&CYTO&JANE^201410060929
OBX|1|NM|23761-0^NEUTROPHILS/100 LEUKOCYTES^LN||72|%||N|||P|||201410060627
OBX|2|NM|26450-7^EOSINOPHILS/100 LEUKOCYTES^LN||2|%||N|||P|||201410060627
OBX|3|NM|26478-8^LYMPHOCYTES/100 LEUKOCYTES^LN||20|%||N|||P|||201410060627
OBX|4|NM|26485-3^MONOCYTES/100 LEUKOCYTES^LN||6|%||N|||P|||201410060627
OBX|5|NM|30180-4^BASOPHILS/100 LEUKOCYTES^LN||0|%||N|||P|||201410060627
SPM|1|SpecimenID||BLD|||||||P||||||201410060535|201410060821||Y||||||1

generates

{
  "resourceType": "Bundle",
  "id": "db2171a4-245b-4707-bdaf-7b7276174a85",
  "meta": {
    "lastUpdated": "2021-03-11T10:06:29.038-05:00"
  },
  "type": "collection",
  "entry": [
    {
      "fullUrl": "urn:uuid:Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb",
      "resource": {
        "resourceType": "Patient",
        "id": "041325d4-e2e2-46a3-9948-9106bfa56ebb",
        "identifier": [
          {
            "type": {
              "coding": [
                {
                  "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                  "code": "MR",
                  "display": "Medical record number"
                }
              ],
              "text": "MR"
            },
            "value": "10006579",
            "assigner": {
              "reference": "Organization/1"
            }
          }
        ],
        "name": [
          {
            "family": "DUCK",
            "given": [
              "DONALD"
            ]
          }
        ],
        "gender": "male",
        "birthDate": "1924-10-10"
      }
    },
    {
      "fullUrl": "urn:uuid:Organization/1",
      "resource": {
        "resourceType": "Organization",
        "id": "1",
        "name": "Assigning Authority"
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/d143541e-b0e0-4758-97e3-55d13122dc82",
      "resource": {
        "resourceType": "Observation",
        "id": "d143541e-b0e0-4758-97e3-55d13122dc82",
        "identifier": [
          {
            "value": "11156-7_82503246"
          }
        ],
        "status": "registered",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "11156-7",
              "display": "LEUKOCYTES"
            }
          ],
          "text": "LEUKOCYTES"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        }
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/1d0e7439-44e6-45a5-82ef-58661e2caa7f",
      "resource": {
        "resourceType": "Observation",
        "id": "1d0e7439-44e6-45a5-82ef-58661e2caa7f",
        "identifier": [
          {
            "value": "11273-0_82503246"
          }
        ],
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "11273-0",
              "display": "ERYTHROCYTES"
            }
          ],
          "text": "ERYTHROCYTES"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T06:27:00+08:00",
        "valueQuantity": {
          "value": 4.06,
          "unit": "tera.l-1"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "tera.l-1"
            },
            "high": {
              "unit": "tera.l-1"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/18aaa1bb-f91f-4610-84e1-e078cffd2578",
      "resource": {
        "resourceType": "Observation",
        "id": "18aaa1bb-f91f-4610-84e1-e078cffd2578",
        "identifier": [
          {
            "value": "20509-6_82503246"
          }
        ],
        "status": "registered",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "20509-6",
              "display": "HEMOGLOBIN"
            }
          ],
          "text": "HEMOGLOBIN"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        }
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/e208051e-03bf-4fec-8acf-840a15ec54ba",
      "resource": {
        "resourceType": "Observation",
        "id": "e208051e-03bf-4fec-8acf-840a15ec54ba",
        "identifier": [
          {
            "value": "20570-8_82503246"
          }
        ],
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "20570-8",
              "display": "HEMATOCRIT"
            }
          ],
          "text": "HEMATOCRIT"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T08:30:00+08:00",
        "valueQuantity": {
          "value": 40.1,
          "unit": "%"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "%"
            },
            "high": {
              "unit": "%"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/7bb47aa6-783d-4541-8226-2dee25d7baf1",
      "resource": {
        "resourceType": "Observation",
        "id": "7bb47aa6-783d-4541-8226-2dee25d7baf1",
        "identifier": [
          {
            "value": "11125-2_82503246"
          }
        ],
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "11125-2",
              "display": "PLATELETS"
            }
          ],
          "text": "PLATELETS"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T08:30:00+08:00",
        "valueQuantity": {
          "value": 221,
          "unit": "giga.l-1"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "giga.l-1"
            },
            "high": {
              "unit": "giga.l-1"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/e9b4c89a-e675-45b0-9fc7-5108b657f49e",
      "resource": {
        "resourceType": "Observation",
        "id": "e9b4c89a-e675-45b0-9fc7-5108b657f49e",
        "identifier": [
          {
            "value": "23761-0_890775544"
          }
        ],
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "23761-0",
              "display": "NEUTROPHILS/100 LEUKOCYTES"
            }
          ],
          "text": "NEUTROPHILS/100 LEUKOCYTES"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T06:27:00+08:00",
        "valueQuantity": {
          "value": 72,
          "unit": "%"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "%"
            },
            "high": {
              "unit": "%"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/d4102458-879c-4de2-be1d-f2120d93cdc7",
      "resource": {
        "resourceType": "Observation",
        "id": "d4102458-879c-4de2-be1d-f2120d93cdc7",
        "identifier": [
          {
            "value": "26450-7_890775544"
          }
        ],
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "26450-7",
              "display": "EOSINOPHILS/100 LEUKOCYTES"
            }
          ],
          "text": "EOSINOPHILS/100 LEUKOCYTES"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T06:27:00+08:00",
        "valueQuantity": {
          "value": 2,
          "unit": "%"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "%"
            },
            "high": {
              "unit": "%"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/75c97357-284d-48ea-b907-37d62a92ca82",
      "resource": {
        "resourceType": "Observation",
        "id": "75c97357-284d-48ea-b907-37d62a92ca82",
        "identifier": [
          {
            "value": "26478-8_890775544"
          }
        ],
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "26478-8",
              "display": "LYMPHOCYTES/100 LEUKOCYTES"
            }
          ],
          "text": "LYMPHOCYTES/100 LEUKOCYTES"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T06:27:00+08:00",
        "valueQuantity": {
          "value": 20,
          "unit": "%"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "%"
            },
            "high": {
              "unit": "%"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/23a7fbf1-8ce1-48b1-a83a-8e25c7ce729b",
      "resource": {
        "resourceType": "Observation",
        "id": "23a7fbf1-8ce1-48b1-a83a-8e25c7ce729b",
        "identifier": [
          {
            "value": "26485-3_890775544"
          }
        ],
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "26485-3",
              "display": "MONOCYTES/100 LEUKOCYTES"
            }
          ],
          "text": "MONOCYTES/100 LEUKOCYTES"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T06:27:00+08:00",
        "valueQuantity": {
          "value": 6,
          "unit": "%"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "%"
            },
            "high": {
              "unit": "%"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:Observation/e1b7746f-8a49-4489-9a0c-be0d9eba6fc9",
      "resource": {
        "resourceType": "Observation",
        "id": "e1b7746f-8a49-4489-9a0c-be0d9eba6fc9",
        "identifier": [
          {
            "value": "30180-4_890775544"
          }
        ],
        "status": "preliminary",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "30180-4",
              "display": "BASOPHILS/100 LEUKOCYTES"
            }
          ],
          "text": "BASOPHILS/100 LEUKOCYTES"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "effectiveDateTime": "2014-10-06T06:27:00+08:00",
        "valueQuantity": {
          "value": 0,
          "unit": "%"
        },
        "interpretation": [
          {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0078",
                "code": "N",
                "display": "Normal"
              }
            ],
            "text": "N"
          }
        ],
        "referenceRange": [
          {
            "low": {
              "unit": "%"
            },
            "high": {
              "unit": "%"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:DiagnosticReport/54d7edf8-51d5-4477-b2be-6dd2ac3dbfdd",
      "resource": {
        "resourceType": "DiagnosticReport",
        "id": "54d7edf8-51d5-4477-b2be-6dd2ac3dbfdd",
        "identifier": [
          {
            "value": "82503246"
          }
        ],
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "24317-0",
              "display": "Hemogram and platelet count, automated"
            }
          ],
          "text": "Hemogram and platelet count, automated"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "result": [
          {
            "reference": "Observation/d143541e-b0e0-4758-97e3-55d13122dc82"
          },
          {
            "reference": "Observation/1d0e7439-44e6-45a5-82ef-58661e2caa7f"
          },
          {
            "reference": "Observation/18aaa1bb-f91f-4610-84e1-e078cffd2578"
          },
          {
            "reference": "Observation/e208051e-03bf-4fec-8acf-840a15ec54ba"
          },
          {
            "reference": "Observation/7bb47aa6-783d-4541-8226-2dee25d7baf1"
          },
          {
            "reference": "Observation/e9b4c89a-e675-45b0-9fc7-5108b657f49e"
          },
          {
            "reference": "Observation/d4102458-879c-4de2-be1d-f2120d93cdc7"
          },
          {
            "reference": "Observation/75c97357-284d-48ea-b907-37d62a92ca82"
          },
          {
            "reference": "Observation/23a7fbf1-8ce1-48b1-a83a-8e25c7ce729b"
          },
          {
            "reference": "Observation/e1b7746f-8a49-4489-9a0c-be0d9eba6fc9"
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:DiagnosticReport/6722f4db-a9f8-4be6-9758-d04a956ef89b",
      "resource": {
        "resourceType": "DiagnosticReport",
        "id": "6722f4db-a9f8-4be6-9758-d04a956ef89b",
        "identifier": [
          {
            "value": "890775544"
          }
        ],
        "code": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "26464-8",
              "display": "Differential WBC Count, buffy coat"
            }
          ],
          "text": "Differential WBC Count, buffy coat"
        },
        "subject": {
          "reference": "Patient/041325d4-e2e2-46a3-9948-9106bfa56ebb"
        },
        "result": [
          {
            "reference": "Observation/d143541e-b0e0-4758-97e3-55d13122dc82"
          },
          {
            "reference": "Observation/1d0e7439-44e6-45a5-82ef-58661e2caa7f"
          },
          {
            "reference": "Observation/18aaa1bb-f91f-4610-84e1-e078cffd2578"
          },
          {
            "reference": "Observation/e208051e-03bf-4fec-8acf-840a15ec54ba"
          },
          {
            "reference": "Observation/7bb47aa6-783d-4541-8226-2dee25d7baf1"
          },
          {
            "reference": "Observation/e9b4c89a-e675-45b0-9fc7-5108b657f49e"
          },
          {
            "reference": "Observation/d4102458-879c-4de2-be1d-f2120d93cdc7"
          },
          {
            "reference": "Observation/75c97357-284d-48ea-b907-37d62a92ca82"
          },
          {
            "reference": "Observation/23a7fbf1-8ce1-48b1-a83a-8e25c7ce729b"
          },
          {
            "reference": "Observation/e1b7746f-8a49-4489-9a0c-be0d9eba6fc9"
          }
        ]
      }
    }
  ]
}

It is missing SPM segments.

mkazia commented 3 years ago

Fixed with PR #67