Giter Club home page Giter Club logo

Comments (5)

eedrummer avatar eedrummer commented on August 13, 2024

Could you provide sample XML to reproduce this?

On Sunday, October 27, 2013, Ben West wrote:

When trying to upload a file in popHealth with an encounter section but no
dischargeDispositionCode, I get this error:

Nokogiri::XML::XPath::SyntaxError (Undefined namespace prefix:
./sdtc:discharge\DispositionCode):
lib/record_importer.rb:64:in import'
app/controllers/admin_controller.rb:42:inblock (2 levels) in
upload_patients'
app/controllers/admin_controller.rb:39:in each'
app/controllers/admin_controller.rb:39:inblock in upload_patients'
app/controllers/admin_controller.rb:38:in `upload_patients'

It seems to be coming from this line in health-data-standards:

encounter.discharge_disposition = extract_code(parent_element, "./sdtc:dischargeDispositionCode")

Encounters MAY contain [0..1] dischargeDispositionCodes, so the lack of a
dischargeDispositionCode shouldn't be a fatal error.


Reply to this email directly or view it on GitHubhttps://github.com/projectcypress/health-data-standards/issues/64
.

from health-data-standards.

Xodarap avatar Xodarap commented on August 13, 2024

I looked into this some more. I can't quite figure out the issue, but I think it has something to do with defining the sdtc namespace inline instead of at the top of the document. Below is a document which reproduces the issue - it's basically the same as the existing encounter performed test doc except I've defined sdtc inline and removed dischargeDisposition (and added some patient header stuff).

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/xsl' href='CDA.xsl'?>
<ClinicalDocument  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" >
  <realmCode code="US" />
  <typeId extension="POCD_HD000040" root="2.16.840.1.113883.1.3" />
  <templateId root="2.16.840.1.113883.10.20.24.1.1" />
  <templateId root="2.16.840.1.113883.10.20.24.1.2" />
  <id assigningAuthorityName="EPC" extension="4bca62ca-3d81-11e3-8ecc-460231621f93" root="1.2.840.114350.1.13.327.1.7.1.1" />
  <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="QRDA Category I – Single Patient Report" />
  <title>Quality Measure Report (Patient Level)</title>
  <effectiveTime value="20131025092528" />
  <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25" />
  <languageCode code="en-US" />
  <recordTarget>
    <patientRole>
      <id extension="395-73-5097" root="2.16.840.1.113883.4.1" />
      <addr use="HP">
        <streetAddressLine nullFlavor="UNK" />
        <city nullFlavor="UNK" />
      </addr>
      <telecom nullFlavor="UNK" />
      <patient>
        <name>
          <given>crash</given>
          <family>Btw</family>
        </name>
        <administrativeGenderCode code="F" codeSystem="2.16.840.1.113883.5.1" codeSystemName="AdministrativeGenderCode" />
        <birthTime value="19631025" />
        <ethnicGroupCode codeSystem="2.16.840.1.113883.6.238" nullFlavor="UNK" />
      </patient>
    </patientRole>
  </recordTarget>
  <legalAuthenticator>
    <time value="20131025092528-0500" />
    <signatureCode code="S" />
    <assignedEntity>
      <id extension="1000001143" root="2.16.840.1.113883.4.6" />
      <telecom use="WP" />
      <assignedPerson>
        <name>
          <given>MUHAMMAD</given>
          <family>BTW AL-KHWARIZMI</family>
        </name>
      </assignedPerson>
      <representedOrganization>
        <id extension="1" root="1.2.840.114350.1.13.327.1.7.2.696570" />
        <name>CDE FACILITY</name>
        <telecom use="WP" value="tel:+1-404-777-8000" />
        <addr nullFlavor="UNK" />
      </representedOrganization>
    </assignedEntity>
  </legalAuthenticator>
  <component>
    <structuredBody>
      <component>
        <section>
          <templateId root="2.16.840.1.113883.10.20.17.2.4" />
          <templateId root="2.16.840.1.113883.10.20.24.2.1" />
          <code code="55188-7" codeSystem="2.16.840.1.113883.6.1" />

          <entry>
            <encounter classCode="ENC" moodCode="EVN">
              <templateId root="2.16.840.1.113883.10.20.22.4.49"/>
              <templateId root="2.16.840.1.113883.10.20.24.3.23"/>
              <id root="1.3.6.1.4.1.115" extension="512ba7eae7e915f677000003"/>
              <code code="112689000" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113883.3.666.5.625" xmlns:sdtc="urn:hl7-org:sdtc"><originalText>Encounter, Performed: Hospital 

Measures-Encounter Inpatient (Code List: 2.16.840.1.113883.3.666.5.625)</originalText></code>
              <text>Encounter, Performed: Hospital Measures-Encounter Inpatient (Code List: 

2.16.840.1.113883.3.666.5.625)</text>
              <statusCode code="completed"/>
              <effectiveTime>
                <low value='20061121075239'/>
                <high value='20061122012933'/>
              </effectiveTime>
            </encounter>
          </entry>
        </section>
      </component>
    </structuredBody>
  </component>
</ClinicalDocument>

from health-data-standards.

eedrummer avatar eedrummer commented on August 13, 2024

Thanks for the XML. I was able to reproduce the behavior that you were seeing.

The problem here is actually in the RecordImporter in popHealth. health-data-standards importers expect a Nokogiri document that has all of the namespace prefixes set up. In the RecordImporter, we were setting up the cda namespace prefix, but not the sdtc one. I think that on most documents, we could get away with that because Nokogiri will support any namespace prefixes that are declared in the start of the document. By registering the prefix, it fixes this bug.

I have the code working locally. I just need to package it up and issue a pull request.

I've added your XML example to the test suite. I hope you don't mind.

Additionally, we should probably rethink the assumptions health-data-standards makes about namespace prefixes being registered.

from health-data-standards.

Xodarap avatar Xodarap commented on August 13, 2024

I've added your XML example to the test suite. I hope you don't mind.

Sure, no problem. Thanks for the quick turnaround.

from health-data-standards.

eedrummer avatar eedrummer commented on August 13, 2024

Fixed in popHealth

from health-data-standards.

Related Issues (20)

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.