Uploaded image for project: 'FHIR Module v2'
  1. FHIR Module v2
  2. FM2-300

Add hapi-fhir-client to FHIR2 module and FhirContext



    • Enhancement
    • Status: Closed
    • Should
    • Resolution: Fixed
    • FM2 1.0.0
    • FM2 1.0.0
    • None
    • None
    • Low


      Currently, the FHIR2 module has compatibility issues with other modules that utilize the HAPI libraries. Even modules that depend on just the HAPI client require excluding the hapi-fhir-base libraries that are bundled by default.

      In addition, the FhirContext object is expensive to make, and re-using the FHIR module's FhirContext - for example with ctx = applicationContext.getBean(FhirContext.class); ctx = applicationContext.getBean(FhirContext.class); - is useful when FHIR funtionality is required in other modules. However, since the FHIR module does not currently include the HAPI client, the FhirContext cannot be used for this functionality out of the box.

      Suggestion from
      ibacher :
      "I would actually rather just move all that logic into the FHIR module so that if you obtain one of the FHIR contexts created by the FHIR module, you get the client just by doing ctx.newRestfulGenericClient(). I also think we can simplify things somewhat by moving the configuration of the client factory into the Spring configuration. E.g., adding something like this to the FHIR module configuration:
      <bean name="restfulClientFactoryR3" class="ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory">
      <property name="fhirContext" ref="fhirR3"/>
      <bean name="restfulClientFactoryR4" class="ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory">
      <property name="fhirContext" ref="fhirR4"/>
      <bean name="fhirR3" class="ca.uhn.fhir.context.FhirContext" factory-method="forDstu3">
      <property name="restfulClientFactory" ref="restfulClientFactoryR3"/>
      <bean name="fhirR4" class="ca.uhn.fhir.context.FhirContext" factory-method="forR4">
      <property name="restfulClientFactory" ref="restfulClientFactoryR4"/>
      We might even be able to not specify the restfulClientFactoryRX objects and just use HAPIs loading mechanism."

      Gliffy Diagrams




              pmanko Piotr Mankowski
              pmanko Piotr Mankowski
              0 Vote for this issue
              2 Start watching this issue