Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FHIR Subscription not working in hapi-fhir

I'm using this hapi-fhir v4.2.0 server with jpa and it's working just fine. I have added a few patients and I'm able to GET/POST requests to my hapi-fhir localhost environment.

I'm also able to create a subscription using this URL: http://localhost:8080/hapi-fhir-jpaserver/fhir/Subscription with this body:

{
  "resourceType": "Subscription",
  "criteria": "Patient",
  "reason": "Give me the patient",
  "end": "2021-01-01T00:00:00Z",
  "status": "requested",
  "channel": {
    "type": "rest-hook",
    "endpoint": "http://localhost:1337",
    "payload": "application/json"
  }
}

Whenever I made a POST or PUT to a Patient, the subscription should be triggered and send a POST request to http://localhost:1337 but nothing happens.

What I have tried:

  1. Changing requested to active
  2. Changing criteria from Patient to Patient?name=John
  3. Removing payload argument
  4. Reading the documentation
  5. Changing to application/fhir+json

And still not working :( what I'm missing here guys?

Edit: My backend is a simple nodejs running with morgan, so it will log every POST/GET/PUT attempt in the console.

like image 473
ncesar Avatar asked May 05 '20 16:05

ncesar


People also ask

What does Hapi stand for FHIR?

This is the homepage for the HAPI-FHIR library. We are developing an open-source implementation of the FHIR specification in Java. FHIR (Fast Healthcare Interoperability Resources) is a specification for exchanging healthcare data in a modern and developer friendly way.

Is FHIR API an open source?

IBM FHIR Server overviewIBM FHIR Server is an open source technology written in Java licensed under Apache 2.0. It can be used to process, validate and store healthcare data according to HL7 FHIR specifications.

What is the difference between Hapi and FHIR?

Every resource type defined by FHIR has a corresponding class, which contains a number of getters and setters for the basic properties of that resource. HAPI tries to make populating objects easier, by providing lots of convenience methods.

What is the HAPI FHIR library?

The HAPI FHIR library is an implementation of the HL7 FHIR specification for Java. Explaining what FHIR is would be beyond the scope of this documentation, so if you have not previously worked with FHIR, the specification is a good place to start.

What is the role of the FHIR server in the subscription model?

When using the Subscription resource, the FHIR server combines the roles of publisher and information distributer. Other arrangements of the publish and subscribe pattern describe separate agents for the two roles.

What is the use of Hapi in Hadoop?

HAPI tries to make populating objects easier, by providing lots of convenience methods. For example, the Observation resource has an "issued" property which is of the FHIR "instant" type (a system time with either seconds or milliseconds precision).


Video Answer


1 Answers

I also experienced the same thing. But, I managed to solve it.

We need to turn on the subscription rest webhook at hapi.properties file.

...
##################################################
# Subscriptions
##################################################

# Enable REST Hook Subscription Channel
subscription.resthook.enabled=true
...

If you are now using the latest version, v5.3.0, it is in application.yaml.

...
    subscription:
      resthook_enabled: true
...
like image 102
noelvictorino Avatar answered Oct 07 '22 03:10

noelvictorino