FHIR Chat · Constraining a HAPI-FHIR Server · hapi

Stream: hapi

Topic: Constraining a HAPI-FHIR Server


view this post on Zulip Cameron Bell (Mar 28 2018 at 17:35):

I’m trying to create a Restful server using HAPI-FHIR.

I have profiled the Medication resource and I’ve created the instances that I want served from the server. I’m running a HAPI-FHIR Restful server with no customization, and can write those resource instances to it. I also know what I want my capability statement to look like.

I’m trying to understand how to constrain that FHIR server to support only my profiled resources and the operations defined in my capability statement.

For instance, I only want to be able to upload Medication resources that conform to my profiled Medication resource. And I want to restrict which operations can be run against those Medication resources. I can’t find any examples of how to continue using the default persistence functionality of the JPA server, but simply constrain which of those operations can be used.

I've tried making a resource provider and I recognize I can constrain the operations available for it through annotations, but then I couldn't find any examples where the ResourceProvider functions were actually implemented to use the persistence mechanism that the an un-customized server uses. I also tried subclassing JpaResourceProviderDstu3, but then my CapabilityStatement logically reflects that all of the standard operations are supported.

Thanks in advance for any direction you can provide me!

view this post on Zulip Christopher Schuler (Mar 28 2018 at 18:03):

Create a Medication resource provider and override the Create and Update operations found in the JpaResourceProvider parent class.

view this post on Zulip Cameron Bell (Mar 28 2018 at 19:58):

Thanks! I'm able to override those operations, but for instance, the JpaResourceProvider parent class implements the delete operation. From my subclass, is there a way I can prevent that delete operation from being available? I can override the delete function and do nothing, but the generated conformance statement still shows the delete operation. Is there a way to annotate that an operation should be removed?

view this post on Zulip Christopher Schuler (Mar 29 2018 at 01:33):

No problem. Here is a reference that should help with that. For your use, you would extend the JpaConformanceProviderDstu3.

view this post on Zulip Kevin Mayfield (Apr 02 2018 at 20:01):

Are you doing RESTful server or the JPA one? We used restful and created our own providers, the default conformance provider then only showed the operations we had implemented.

view this post on Zulip Joel Francis (Apr 03 2018 at 15:42):

Are you doing RESTful server or the JPA one? We used restful and created our own providers, the default conformance provider then only showed the operations we had implemented.

@Cameron Bell if you validate instances that adhere to your profiles and then persist, you are indeed only serving your profiled instances.


Last updated: Apr 12 2022 at 19:14 UTC