GithubHelp home page GithubHelp logo

cda-fhir's Introduction

cda-fhir

Consolidated CDA (C-CDA) to FHIR converter

Convert C-CDA xml to FHIR bundle

NPM

Build Status Coverage Status Dependency Status

Consolidated CDA (C-CDA)

This library provides the following functionality

  • Parse XML document using sax js parser
  • Generate set of resources conformant to FHIR DSTU2

Usage example:

'use strict';

var _ = require('lodash');

var bbcms = require('./index');

// Make it transactional bundle
var makeTransactionalBundle = function (bundle, base, patientId) {
    _.each(bundle.entry, function (value) {
        value.request = {
            'method': (value.resource.resourceType === 'Patient') ? 'PUT' : 'POST',
            'url': (value.resource.resourceType === 'Patient') ? 'Patient/' + patientId : value.resource.resourceType
        };
        value.base = base;
    });
    bundle.type = 'transaction';
    return bundle;
};

var request = require('request');

// Get sample file from GitHub
var istream = request.get('https://raw.githubusercontent.com/chb/sample_ccdas/master/Vitera/Vitera_CCDA_SMART_Sample.xml');

istream
    .pipe(new bbcms.CcdaParserStream("test" /* PatientId */))
    .on('data', function (data) {
        var bundle = JSON.stringify(makeTransactionalBundle(data), null, '  ');
		
        console.log(bundle); // Result bundle
		
    })
    .on('error', function (error) {
        console.log(error);
    });

License

Licensed under Apache 2.0

cda-fhir's People

Contributors

chaldon avatar kachok avatar

Stargazers

 avatar Rahul Gaur avatar Tada avatar Sam Wang avatar JB avatar Matt McCall avatar Mustafa Yüksel avatar Ryan M Harrison avatar Mariano Botta avatar Jan Stümmel avatar Douglas Ludlow avatar Igor Sirkovich avatar

Watchers

Christopher Best avatar  avatar Michael R. Bernstein avatar Harry Rickards avatar James Cloos avatar Keith avatar kevin moore avatar Michael Hiner avatar  avatar  avatar Marc Sylvestre avatar Perry Ogwuche avatar Matt McCall avatar Mehmet avatar Ryan Plemons avatar James Fadeley avatar Ryan M Harrison avatar Afsin Ustundag avatar  avatar D Brezack avatar Amida Robot avatar Alan T avatar Alain Briancon avatar  avatar Anthony Velazquez avatar  avatar  avatar Alicia Phillips Mandaville avatar Morgan  Peters avatar  avatar  avatar Ling Ling Ng avatar lacey irvin avatar  avatar Steven Staley avatar  avatar  avatar  avatar

cda-fhir's Issues

Id to Identifier translations are inconsistent between resources

From CCD_1

Patient.identifier:
{"extension": "998991",
"root": "2.16.840.1.113883.19.5.99999.2"} ->
{"system": "urn:oid:2.16.840.1.113883.19.5.99999.2",
"value": "998991"}

Practitioner.identifier:
{"root": "2.16.840.1.113883.19.5.9999.456",
"extension": "2981823"} ->
{ "value": "2.16.840.1.113883.19.5.9999.456"}, extension is lost

id field not mapped correctly

This fragment comes from https://raw.githubusercontent.com/chb/sample_ccdas/master/Allscripts%20Samples/Enterprise%20EHR/b2%20Adam%20Everyman%20ToC.xml

<observation classCode="OBS" moodCode="EVN"> <templateId root="2.16.840.1.113883.10.20.22.4.2" /> <id extension="30011130000073" root="1.3.6.1.4.1.22812.3.9999341.3.4.5" /> <id extension="30011130000077" root="1.3.6.1.4.1.22812.3.9999341.3.4.5" /> <code codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" code="2028-9" displayName="Carbon Dioxide" />

running the script produces:

  "resource": {
    "resourceType": "Observation",
    "id": "Observation/28",
    "subject": {
      "reference": "Patient/test"
    },
    "identifier": [
      {
        "value": "1.3.6.1.4.1.22812.3.9999341.3.4.5"
      },
      {
        "value": "1.3.6.1.4.1.22812.3.9999341.3.4.5"
      }
    ],
    "code": {
      "coding": [
        {
          "system": "http://loinc.org",
          "code": "2028-9",
          "display": "Carbon Dioxide"
        }
      ]
    },

The identifier values seem off - shouldn't "1.3.6.1.4.1.22812.3.9999341.3.4.5" be the 'system' and '30011130000077' be a value?

I'm not a C-CDA expert and maybe the data in sample_ccdas is incorrect - assuming the data is at least somewhat correct.

outcome for FamilyMemberHistory not correctly nested

For FamilyMemberHistory outcome needs to be in a coding element

            "outcome": {
                "coding": {
                  "system": "http://snomed.info/sct",
                  "code": "419099009",
                  "display": "Dead"

                }
            }

not

            "outcome": {
                  "system": "http://snomed.info/sct",
              "code": "419099009",
              "display": "Dead"
            }

Conditions codes are not accurate

For CCD_1 example (or bluebutton-01-original) there are two Conditions whose codes are not accurate. The following is the code for the template in a CCDA template not the identification for the problem itself
"code": {
"coding": [
{
"system": "urn:oid:2.16.840.1.113883.5.6",
"code": "CONC",
"display": "Concern"
}
]
}

Also "Asthma" as a problem in CCDA does not show up as Condition in FHIR. It looks like erroneous Conditions come from ClinicalImpressions.

FamilyMemberHistory.gender, .bornDate should not depend on sdtc:id

In CCDA spec administrativeGenderCode and birthTime does not depend on stdc:id and definitely not to example OID 2.16.840.1.113883.19.5.99999.2. Not sure we have the following code. Due to this code when stdc:id is not there gender and bornDate is not populated

this['sdtc:id'] = function (node) {
    if (node.attributes.root === '2.16.840.1.113883.19.5.99999.2') {
        this._self = {
            administrativeGenderCode: function (node) {
                familyMemberHistory.gender = recodeGender(node.attributes.code);
            },
            birthTime: function (node) {
                familyMemberHistory.bornDate = dateFix(node.attributes.value);
            }
        };
        this._self.prototype = proto;

AllergyIntolerance.reaction.severity mapping problems

CCD_1.xml: severity for "PENICILLIN"->"Nausea" reaction shows up as "severe". In the original CCDA file it is "Mild". I think Mild should map to mild, Moderate should map to moderate and Severe should map to severe. Middle severities (Mild to Moderate, Moderate To Severe) should probably go to higher severity.

Practitioner resource is repeated

CCD_1.xml. There are 4 Practitioner resources on "Amanda Assigned" that are identical; Practitioner/16, Practitioner/20, Practitioner/24, and Practitioner/28. Associated organizations (Organization/17, Organization/21, Organization/25, Organization/29) are also repeated.

All Practitioners have the same identifiers as well.

Condition onset period cannot have same date

Condition onsetPeriod can not have the same start and end date. If the dates match onsetDate must be used. If the dates match and onsetperiod is used Hapi does not save the date at all.

Time zones are not supported

Examples:
CCD_1
social history entry with 'Former Smoker" effectiveTime high
encounter entry effectiveTime high

Claim.item.type does not have a "coding" child element

For Claim.item.type do not wrap in coding element:

should be like:

             "item": [
          {
            "sequence": 1,
            "type": {
                  "system": "http://snomed.info/sct",
                  "code": "73761001",
                  "display": "Colonoscopy"
                }
          }
        ]

not

        "item": [
          {
            "sequence": 1,
            "type": {
              "coding": [
                {
                  "system": "http://snomed.info/sct",
                  "code": "73761001",
                  "display": "Colonoscopy"
                }
              ]
            }
          }
        ]

Condition.code.coding is sometimes object

CCD_1.xml.

This is inconsistent. Condition.code.coding is sometimes an object and sometimes an array. Same for Condition.category.coding. All the examples I saw on FHIR website coding is always an array.

Practitioners managing organization

For Practitioners you have a managing organization at the root level, which is incorrect.

ManagingOrganization is also already in the correct location (practitionerRole.#.managingOrganization) however.

AllergyIntolerance manifestation picks up wrong value

I do not think
"coding": [
{
"system": "http://snomed.info/sct",
"code": "419511003",
"display": "Propensity to adverse reactions to drug"
}

should be in manifestation. It is more related to "AllergyIntolerance.type"

patient identifiers don't go through makeCode translation

A patient with an SSN in a C-CDA ends up looking like this:

      {
        "system": "urn:oid:2.16.840.1.113883.4.1",
        "value": "111-00-1234"
      }

when it probably could look like this (as in the sample HL7 JSON at https://www.hl7.org/fhir/patient-examples-general.json.html):

      {
        "system": "http://hl7.org/fhir/sid/us-ssn",
        "value": "111-00-1234"
      }

now - that translation isn't in makeCode currently, but even if you add it - the code that creates the identifier is:

        _patient.identifier.push({
            'system': 'urn:oid:' + node.attributes.root,
            'value': node.attributes.extension
        });

so the root is just passed through. There is a comment in makeCode that says 'TODO - complete recoding' - so not sure if this is already in the plans or not to generalize a little.

ProcedureRequest is repeated

CCD_1.xml. ProcedureRequest/47, ProcedureRequest/48, ProcedureRequest/49, and ProcedureRequest/50 are identical.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.