FHIR Chat · HAPI Server · implementers

Stream: implementers

Topic: HAPI Server


view this post on Zulip David Hay (Apr 13 2016 at 18:00):

Missing most of the structuredefinitions - http://fhirtest.uhn.ca/baseDstu2/StructureDefinition has only 6 resources...

view this post on Zulip James Agnew (Apr 13 2016 at 18:08):

Ahh right, I wiped the DB about a week ago and forgot to re-seed the definitions. Will do that now.

view this post on Zulip Vadim Peretokin (Apr 14 2016 at 01:03):

What's the status of Bundle collections support in HAPI - planned or unplanned feature?

view this post on Zulip Josh Mandel (Apr 14 2016 at 01:17):

What is "Bundle collections"?

view this post on Zulip Vadim Peretokin (Apr 14 2016 at 01:17):

A Bundle of type collection. Sorry, poor phasing

view this post on Zulip Josh Mandel (Apr 14 2016 at 01:20):

What would supporting it entail? HAPI will allow you to populate the "type" with any valid value... but presumably you mean something more. (As far as to can tell though there are no standard semantics.)

view this post on Zulip Vadim Peretokin (Apr 14 2016 at 01:20):

Hmm: Unable to store a Bundle resource on this server with a Bundle.type value other than 'document' - Value was: collection

view this post on Zulip Josh Mandel (Apr 14 2016 at 01:21):

Ah, for writing a bundle *to* the server? What API call did you make for this?

view this post on Zulip Vadim Peretokin (Apr 14 2016 at 01:23):

POST to http://fhirtest.uhn.ca/baseDstu3/Bundle with the body as https://ada-young.appspot.com/pastebin/abe7493a (the fullUrls aren't updated, but that doesn't seem to matter)

view this post on Zulip Josh Mandel (Apr 14 2016 at 01:24):

Gotcha, thanks for explaining this! (Of course, I can't actually answer your question...)

view this post on Zulip Vadim Peretokin (Apr 14 2016 at 01:25):

No drama! Thanks anyway. The more you learn™

view this post on Zulip Grahame Grieve (Apr 14 2016 at 02:25):

yes that should work

view this post on Zulip James Agnew (Apr 18 2016 at 19:38):

Hmm, yes, that should work. Let me have a look.

view this post on Zulip James Agnew (Apr 18 2016 at 19:56):

Ok, getting it to accept collection is easy. Just made that change and will deploy later today.

Is there any expectation that the server would process the bundle in any way? The example you provided (Vadim) earlier would just be stored verbatim, with the fullUrl references pointed to Grahame's server still. I'm not clear if that's the right or the wrong behaviour though....

view this post on Zulip Ewout Kramer (Apr 18 2016 at 21:22):

From http://hl7.org/fhir/documents.html#bundle:

view this post on Zulip Ewout Kramer (Apr 18 2016 at 21:22):

"This works like a normal end-point for managing a type of resource, but it works with whole document bundles - i.e. a read operation returns a bundle, an update gets a bundle and a search returns a bundle of bundles"

view this post on Zulip James Agnew (Apr 18 2016 at 21:34):

Yeah, I feel like that implies that the server doesn't do anything but blindly store the bundle as is... Which makes sense to me. Does anyone feel differently?

view this post on Zulip Vadim Peretokin (Apr 18 2016 at 22:26):

Yeah sounds about right actually. I was thinking it would do something else but I've re-read the relevant parts.

view this post on Zulip Michel Rutten (Apr 19 2016 at 12:03):

The current HAPI server for DSTU2 (http://fhirtest.uhn.ca/baseDstu2) seems to return an invalid Conformance statement. Specifically, the list of supported resources contains metainformation describing a "Documentation" resource. However this is not a valid resource type. As a consequence, the current FHIR .NET API library fails to parse the conformance resource and therefore Forge cannot access the HAPI server... Could this be corrected?

view this post on Zulip James Agnew (Apr 20 2016 at 01:55):

Hmm, that's a good point actually. Will correct in the morning.

view this post on Zulip Vadim Peretokin (Apr 27 2016 at 23:59):

Does HAPI try to download resources referenced via absolute URLs?

view this post on Zulip James Agnew (May 03 2016 at 22:09):

It does not.... The validator can be configured to fetch remote profiles, but that's the only place where a remote reference would be fetched automatically right now.

view this post on Zulip Abdul Aziz (Oct 26 2017 at 14:24):

After starting server, is there anything that we get back in response that server has started.

view this post on Zulip Abdul Aziz (Oct 26 2017 at 14:26):

with the help of command line

view this post on Zulip Karthik (Oct 31 2017 at 12:44):

I am new to FHIR and its implementation. I have been playing around with HAPI FHIR (Java Implementation) and used hapi-server-example project to use it with MySQL database. I found a script online which created a testing database and I was able to successfully create patient, resource, organization etc and getting back the data from database.

I have an existing database with real patient data. It does not follow the schema of the testing database. I am unable to find any tutorial or information on how to connect FHIR with my existing database with real patient database. Can someone here please guide on how to do that. I have spent more than a week searching for information related to this topic and it has been in vain.

view this post on Zulip Vadim Peretokin (Oct 31 2017 at 13:12):

The data in your patient database is in a different format than what FHIR stores it as - you'll need to figure out how to convert it. Start by learning how FHIR represents its patients: http://hl7.org/fhir/patient.html

view this post on Zulip Vadim Peretokin (Oct 31 2017 at 13:12):

Once you figure out how to map the fields from your database to FHIR, you'll then need some technological solution to do the conversion and import it into HAPI.

view this post on Zulip Kevin Mayfield (Oct 31 2017 at 13:14):

How familiar are you with java?

view this post on Zulip Karthik (Oct 31 2017 at 13:20):

How familiar are you with java?

I am comfortable doing programming with core java. I have done some of advanced java coding but haven't used it extensively. I am trying to read HAPI FHIR code on Github. I am trying to understand on how to create beans and create a custom JPA server which will talk to my database but I have not been successful yet. That's why I asked for help here.

view this post on Zulip Kevin Mayfield (Oct 31 2017 at 13:28):

This is an implementation of HAPI Restful server using Hibernate: https://github.com/nhsconnect/careconnect-reference-implementation. You can ignore most of the modules, ccri-fhirserver is probably the best place to start as the config classes should be familiar.

view this post on Zulip Kevin Mayfield (Oct 31 2017 at 13:29):

We've created our entities/tables but you should be able to map hibernate to an existing strucutre.

view this post on Zulip Karthik (Oct 31 2017 at 13:33):

The data in your patient database is in a different format than what FHIR stores it as - you'll need to figure out how to convert it. Start by learning how FHIR represents its patients: http://hl7.org/fhir/patient.html

Thank you for your reply. I was thinking the same thing. Please correct if I am wrong, HAPI FHIR has to have same database structure which is given in the UML diagrams of FHIR documentation for it to work?

view this post on Zulip Ben Spencer (Oct 31 2017 at 14:37):

You can use HAPI's rest server capabilities without also using its JPA backend

view this post on Zulip Ben Spencer (Oct 31 2017 at 14:37):

http://hapifhir.io/doc_rest_server.html

view this post on Zulip Ben Spencer (Oct 31 2017 at 14:37):

You can plug that into whatever backend you need.

view this post on Zulip Kevin Mayfield (Oct 31 2017 at 16:37):

The data structures we used do look like the FHIR model in places but they are mostly based on EPR+PAS systems I've worked on. It's the transform classes that do most of the hard work.

view this post on Zulip Kevin Mayfield (Oct 31 2017 at 16:38):

Here is another example of the restful hapi server (so same as the link Ben posted) https://github.com/nhs-digital/gpconnect

view this post on Zulip Joel Francis (Nov 07 2017 at 13:33):

Hi,

I have been following the tutorial http://docs.smarthealthit.org/tutorials/server-quick-start/

I have built a restful server using the hapi library that serves data to the growth chart smart client.

I am currently trying to launch the app in debug (unauthenticated) mode.

However, upon launch there is no error throw but the app logo is continuously showing "loading" with no further response or anything happening on the screen. Can anyone shed any light and possible resolution for the issue? I suspect it is CORS and i have enabled CORS as per the hapi suggestions here: http://hapifhir.io/doc_cors.html

Any advice is appreciated.

view this post on Zulip Christiaan Knaap (Nov 07 2017 at 13:52):

You may consider the Hapi stream for this.

view this post on Zulip Lloyd McKenzie (Nov 07 2017 at 14:15):

The hapi stream can be found here: https://chat.fhir.org/#narrow/stream/hapi

view this post on Zulip Joel Francis (Nov 07 2017 at 15:08):

The hapi stream can be found here:

https://chat.fhir.org/#narrow/stream/hapi

Thanks @Lloyd McKenzie

view this post on Zulip Marcelo caldas (Sep 13 2018 at 19:45):

Hello,
I too am trying to use the HAPI-FHIR-JPAServer-Example with my own database - in this case a MySQL RDS on Amazon.
I did change the code on FhirServerConfig.jar to use mySQL. But for whatever reason, the tables do not get created.
All I could think of was to change the hbm2ddl.auto=create-drop, but that did not do the trick for me...
When I try to start the server, I get a lot of exceptions with a bunch complaining of Tables not found.

any ideas what am I missing? I feel so close!!!

thanks,
Marcelo.

view this post on Zulip Lloyd McKenzie (Sep 13 2018 at 19:46):

@James Agnew ?

view this post on Zulip Marcelo caldas (Sep 14 2018 at 15:47):

@James Agnew ?

I found the issue! - Wrong Hibernate dialect - was using MysqlDialect instead of Mysql5Dialect ! doh!

thanks though!

FYI, it will be nice to extract some of those attributes into a properties file so we don't have to change code!

view this post on Zulip Alex Goel (Mar 10 2020 at 08:24):

Marcelo caldas said:

Hello,
I too am trying to use the HAPI-FHIR-JPAServer-Example with my own database - in this case a MySQL RDS on Amazon.
I did change the code on FhirServerConfig.jar to use mySQL. But for whatever reason, the tables do not get created.
All I could think of was to change the hbm2ddl.auto=create-drop, but that did not do the trick for me...
When I try to start the server, I get a lot of exceptions with a bunch complaining of Tables not found.

any ideas what am I missing? I feel so close!!!

thanks,
Marcelo.

Hi Has anyone solved this issue? We seem to having a similar one. using https://github.com/hapifhir/hapi-fhir-jpaserver-starter and trying to set it up in Docker. We followed the MySQL Config: https://github.com/hapifhir/hapi-fhir-jpaserver-starter#mysql-configuration
We updated the hapi.properties with the appropriate files. Had our hapi-fhir-mysql start, but no tables are being created in the MySQL db. We can read and write to the server. @Uong Yutthy @sovann TONG

Data still seems to be writing to the Derby DB, but the MySQL Server is running

Do only DSTU3 resources work in MySQL?

view this post on Zulip Alex Goel (Mar 10 2020 at 23:18):

@James Agnew Are you able to help us out?

We used the properties from the guide:
datasource.driver=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://hapi-fhir-mysql:3306/hapi
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
datasource.username=admin
datasource.password=admin

We looked at this issue: https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/58

Do we need to change this dependency in the POM?
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>

view this post on Zulip Patrick Werner (Mar 11 2020 at 15:21):

you can leave that dependency, or delete it if you want to save some space. The mysql JDBC connector is already included as a dependency

view this post on Zulip hemant joshi (Mar 17 2020 at 10:48):

Hi ALL,
i am working on building a Data Repository using HAPI FHIR, have designed a different database schema in PostgreSQL and been trying to use this schema instead of HAPI FHIR default schema, but i am not certain how do i configure Hapi fhir to use my schema instead of its own, any suggestions?

view this post on Zulip Patrick Werner (Mar 17 2020 at 10:49):

you have to adapt all the code in the Dao and Provider Objects. A lot of work. Why didn't you go with the DB schema of hapi?

view this post on Zulip hemant joshi (Mar 17 2020 at 11:08):

Hi Patrick,
thank you for your response. we have a specific use case that we planned to implement on top of CDR server and the database is designed specifically for that use case purpose. other than adapting full dao and provider objects is there any different approach that can be taken?

view this post on Zulip Patrick Werner (Mar 17 2020 at 11:53):

hapi supports the creation of the providers: https://hapifhir.io/hapi-fhir/docs/server_plain/server_types.html through the IResourceProvider Interface

view this post on Zulip Lloyd McKenzie (Mar 17 2020 at 13:53):

In the future, detailed HAPI questions are best addressed on #hapi

view this post on Zulip Chidamber Kumar (Apr 03 2020 at 09:21):

HI
I am trying to perform following request on HAPI FHIR server:
GET http://hapi.fhir.org/baseR4/Patient/1093961?_include=Patient:general-practitioner

But the result set only contains a patient resource with id : 1093961.
By definition of '_include' , it should include all the practitioners referenced under Patient.generalPractitioner.

Any thoughts ?

view this post on Zulip Chidamber Kumar (Apr 03 2020 at 09:43):

Sorry ! My bad
There was an error from my end.

view this post on Zulip Chidamber Kumar (Apr 03 2020 at 10:05):

Nope ! no luck.
Here is the new url that I am hitting :
http://hapi.fhir.org/baseR4/Patient/1093991?_include=Patient:general-practitioner

It's still returning just patient.

Any thoughts ?

view this post on Zulip Jose Costa Teixeira (Apr 03 2020 at 11:50):

if you do Patient/1093991?... you are getting a patient, not really a search, so I don't know if the server should support that.

view this post on Zulip Jose Costa Teixeira (Apr 03 2020 at 11:52):

http://hapi.fhir.org/baseR4/Patient?_id=1093991&_include=Patient:general-practitioner

may be better. This syntax seems to work with Grahame's server, though

view this post on Zulip Chidamber Kumar (Apr 03 2020 at 13:19):

yes @Jose Costa Teixeira that syntax is also working for HAPI. Thanks

view this post on Zulip Kishore Karanam (Apr 04 2020 at 10:54):

How do we cross join in Hapi server? like to know high risk patients ?

view this post on Zulip Kishore Karanam (Apr 04 2020 at 10:54):

Sample query from Fhirebase

SELECT DISTINCT(p.id), p.resource#>'{name,0}'
FROM patient p
JOIN observation o ON o.resource#>>'{subject,id}' = p.id
WHERE (o.resource @> '{"code": {"coding": [{"code": "72166-2"}]}}'::jsonb) -- LOINC: Smoking status
AND ((o.resource @> '{"value": {"CodeableConcept": { "coding": [{"code": "449868002"}]}}}') -- SNOMED: Current every day smoker
OR (o.resource @> '{"value": {"CodeableConcept": { "coding": [{"code": "8517006"}]}}}')) -- SNOMED: Former smoker
AND (extract(year from age(now(), (p.resource->>'birthDate')::date)) > 45) -- patient's age > 45
AND (p.resource->>'gender' = 'male'); -- patient gender is male

view this post on Zulip Lloyd McKenzie (Apr 04 2020 at 13:50):

It's not a HAPI question, it's a general FHIR REST situation. Look at _has

view this post on Zulip Kishore Karanam (Apr 04 2020 at 19:50):

I am new to HAPI. I have created a new patient by using Patient API. May I know which table this record will sit? I am using Postgresql with jpa server. I would see some records in hfj_resource table, but I couldn't see the actual record instead some encoded values. Can you please help / point me which table the actual Patient JSON stores?

view this post on Zulip Lloyd McKenzie (Apr 04 2020 at 20:08):

Might be best to ask on #hapi


Last updated: Apr 12 2022 at 19:14 UTC