FHIR Chat · sample code for creation of FHIR Document · hapi

Stream: hapi

Topic: sample code for creation of FHIR Document


view this post on Zulip John Moehrke (Dec 09 2020 at 14:59):

I need help using HAPI to create a FHIR Document. Is there a tutorial or section of documentation that gets to the HAPI specifics? I have a profile, and example. That was the easy part.

view this post on Zulip Jens Villadsen (Dec 09 2020 at 15:11):

Have a look at either https://hapifhir.io/hapi-fhir/docs/client/generic_client.html or https://hapifhir.io/hapi-fhir/docs/client/examples.html

view this post on Zulip John Moehrke (Dec 09 2020 at 15:12):

specifically I am looking for how to setup the bundle of type document for seralization to download on a web page...

view this post on Zulip Jens Villadsen (Dec 09 2020 at 15:16):

sorry - I somehow read it as you needed to build a document ...

view this post on Zulip John Moehrke (Dec 09 2020 at 15:18):

well, yes. a FHIR Document... which is a bundle of type document made up of a Composition and a bunch of other stuff.. I have the composition, I have the other stuff.. I just don't have a clear code fragment that creates in HAPI the Bundle

view this post on Zulip Jens Villadsen (Dec 09 2020 at 15:18):

the server side part ?

view this post on Zulip John Moehrke (Dec 09 2020 at 15:19):

client. No server will be involved. My client is assembling the FHIR Document, and seralizing it into a json blob for the user to download

view this post on Zulip John Moehrke (Dec 09 2020 at 15:20):

thus the FHIR Document bundle never is 'created' on a server. It is just 'created' in the app.....

view this post on Zulip Jens Villadsen (Dec 09 2020 at 15:26):

something like ...

 new Bundle().setType(Bundle.BundleType.DOCUMENT)
                                .addEntry(new Bundle.BundleEntryComponent().setResource(new Composition()))
                                .addEntry(new Bundle.BundleEntryComponent().setResource(new Patient())))

?

view this post on Zulip John Moehrke (Dec 09 2020 at 15:30):

I guess?

view this post on Zulip Jens Villadsen (Dec 09 2020 at 15:41):

well that snippet creates a bundle for you that is of type document with to empty placeholder resources in it


Last updated: Apr 12 2022 at 19:14 UTC