Adding text to ED datatype in Java using CONNECTCommonTypesLib?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding text to ED datatype in Java using CONNECTCommonTypesLib?

HenrikBaerbak
As part of the Danish standard for QFD, I am developing a Java based component to make it easier to build questionaires. I use CONNECTCommonTypesLib v 4.1.1 downloaded using maven, but I am rather new to using the XSD generated POCD_MT000040 data types.

My issue is to assign a text to an <originalText> tag. Concretely I need to generate



I can generate everything except the actual question in the originalText tag using Java code like:

    POCDMT000040Observation observation = of.createPOCDMT000040Observation();
    observation.getClassCode().add("OBS");
    observation.setMoodCode(XActMoodDocumentObservation.DEF);
    component.setObservation(observation);

    // template id of observation
    II ii3 = of.createII();
    ii3.setRoot(HL7.QFD_TEXT_QUESTION_PATTERN_OID);
    observation.getTemplateId().add(ii3);

    String theQuestionsText = qfdsection.getText();
    CD theCode = of.createCD();
    theCode.setCode("q1");
    theCode.setCodeSystem("Some-Question-OID");
    theCode.setCodeSystemName("Some-CodeSystem-Name");
    theCode.setDisplayName("Some-Display-Name");

    observation.setCode(theCode);
   
    ED theQuestion = of.createED();
    // How to set the text contents in an ED???
    theCode.setOriginalText(theQuestion);

So: How do I add text to the ED so it appears in the output XML?

Thanks!

Henrik Bærbak Christensen, Assoc. Professor, Aarhus University, Denmark.

             
Reply | Threaded
Open this post in threaded view
|

Re: Adding text to ED datatype in Java using CONNECTCommonTypesLib?

Naresh Subramanyan
The generated HL7 ED data type JAXB class used in the OriginalText element doesn't support the XML mixed mode value. You have to change the type to ED_explicit in the schema and have to generate the CONNECT common Type library again. Below are the steps:

1. Get the source from https://github.com/CONNECT-Solution/common-types (using git)
2. Change the schema POCD_MT000040.Observation.code to CD_explicit from  CD (src\main\resources\schemas\HL7V3\NE2008\multicacheschemas\POCD_MT000040.xsd)
3. Generate the CONNECT common Type library (using maven) and use the generated library
4. Use the EDExplicit class to set the value
EDExplicit theQuestion = obj.createEDExplicit();
theQuestion.getContent().add(<Your text goes here>);


Let us know how it goes.

Thanks,
Naresh
CONNECT Product Team
Reply | Threaded
Open this post in threaded view
|

Re: Adding text to ED datatype in Java using CONNECTCommonTypesLib?

HenrikBaerbak
Thank you for your fast reply!

However it appears to me like a 'hack' :-) ?

What we want to do is to make an open source maven module for the Danish QFD available through our own maven repository, which just uses maven's dependency resolution mechanism to get the CONNECTCommonTypesLib. Your suggestion implies that I would have to embed a variant of the library within the module itself.

Your reply also points more in the direction that there is a design flaw in the library that ideally should be fixed? CDA documents need to set that value but the library does not allow it? Or am I missing some important point here? (I admit being very new to the library!)

- Henrik -
Reply | Threaded
Open this post in threaded view
|

Re: Adding text to ED datatype in Java using CONNECTCommonTypesLib?

Naresh Subramanyan
CONNECT common type library is part of the CONNECT product suite and it caters the needs of the CONENCT product requirements. The main reason we put it in the maven repository is make our build easier and address the requirements that we support.  As I said earlier its specifically designed for CONNECT and may not address some of your requirements.

But you can always fork the source from GitHub and extend it to your needs. Also you can generate your own extended library, post it to the maven repo and reference it from there. Hope this helps!!!

Cheers,
Naresh
Reply | Threaded
Open this post in threaded view
|

Re: Adding text to ED datatype in Java using CONNECTCommonTypesLib?

HenrikBaerbak
Once again thanks for the fast reply and thank you for the clarification. I have as you point out mistakenly understood the module as more general purpose. I am extending code that I have "inherited" :)

All the best

- Henrik -