DSTU2 on HAPI FHIR

137 views
Skip to first unread message

yc

unread,
Aug 4, 2022, 3:48:40 PM8/4/22
to HAPI FHIR
Hello,

I am working with DSTU2 and had some questions regarding its implementation in HAPI FHIR (specifically for Java).

  1. There seems to be a few different "versions" of DSTU2 in HAPI FHIR. I was wondering what the difference between them was. The two I am asking about specifically are:
  2. For org.hl7.fhir.dstu2, I am having trouble using the search feature. While with other versions (DSTU3, R4) you can simply search with something along the lines of:
    "client.search().forResource(DocumentReference.class).where(DocumentReference.hasId(someId)).returnBundle(Bundle.class).execute();"
    the same cannot be done with org.hl7.fhir.dstu2. Search using  ca.uhn.fhir.model.dstu2, on the other hand, works like the other versions (DSTU3, R4).
  3. The reason I would like to use org.hl7.fhir.dstu2 to begin with it because of the VersionConvertor HAPI FHIR has for org.hl7.fhir Objects. If the same exists for converting from  ca.uhn.fhir.model.dstu2 to org.hl7.fhir.dstu3, I would really appreciate hearing about how to do so.
I apologize for the lengthy question, and hope it is not too troublesome to answer.
Thank you for all the amazing work that you are doing! Keep it up!

yc

unread,
Aug 8, 2022, 10:28:50 AM8/8/22
to HAPI FHIR
Solved.
Search is possible by using both of these packages. For example:
"client.search().forResource(org.hl7.fhir.dstu2.model.DocumentReference.class).where(ca.uhn.fhir.model.dstu2.resource.DocumentReference.hasId(someId)).returnBundle(org.hl7.fhir.dstu2.model.Bundle.class).execute();"

James Agnew

unread,
Aug 8, 2022, 11:26:21 AM8/8/22
to yc, HAPI FHIR
Glad to hear it.

Just for context, both DSTU2 packages should be generally usable. The reason there are two is historical, there used to be two distinct Java FHIR libraries and we decided to combine efforts and merge the libraries. This happened at a time when DSTU2 was the latest-and-greatest, and we didn't want to break anyone's existing code so we accepted that there would be 2 ways of doing things for that version.

There are a couple of functional differences, but things should generally be at parity. As you point out, the converters only work with the org.hl7 structures. The JPA server can only use the ca.uhn structures. Technically the validator only supports the org.hl7 structures, although it has a wrapper layer that makes this invisible to end users.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/1c2109be-40d6-477d-84b1-d958a286f3cbn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages