FHIR Chat · How to import packages into Plains server · hapi

Stream: hapi

Topic: How to import packages into Plains server


view this post on Zulip Eric Wündisch (Mar 08 2022 at 14:09):

Hi guys i'd Like to know how can i import this package into a hapi Plain Server Implementation ?
https://simplifier.net/packages/de.medizininformatikinitiative.kerndatensatz.person/2.0.0-alpha4

I have no clue. I really Like to have it softwarewhise as a pure Java package or model which extends the Patient resource. Ist there any transformationtool Out which i was not able to find in the Internet?
Thanks for any response to this. Regards eric.

view this post on Zulip Patrick Werner (Mar 08 2022 at 14:22):

Profiled Resources are still Resources, you don't need new Pojos for profiled Instances.

view this post on Zulip Eric Wündisch (Mar 08 2022 at 14:36):

And how can i use them in my Project i dont understand.
What do i Need? It is a Patient resource but it is extended dir Germany how can i use them? Do i have to (Re)implement it myself in my Project?

view this post on Zulip Eric Wündisch (Mar 08 2022 at 14:37):

But thanks for the Response @Patrick Werner

view this post on Zulip Patrick Werner (Mar 08 2022 at 15:34):

It depends on what you are trying to achieve. A Profile is a statement about conformance.

view this post on Zulip Patrick Werner (Mar 08 2022 at 15:36):

Assuming you want to create FHIR Instances of these Profiles in Java?
Then you could create Facading Classes, or just use the resource class. Either way you would need code to create these instances.

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:12):

Yes i think i Need to reimplement this myself.
The jpa Server in hapi has this ability to import packages via an Implementation Guide but this is Not available for the Plain Server thus there is No Tool in the Internet that simply Transforms such profiles into Java because it is needed in custom Implementations.
Anyway i think a facade class would Help alot

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:15):

For me to have it clear : i Need to so this right?
https://hapifhir.io/hapi-fhir/docs/model/custom_structures.html

Implement this myself Like the Definition told me in the desire package.

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:16):

The JPAStarter Server uses IGs to be able to validate against them. You can also do this with a plain server by adding a hapi validation stack. And then uses this validator in your /$validate operation provider

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:25):

This Part confuses me even more.

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:25):

My approach to implement it myself with the Help of this Link i posted ist correct ?

view this post on Zulip Oliver Egger (Mar 08 2022 at 16:26):

Eric Wündisch said:

For me to have it clear : i Need to so this right?
https://hapifhir.io/hapi-fhir/docs/model/custom_structures.html

No, I don't think so. You have to implement for the Plain Server a ResourceProvider which then needs to return the resources according to the ig you referenced. I'm also not aware of a tooling jet, that would generate a facade based on the constraints and extensions in an ig. See an example for a ResourceProvider in this PR: https://github.com/hapifhir/hapi-fhir/pull/2709

view this post on Zulip Craig McClendon (Mar 08 2022 at 16:29):

The HAPI Plain Server handles all the RESTful stuff for you, and you implement the persistence layer.
It will allow you handle ANY FHIR resources using ANY profiles - but you must implement how you store those resources and implement how you search for them - i.e. how you convert the requests into database records/commands.

If you are dealing with Resources that must conform to specific profiles, then is sounds like you want to add validation.
If you want to validate that a resource conforms to a specific profile before you persist it, there are various ways to do that.
The HAPI library can help you: see https://hapifhir.io/hapi-fhir/docs/validation/introduction.html

You don't need to generate any code to that.

view this post on Zulip Gino Canessa (Mar 08 2022 at 16:45):

Hi Eric, HAPI will load IGs and support them on the server (e.g., being able to reference it, etc.). That said, looking in the repo you link to, it looks like you are defining a logical model (here).

I am not sure what HAPI will do with a StructureDefinition of that type. Typically, additional data is added via extensions on top of core-defined resources. As an example, the US Core implementation guide profiles the Patient resource as a US Core Patient. The profile includes extra information such as a patient's physical gender at birth in extensions like us-core-birthsex.

Using extensions then works as others described (e.g., accessing the proper extensions). I am working on a project that will hopefully allow cleaner access on top of SDKs for implementation guides (e.g., being able to access Person.Name.Vorname in your application code, but have the SDK understand that really is accessing the element at Person.name.given, assuming my mapping is correct). That said, there is still a fair bit of work for me to do on basic extension access before I get to something like this that requires a mapping construct.

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:45):

Ahh ok. Thanks for These anwers. I will try to read the documentation about this.
Unfor. A generating facade Tool would be awesome but not findable.

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:50):

There is no real benefit in this tool. You just want to have a server with your own storage backend?

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:51):

@Gino Canessa thank you vor this clean answer.
I think Something between all answers Here is my solution.
A questuon about structuredefinitions. That means i have to Transform this package i linked above into this structure myself to use IT in all my requests. Remember i want to use the Plain Server to handle persisting (Database) myself.
The good Part about my Project the Patient resource is the only we Need to Provider.

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:51):

You just create the ResourceProviders you need. A profiled Patient is still a patient.

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:52):

So no extra work needed. If you need validation in your server, then you would use the hapi validation classes, build a validation chain, and validate incoming data with an interceptor, or in your provider classes

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:52):

@Patrick Werner thats true but i Need to make Sure the object i Receive follows the Implementation i linked.

view this post on Zulip Gino Canessa (Mar 08 2022 at 16:53):

Patrick, the package is defining a new logical model, not a profile.

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:53):

ah easy. Just validate alle incoming Patients with a Validation Chain, this way all your patients are valid MII Patients.

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:54):

Gino Canessa said:

Patrick, the package is defining a new logical model, not a profile.

This one? https://simplifier.net/packages/de.medizininformatikinitiative.kerndatensatz.person/2.0.0-alpha4
This is a module of the german MI-Initiative, including StrucDefs.
E.g. the mentioned patient profile: https://simplifier.net/packages/de.medizininformatikinitiative.kerndatensatz.person/2.0.0-alpha4/files/504753

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:54):

Can i validate in a Plan Server against Rules or definitions in json Files? That would makes my life so easy....

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:55):

Sure, just start reading here: https://hapifhir.io/hapi-fhir/docs/validation/instance_validator.html

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:55):

@Gino Canessa so whats the easiest solution i can Run this now ?

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:56):

In you provider you will have a Patient variable, then just call: validator.validateWithResult(patient);

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:56):

@Patrick Werner thanks for the Link i will do so :)

view this post on Zulip Patrick Werner (Mar 08 2022 at 16:56):

Eric Wündisch said:

Gino Canessa so whats the easiest solution i can Run this now ?

Build your plain Server, create a Patient Provider, add a Validation Chain, call validation on every incoming REST operation

view this post on Zulip Jens Villadsen (Mar 08 2022 at 16:57):

And there is a simple example here of using the validation chain here if you are not using JPA https://github.com/medcomdk/FHIR-CareCommunication-demo-Java/blob/main/common/src/main/java/com/trifork/common/Validator.java

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:58):

@Jens Villadsen cool thanks i love examples.

view this post on Zulip Eric Wündisch (Mar 08 2022 at 16:59):

Imho i think you Guys give ne a Lot of information i can Work with. Thanks to you all :)

view this post on Zulip Patrick Werner (Mar 08 2022 at 17:00):

Jens Villadsen said:

And there is a simple example here of using the validation chain here if you are not using JPA https://github.com/medcomdk/FHIR-CareCommunication-demo-Java/blob/main/common/src/main/java/com/trifork/common/Validator.java

great example :+1:

view this post on Zulip Gino Canessa (Mar 08 2022 at 17:01):

Patrick and Eric, I was looking at sd-mii-person-logicalmodel.xml. Unfortunate luck of which directory I clicked into first, so apologies on that front.

view this post on Zulip Eric Wündisch (Mar 08 2022 at 17:11):

Sry my english is Not so good. What do you mean ?


Last updated: Apr 12 2022 at 19:14 UTC