Question
· Sep 3, 2018

Why does a DT succeed in test while failed in run time

Hi, guys,

I've written a DT for a partner which transfers a csv file into SDA3. 

I', using record map to gather data from a folder storing csv files and using the DT to tranfer the records into sda3 entities.

The followings are the codes of that DT:

Class POC.DT.CSV2SDA3 Extends Ens.DataTransformDTL [ DependsOn = (User.PhysicalExam.Record, POC.SDA.Container) ]

{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]

{

<transform sourceClass='User.PhysicalExam.Record' targetClass='POC.SDA.Container' create='new' language='objectscript' >

<assign value='"AddOrUpdate"' property='target.Action' action='set' />

<assign value='"TRDY"' property='target.SendingFacility' action='set' />

<assign value='1' property='target.UpdateECRDemographics' action='set' />

<assign value='source.ExamNumber' property='target.Patient.PatientNumbers.(1).Number' action='set' />

<assign value='"TRDY"' property='target.Patient.PatientNumbers.(1).Organization.Code' action='set' />

<assign value='"同人大友"' property='target.Patient.PatientNumbers.(1).Organization.Description' action='set' />

<assign value='"MRN"' property='target.Patient.PatientNumbers.(1).NumberType' action='set' />

<assign value='source.CertNumber' property='target.Encounters.(1).EncounterNumber' action='set' />

<if condition='"男" = source.Gender' >

<true>

<assign value='"M"' property='target.Patient.Gender.Code' action='set' />

<assign value='"男"' property='target.Patient.Gender.Description' action='set' />

</true>

<false>

<assign value='"F"' property='target.Patient.Gender.Code' action='set' />

<assign value='"女"' property='target.Patient.Gender.Description' action='set' />

</false>

</if>

<assign value='source.DOB_" 00:00:00"' property='target.Patient.BirthTime' action='set' />

<assign value='source.Dept1' property='target.Patient.Organizations.(1).Organization.Description' action='set' />

<assign value='source.EmpNumber' property='target.Patient.Organizations.(1).Organization.EId' action='set' />

<assign value='source.BranchNumber' property='target.Patient.Organizations.(1).Organization.Extension' action='set' />

<assign value='source.ExamStTime_" 00:00:00"' property='target.Encounters.(1).FromTime' action='set' />

<assign value='source.CertNumber' property='target.Patient.MPIID' action='set' />

<assign value='source.MaritalStatus' property='target.Patient.MaritalStatus.Description' action='set' />

<assign value='source.MobileNumber' property='target.Patient.ContactInfo.MobilePhoneNumber' action='set' />

<assign value='source.ExamNumber' property='target.Patient.Name.PreferredName' action='set' />

<assign value='source.ExamNumber' property='target.Patient.Name.FamilyName' action='set' />

<assign value='source.ExamNumber' property='target.Patient.Name.GivenName' action='set' />

<assign value='source.CertNumber' property='target.PhysicalExams.(1).EncounterNumber' action='set' />

<assign value='source.ExamNumber_"Height"' property='target.PhysicalExams.(1).PhysExamCode.Code' action='set' />

<assign value='"身高"' property='target.PhysicalExams.(1).PhysExamCode.Description' action='set' />

<assign value='source.ExamStTime_" 00:00:00"' property='target.PhysicalExams.(1).PhysExamTime' action='set' />

<assign value='"身高"' property='target.PhysicalExams.(1).PhysExamObs' action='set' />

<assign value='"身高"' property='target.PhysicalExams.(1).PhysExamObs.Description' action='set' />

<assign value='source.Height' property='target.PhysicalExams.(1).PhysExamObsValue.Description' action='set' />

<assign value='"cm"' property='target.PhysicalExams.(1).PhysExamObsQualifier.Description' action='set' />

<assign value='source.CertNumber' property='target.PhysicalExams.(2).EncounterNumber' action='set' />

<assign value='source.ExamNumber_"Weight"' property='target.PhysicalExams.(2).PhysExamCode.Code' action='set' />

<assign value='"体重"' property='target.PhysicalExams.(2).PhysExamCode.Description' action='set' />

<assign value='source.ExamStTime_" 00:00:00"' property='target.PhysicalExams.(2).PhysExamTime' action='set' />

<assign value='"体重"' property='target.PhysicalExams.(2).PhysExamObs' action='set' />

<assign value='"体重"' property='target.PhysicalExams.(2).PhysExamObs.Description' action='set' />

<assign value='source.Weight' property='target.PhysicalExams.(2).PhysExamObsValue.Description' action='set' />

<assign value='"kg"' property='target.PhysicalExams.(2).PhysExamObsQualifier.Description' action='set' />

<assign value='source.CertNumber' property='target.LabOrders.(1).EncounterNumber' action='set' />

<assign value='source.CertNumber' property='target.LabOrders.(1).Result.EncounterNumber' action='set' />

<assign value='"尿常规"' property='target.LabOrders.(1).Result.ResultType' action='set' />

<assign value='source.CertNumber' property='target.LabOrders.(1).Result.ResultItems.(1).EncounterNumber' action='set' />

<assign value='"1"' property='target.LabOrders.(1).Result.ResultItems.(1).SubId' action='set' />

<assign value='"bingliguanxing"' property='target.LabOrders.(1).Result.ResultItems.(1).TestItemCode.Code' action='set' />

<assign value='"病理管型"' property='target.LabOrders.(1).Result.ResultItems.(1).TestItemCode.Description' action='set' />

<assign value='source.UBadguanxing' property='target.LabOrders.(1).Result.ResultItems.(1).ResultValue' action='set' />

<assign value='"个"' property='target.LabOrders.(1).Result.ResultItems.(1).ResultValueUnits' action='set' />

</transform>

}

}

POC.SDA.Container is a entity class inherited from HS.SDA3.Container, as below:

Class POC.SDA.Container Extends (%Persistent, %XML.Adaptor, HS.SDA3.Container)

{}

The I used test the DT in management portal, with the input:

<test>
<Record>
  <ExamNumber>1805030190021</ExamNumber>
  ...
  <UBadguanxing>0</UBadguanxing>
  ...
</Record>
</test>

The value of UBadguanxing will trigger the generation of labresult.

the result is as below:

<Container>
  <Patient>
    <MPIID>210304198510110216</MPIID>
    .....
  <LabOrders>
    <LabOrder>
      <PlacerId>TRDY</PlacerId>
      <Result>
        <ResultType>尿常规</ResultType>
        <ResultItems>
          <LabResultItem>
            <TestItemCode>
              <Code>bingliguanxing</Code>
              <Description>病理管型</Description>
            </TestItemCode>
            <ResultValue>0</ResultValue>
            <SubId>1</SubId>
            <ResultValueUnits>个</ResultValueUnits>
            <EncounterNumber>210304198510110216</EncounterNumber>
          </LabResultItem>
        </ResultItems>
        <EncounterNumber>210304198510110216</EncounterNumber>
      </Result>
      <Specimens>
        <Specimen>
          <EncounterNumber>210304198510110216</EncounterNumber>
          <SpecimenType>
            <Code>Urine</Code>
            <Description>尿</Description>
          </SpecimenType>
        </Specimen>
      </Specimens>
      <EncounterNumber>210304198510110216</EncounterNumber>
    </LabOrder>
  </LabOrders>
  <Action>AddOrUpdate</Action>
  <UpdateECRDemographics>true</UpdateECRDemographics>
  <SendingFacility>TRDY</SendingFacility>
</Container>

Please notice that the node LabOrder has content.

Then I used the production which reads a csv file into the record map and calling the dt , the same data was loaded into record map, but the output SDA file looks as below:

......

<LabOrders>
<LabOrder xsi:nil="true"></LabOrder>
</LabOrders>

......

LabOrder is Empty.

Any idea will be helpful. Thank you guys. 

Discussion (1)2
Log in or sign up to continue