Указанный тип не был распознан: name='CD', namespace='urn:hl7-org:v3
Я пытаюсь десериализовать XML-файл, используя класс aC#, который был сгенерирован автоматически. Когда я пытался десериализовать XML-файл, я получаю исключение "Указанный тип не был распознан". Кто-нибудь сталкивался с этой проблемой раньше? Ваша помощь будет принята с благодарностью.
Я пытался загрузить класс C# и файлы xsd, но они слишком велики для загрузки здесь.
Класс C# был сгенерирован из файла xsd, который был создан с использованием файла xml ниже. Два xsd файла были созданы qrda.xsd и qrda1.xsd, и следующая команда была использована для генерации класса C# (xsd qrda.xsd qrda1.xsd /c)
<?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:hl7-org:v3"
xmlns:voc="urn:hl7-org:v3/voc"
xmlns:sdtc="urn:hl7-org:sdtc">
<!-- QRDA Header -->
<realmCode code="US"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
<!-- US Realm Header Template Id -->
<templateId root="2.16.840.1.113883.10.20.22.1.1"/>
<!-- QRDA templateId -->
<templateId root="2.16.840.1.113883.10.20.24.1.1"/>
<!-- QDM-based QRDA templateId -->
<templateId root="2.16.840.1.113883.10.20.24.1.2"/>
<!-- This is the globally unique identifier for this QRDA document -->
<id root="96b52620-49bd-0132-cf19-4040b69a5a45"/>
<!-- QRDA document type code -->
<code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
<title>QRDA Incidence Report</title>
<!-- This is the document creation time -->
<effectiveTime value="20141108213906"/>
<confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
<languageCode code="eng"/>
<!-- reported patient -->
<recordTarget>
<patientRole>
<id extension="12345" root="PlaceholderOrganization" />
<addr use="HP">
<streetAddressLine>202 Burlington Rd.</streetAddressLine>
<city>Bedford</city>
<state>MA</state>
<postalCode>01730</postalCode>
<country>US</country>
</addr>
<telecom use="WP" value="tel:+1-781-271-3000"/>
<patient>
<name>
<given>Jesus</given>
<family>Abbott</family>
</name>
<administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1" codeSystemName="HL7 AdministrativeGender"/>
<birthTime value="19380305153120"/>
<raceCode code="1002-5" displayName="American Indian or Alaska Native" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
<ethnicGroupCode code="2186-5" displayName="Not Hispanic or Latino" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
<languageCommunication>
<templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
<templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
<languageCode code="eng"/>
</languageCommunication>
</patient>
</patientRole>
</recordTarget>
<!-- Example of an author who is a device -->
<author>
<time value="20141108213906"/>
<assignedAuthor>
<!-- id extension="Cypress" root="2.16.840.1.113883.19.5"/ -->
<!-- NPI -->
<id extension="FakeNPI" root="2.16.840.1.113883.4.6"/>
<addr>
<streetAddressLine>202 Burlington Rd.</streetAddressLine>
<city>Bedford</city>
<state>MA</state>
<postalCode>01730</postalCode>
<country>US</country>
</addr>
<telecom use="WP" value="tel:(781)271-3000"/>
<assignedAuthoringDevice>
<manufacturerModelName>Cypress</manufacturerModelName >
<softwareName>Cypress</softwareName >
</assignedAuthoringDevice >
</assignedAuthor>
</author>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id root="2.16.840.1.113883.19.5"/>
<name>Cypress Test Deck</name>
<telecom use="WP" value="tel:(781)271-3000"/>
<addr>
<streetAddressLine>202 Burlington Rd.</streetAddressLine>
<city>Bedford</city>
<state>MA</state>
<postalCode>01730</postalCode>
<country>US</country>
</addr>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20141108213906"/>
<signatureCode code="S"/>
<assignedEntity>
<id root="bc01a5d1-3a34-4286-82cc-43eb04c972a7"/>
<addr>
<streetAddressLine>202 Burlington Rd.</streetAddressLine>
<city>Bedford</city>
<state>MA</state>
<postalCode>01730</postalCode>
<country>US</country>
</addr>
<telecom use="WP" value="tel:(781)271-3000"/>
<assignedPerson>
<name>
<given>Henry</given>
<family>Seven</family>
</name>
</assignedPerson>
<representedOrganization>
<id root="2.16.840.1.113883.19.5"/>
<name>Cypress</name>
</representedOrganization>
</assignedEntity>
</legalAuthenticator>
<documentationOf typeCode="DOC">
<serviceEvent classCode="PCPR"> <!-- care provision -->
<!-- No provider data found in the patient record
putting in a fake provider -->
<effectiveTime>
<low value="20020716"/>
<high value="20141108213906"/>
</effectiveTime>
<!-- You can include multiple performers, each with an NPI, TIN, CCN. -->
<performer typeCode="PRF">
<time>
<low value="20020716"/>
<high value="20141108213906"/>
</time>
<assignedEntity>
<!-- This is the provider NPI -->
<id root="2.16.840.1.113883.4.6" extension="111111111" />
<representedOrganization>
<!-- This is the organization TIN -->
<id root="2.16.840.1.113883.4.2" extension="1234567" />
<!-- This is the organization CCN -->
<id root="2.16.840.1.113883.4.336" extension="54321" />
</representedOrganization>
</assignedEntity>
</performer>
</serviceEvent>
</documentationOf>
<component>
<structuredBody>
<component>
<section>
<!--
*****************************************************************
Measure Section
*****************************************************************
-->
<!-- This is the templateId for Measure Section -->
<templateId root="2.16.840.1.113883.10.20.24.2.2"/>
<!-- This is the templateId for Measure Section QDM -->
<templateId root="2.16.840.1.113883.10.20.24.2.3"/>
<!-- This is the LOINC code for "Measure document". This stays the same for all measure section required by QRDA standard -->
<code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
<title>Measure Section</title>
<text>
<table border="1" width="100%">
<thead>
<tr>
<th>eMeasure Title</th>
<th>Version neutral identifier</th>
<th>eMeasure Version Number</th>
<th>Version specific identifier</th>
</tr>
</thead>
<tbody>
<tr>
<td>Thrombolytic Therapy</td>
<td>2838875A-07B5-4BF0-BE04-C3EB99F53975</td>
<td>4</td>
<td>40280381-446B-B8C2-0144-95DE69F81CF4</td>
<td></td>
</tr>
</tbody>
</table>
</text>
<!-- 1..* Organizers, each containing a reference to an eMeasure -->
<entry>
<organizer classCode="CLUSTER" moodCode="EVN">
<!-- This is the templateId for Measure Reference -->
<templateId root="2.16.840.1.113883.10.20.24.3.98"/>
<!-- This is the templateId for eMeasure Reference QDM -->
<templateId root="2.16.840.1.113883.10.20.24.3.97"/>
<statusCode code="completed"/>
<!-- Containing isBranch external references -->
<reference typeCode="REFR">
<externalDocument classCode="DOC" moodCode="EVN">
<!-- SHALL: This is the version specific identifier for eMeasure: QualityMeasureDocument/id it is a GUID-->
<id root="40280381-446B-B8C2-0144-95DE69F81CF4"/>
<!-- SHOULD This is the title of the eMeasure -->
<text>Thrombolytic Therapy</text>
<!-- SHOULD: setId is the eMeasure version neutral id -->
<setId root="2838875A-07B5-4BF0-BE04-C3EB99F53975"/>
<!-- This is the sequential eMeasure Version number -->
<versionNumber value="4"/>
</externalDocument>
</reference>
</organizer>
</entry>
</section>
</component>
<component>
<section>
<!-- This is the templateId for Reporting Parameters section -->
<templateId root="2.16.840.1.113883.10.20.17.2.1"/>
<code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
<title>Reporting Parameters</title>
<text>
<list>
<item>Reporting period: January 1st, 2013 00:00 - December 31st, 2013 23:59</item>
</list>
</text>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="EVN">
<!-- This is the templateId for Reporting Parameteres Act -->
<templateId root="2.16.840.1.113883.10.20.17.3.8"/>
<code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
<effectiveTime>
<low value="20130101000000"/>
<high value="20131231235959"/>
</effectiveTime>
</act>
</entry>
</section>
</component>
<component>
<section>
<!-- This is the templateId for Patient Data section -->
<templateId root="2.16.840.1.113883.10.20.17.2.4"/>
<!-- This is the templateId for Patient Data QDM section -->
<templateId root="2.16.840.1.113883.10.20.24.2.1"/>
<code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
<title>Patient Data</title>
<text>
</text>
<entry>
<encounter classCode="ENC" moodCode="EVN">
<!-- Encounter activities template -->
<templateId root="2.16.840.1.113883.10.20.22.4.49"/>
<!-- Encounter performed template -->
<templateId root="2.16.840.1.113883.10.20.24.3.23"/>
<id root="1.3.6.1.4.1.115" extension="54272ceb637970595b9c0000"/>
<code code="4525004" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.292"><originalText>Encounter, Performed: Emergency Department Visit</originalText></code>
<text>Encounter, Performed: Emergency Department Visit</text>
<statusCode code="completed"/>
<effectiveTime>
<!-- We try to look for the admit/discharge times on the encounter if they are
there. If not, we fall back to the typical start/end date. -->
<low value='20130112170120'/>
<high value='20130112210120'/>
</effectiveTime>
<participant typeCode="LOC">
<!-- Facility Location template -->
<templateId root="2.16.840.1.113883.10.20.24.3.100"/>
<time>
<!-- Attribute: facility location arrival datetime -->
<low value='20130112170120'/>
<!-- Attribute: facility location departure datetime -->
<high value='20130112210120'/>
</time>
<participantRole classCode="SDLOC">
<code nullFlavor="UNK"/>
<telecom nullFlavor="UNK"/>
<playingEntity classCode="PLC">
<name></name>
</playingEntity>
</participantRole>
</participant>
</encounter>
</entry>
<entry>
<encounter classCode="ENC" moodCode="EVN">
<!-- Encounter activities template -->
<templateId root="2.16.840.1.113883.10.20.22.4.49"/>
<!-- Encounter performed template -->
<templateId root="2.16.840.1.113883.10.20.24.3.23"/>
<id root="1.3.6.1.4.1.115" extension="54272ceb637970595b9e0000"/>
<code code="4525004" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.292"><originalText>Encounter, Performed: Emergency Department Visit</originalText></code>
<text>Encounter, Performed: Emergency Department Visit</text>
<statusCode code="completed"/>
<effectiveTime>
<!-- We try to look for the admit/discharge times on the encounter if they are
there. If not, we fall back to the typical start/end date. -->
<low value='20130401150120'/>
<high value='20130401163120'/>
</effectiveTime>
<participant typeCode="LOC">
<!-- Facility Location template -->
<templateId root="2.16.840.1.113883.10.20.24.3.100"/>
<time>
<!-- Attribute: facility location arrival datetime -->
<low value='20130401150120'/>
<!-- Attribute: facility location departure datetime -->
<high value='20130401163120'/>
</time>
<participantRole classCode="SDLOC">
<code nullFlavor="UNK"/>
<telecom nullFlavor="UNK"/>
<playingEntity classCode="PLC">
<name></name>
</playingEntity>
</participantRole>
</participant>
</encounter>
</entry>
<entry>
<encounter classCode="ENC" moodCode="EVN">
<!-- Encounter activities template -->
<templateId root="2.16.840.1.113883.10.20.22.4.49"/>
<!-- Encounter performed template -->
<templateId root="2.16.840.1.113883.10.20.24.3.23"/>
<id root="1.3.6.1.4.1.115" extension="54272ceb637970595ba10000"/>
<code code="183452005" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.424"><originalText>Encounter, Performed: Non-Elective Inpatient Encounter</originalText></code>
<text>Encounter, Performed: Non-Elective Inpatient Encounter</text>
<statusCode code="completed"/>
<effectiveTime>
<!-- We try to look for the admit/discharge times on the encounter if they are
there. If not, we fall back to the typical start/end date. -->
<low value='20130401170120'/>
<high value='20130404180120'/>
</effectiveTime>
<sdtc:dischargeDispositionCode code="10161009"
codeSystem="2.16.840.1.113883.6.96"/>
</encounter>
</entry>
<entry>
<!-- Physical Exam Finding -->
<observation classCode="OBS" moodCode="EVN">
<!-- Result observation template -->
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
<!-- Physical Exam, Finding template -->
<templateId root="2.16.840.1.113883.10.20.24.3.57"/>
<id root="1.3.6.1.4.1.115" extension="54272ceb637970595ba20000"/>
<code code="405795006" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113762.1.4.1045.14"><originalText>Physical Exam: Time of Symptom Onset</originalText></code>
<text>Physical Exam: Time of Symptom Onset</text>
<statusCode code="completed"/>
<effectiveTime>
<low value='20130401140120'/>
<high value='20130401140120'/>
</effectiveTime>
<value xsi:type="CD" nullFlavor="UNK"/>
</observation>
</entry>
<entry>
<!-- Patient Characteristic Payer -->
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.24.3.55"/>
<id root="1.3.6.1.4.1.115" extension="54272ceb637970595ba50000"/>
<code code="48768-6" codeSystemName="LOINC" codeSystem="2.16.840.1.113883.6.1" displayName="Payment source"/>
<statusCode code="completed"/>
<value code="349" codeSystem="2.16.840.1.113883.3.221.5" xsi:type="CD" sdtc:valueSet="2.16.840.1.114222.4.11.3591"><originalText></originalText></value>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<!-- Problem observation template -->
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
<!-- Diagnosis active template -->
<templateId root="2.16.840.1.113883.10.20.24.3.11"/>
<id root="1.3.6.1.4.1.115" extension="54272ceb637970595b9b0000"/>
<code code="282291009" displayName="diagnosis" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
<text>Diagnosis, Active: Ischemic Stroke</text>
<statusCode code="completed"/>
<effectiveTime>
<!-- Attribute: admission datetime -->
<low value='20130401170120'/>
<!-- Attribute: discharge datetime -->
<high value='20130403180120'/>
</effectiveTime>
<priorityCode code="63161005"
codeSystem="2.16.840.1.113883.6.96"
sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.14"
/>
<value code="111297002" codeSystem="2.16.840.1.113883.6.96" xsi:type="CD" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.247"><originalText>Diagnosis, Active: Ischemic Stroke</originalText><translation code="433.01" codeSystem="2.16.840.1.113883.6.103"/>
<translation code="I63.00" codeSystem="2.16.840.1.113883.6.90"/>
</value>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<!-- Problem Status (consolidation) template -->
<templateId root="2.16.840.1.113883.10.20.22.4.6"/>
<!-- Problem Status, Active template -->
<templateId root="2.16.840.1.113883.10.20.24.3.94"/>
<id root="96b8a910-49bd-0132-cf19-4040b69a5a45"/>
<code code="33999-4"
codeSystem="2.16.840.1.113883.6.1"
codeSystemName="LOINC"
displayName="status"/>
<statusCode code="completed"/>
<value xsi:type="CD" code="55561003"
displayName="active"
codeSystem="2.16.840.1.113883.6.96"
codeSystemName="SNOMED CT"/>
</observation>
</entryRelationship>
</observation>
</entry>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>
3 ответа
Вспомогательные документы XSD отсутствуют там, где они использовались для преобразования.
Вам нужно загрузить документы XSD для десериализации.
Я проверил по нашей схеме CDA CaboLabs.com. В вашем CDA есть недопустимые атрибуты, удалите "valueSet" из элементов "code", это недопустимо.
Полный список ошибок:
ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:sdtc}dischargeDispositionCode': This element is not expected. Expected is one of ( {urn:hl7-org:v3}priorityCode, {urn:hl7-org:v3}subject, {urn:hl7-org:v3}specimen, {urn:hl7-org:v3}performer, {urn:hl7-org:v3}author, {urn:hl7-org:v3}informant, {urn:hl7-org:v3}participant, {urn:hl7-org:v3}entryRelationship, {urn:hl7-org:v3}reference, {urn:hl7-org:v3}precondition ).
ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}value', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}priorityCode', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}value', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
Файлы XSD, созданные вами из одного XML-файла, вряд ли будут достаточно хороши для работы с документами HL7 (если только вы не работаете с системой, которая когда-либо выпускает только очень узкое подмножество стандарта).
Кроме того, проблема с компакт-диском, которую вы испытываете, нелегко решить с помощью выбранного вами подхода. По сути, валидатор XSD пытается найти сложный тип, который называется "CD". Ваши сгенерированные XSD, вероятно, только что создали атрибут xsi: type, но не создали базовый complexType, добавить его в этот тип = "CD" можно так же легко. be type='PQR' (или любой другой производный тип, см. изображение).
Вам действительно нужно сгенерировать свой код из исходных схем HL7. Однако я не уверен, что xsd.exe подходит для работы, поскольку это большие сложные схемы. Liquid XML Data Binder, вероятно, будет делать то, что вы хотите, но это не бесплатно.