Stream: implementers
Topic: HAPI
Vadim Peretokin (Apr 12 2016 at 09:56):
HAPI told me Resource contains reference to Organization/1 but resource with ID 1 is actually of type Patient
, but resource identity says "The logical identity is unique within the space of all resources of the same type on the same server.". Shouldn't HAPI allow this case?
Lloyd McKenzie (Apr 12 2016 at 15:20):
@James Agnew ?
James Agnew (Apr 12 2016 at 17:14):
Another way of looking at this is that there is no resource on the server called Organization/1
, so your reference is invalid. The server recognizes that there is a resource with ID 1 but of another type, so it is trying to be helpful with that error message.
James Agnew (Apr 12 2016 at 17:15):
HAPI's own rule is that clients may not assign purely numeric IDs, the server reserves those for its own assignment. That part isn't a FHIR rule, but it's an implementation detail on our server and I don't think it contradicts what is allowable by FHIR.
Lloyd McKenzie (Apr 12 2016 at 18:43):
What would the server's error message be if there were multiple resource types with id "1" (but no Organization)?
Vadim Peretokin (Apr 12 2016 at 18:45):
I didn't realise it was saying there's no resource reference with Organization/1 - I thought it was saying the id's are global
James Agnew (Apr 12 2016 at 18:47):
I guess that error message could be clarified.. In actual fact they are global for numeric IDs (HAPI's server wouldn't allow you to have both a Patient/1
and an Observation/1
) but given that the server reserves the right to assign numeric IDs itself, that is just an implementation detail. You get whatever ID the server gives you, and it happens that it won't give you an ID that clashes with another resource type
Vadim Peretokin (Apr 12 2016 at 18:49):
In that case the current error message is quite fine then. Thanks for explaining!
Josh Mandel (Apr 12 2016 at 20:00):
But @James Agnew I see this same error even for non-numerical IDs. E.g. when I
PUT /Condition/smart-1081332
I see
Existing resource ID[Patient/smart-1081332] is of type[Patient] - Cannot update with [Condition]
Is that expected too?
James Agnew (Apr 13 2016 at 18:35):
Ahhh right @Josh Mandel, I have a fix for that but it isn't landed yet because it caused a regression.
That will work soon. It needs to because I can't upload all of the samples without it. :)
Inês Silva (Jul 11 2018 at 10:17):
Hello :)
I've made some questions at the hapi stream, but I'm wondering if someone here can help me...
This one is about local references in the hapi-fhir-jpa-server
https://chat.fhir.org/#narrow/stream/8-hapi/subject/Local.20References/near/163916
And this one is about search by references in a restfull server
https://chat.fhir.org/#narrow/stream/8-hapi/subject/Search.20by.20reference/near/163945
Thanks!
dsh (Nov 22 2019 at 01:02):
On a slightly different note. I am n00b to HAPI world (with basic knowledge in Java) and I understand HAPI is useful for exposing your existing data as FHIR Resources but is it also a good candidate for our use case (basically a green field project) where clinical data received in HL7v2 transformed to FHIR (using Mirth FHIRConnector) and then transformed/stored in our business specific models. We are thinking of storing a copy of the original FHIR resource in HAPI server for a possible future analysis.
If this is a good idea. Could some one please let me know if hapi-fhir-jpaserver-example
can be used for production use without any modification? Thanks
haiming li (Nov 22 2019 at 04:37):
At http://hapi.fhir.org/ , there are multiple servers one can choose.
UHN/HAPI Server (R4 FHIR)
UHN/HAPI Server (STU3 FHIR)
UHN/HAPI Server (DSTU2 FHIR)
UHN/HAPI Server (R5 FHIR)
Health Intersections (R4 FHIR)
Health Intersections (STU3 FHIR)
Health Intersections (DSTU2 FHIR)
Vonk - Firely (STU3 FHIR)
###
Quesiton: exactly what are those servers and the difference in between?
dsh (Nov 22 2019 at 04:38):
Exactly :smiley: its quite overwhelming to figure out which one to use
Grahame Grieve (Nov 22 2019 at 05:46):
Health Intersections - I write this, it's a reference server that simply sets out to implement the API correctly. It runs at test.fhir.org
HAPI - a production ready server written in Java
Vonk - a product ready server written in DotNet
Lloyd McKenzie (Nov 22 2019 at 06:19):
And there are many more test servers than those. Different servers implement different subsets of the spec. Some support different versions. Some reflect the capabilities of different EHRS. The diversity allows client applications to test against the sort of diversity they're likely to encounter in the real world.
dsh (Nov 22 2019 at 08:02):
@Grahame Grieve @Lloyd McKenzie thanks for chiming in.
Do you think is it safe to use this https://github.com/hapifhir/hapi-fhir-jpaserver-starter as a production server for our green field project (new clinical data repository) ? If not, could you recommend something else.
Grahame Grieve (Nov 22 2019 at 08:10):
I'd be comfortable using that server. That's what it's for
Lloyd McKenzie (Nov 22 2019 at 11:27):
I haven't used it, but there are lots of production systems that do. So it's at least as "safe" and well exercised as any of the others available in my opinion.
Vibin_chander (Dec 09 2019 at 11:05):
@Grahame Grieve I saw the test.fhir.org and i found HAPI is missing the conditional PUT or POST concept. You have implemented that. Thats good. Where can I find the source GIT HUB repo for this implemenation?
Jose Costa Teixeira (Dec 09 2019 at 11:06):
@Vibin_chander you mean the source for Grahame's server (which runs on test.fhir.org)?
Vibin_chander (Dec 09 2019 at 11:07):
I mean the git hub code of test.fhir.ord
Jose Costa Teixeira (Dec 09 2019 at 11:07):
https://github.com/grahamegrieve/fhirserver
Vibin_chander (Dec 09 2019 at 11:08):
Great Thanks a lot @Jose Costa Teixeira
Vibin_chander (Dec 09 2019 at 11:56):
By any chance Querying mechanism of FHIR implementation uses Graph QL?
Patrick Werner (Dec 09 2019 at 12:05):
I saw the test.fhir.org and i found HAPI is missing the conditional PUT or POST concept. You have implemented that. Thats good. Where can I find the source GIT HUB repo for this implemenation?
hapi also supports conditional POST and PUT
Vibin_chander (Dec 09 2019 at 12:26):
@Patrick Werner my bad it works
Vibin_chander (Dec 09 2019 at 12:26):
http://hapi.fhir.org/baseR4/Patient/vibin.cha0000er?_format=json&_pretty=true just tried
Vibin_chander (Dec 10 2019 at 11:36):
Hi.... I'm continuing to test HAPI repository. When I send Bundle with type "transaction" HAPI rejects it. My intention is sending two allergies in one bundle. And I'm sending "request" as POST. Is there another way to send Bundle or I'm doing a mistake?
Lloyd McKenzie (Dec 10 2019 at 13:11):
Can you paste the first part of your Bundle (start of the resource through the end of your first entry)?
Patrick Werner (Dec 10 2019 at 17:05):
Hi.... I'm continuing to test HAPI repository. When I send Bundle with type "transaction" HAPI rejects it. My intention is sending two allergies in one bundle. And I'm sending "request" as POST. Is there another way to send Bundle or I'm doing a mistake?
- Are you sending the Transaction here to the base_url?
- What is the error you are getting
- As Lloyd said, post (parts) of your Bundle
James Agnew (Dec 10 2019 at 17:06):
@Vibin_chander ALso, what URL are you posting to? It should be http://hapi.fhir.org/baseR4/
(not http://hapi.fhir.org/baseR4/Bundle
)
Vibin_chander (Dec 11 2019 at 06:00):
@James Agnew I agree I was making that mistake. It is suppose to be /baseR4/ not /baseR4/Bundle. But I've a preliminary question. The "resource" FHIR element inside a bundle is not repeating as per the cardinality mentioned.
Vibin_chander (Dec 11 2019 at 06:01):
What If I have 2 allergy. I can't bind them inside one resource. I have send them individual resource inside a bundle?
Vibin_chander (Dec 11 2019 at 06:21):
Have changed the code and made two allergy entries with two different full url and request methods inside Bundle
Vibin_chander (Dec 11 2019 at 06:21):
Works perfectly fine.
James Agnew (Dec 11 2019 at 15:55):
great!
Sandeep Rathore (Sep 01 2020 at 20:12):
Sandeep Rathore: Hi Everyone,
I have created a bundle resource from HL7 v2 meassage, in which I am sending full URL for each resource in order to reference it in another resource, i have also used conditional update in few of the resources like - Patient Resource and Encounter resource based on the identifiers. My issue is - In fhir server it it creating 2 resources for a single resource from the bundle. one with the full url as resource id which is an empty resource and another with its own resourcse id for example - For a patient resource in a bundle- It is creating 2 patient resources on server, one with full content inside it and with new resource id, and another with the full url id that I have given. Please refer the attached fhir bundle. I am using Hapi JPA server
FHIR_bundle
Vassil Peytchev (Sep 01 2020 at 20:17):
I quoted your message in the #hapi stream, you can see it at https://chat.fhir.org/#narrow/stream/179167-hapi/topic/Referencing.20in.20bundle/near/208741914
Dexter (Oct 28 2020 at 07:24):
Hello. I think this is the right topic, if not, please migrate to the right topic. Thank you admins!
I am facing an issue in my implementation that I've been asked to work on.
There's an admin portal, where management can assign physicians to patients. When a physician logs in, the patients that he can see should be only those that have been assigned to that him. I've looked at SMART on FHIR, but that doesn't seem to meet all of my requirements. From the documentation, I feel my only option is to use the Interceptor and filter out each request. But say there's search request, that searches for all patients with some parameter. For a given physician, how do I limit the response to only the patients that have been put under his care?
I've been tasked with making all of these, the portal (admin, patient, physician etc).
René Spronk (Oct 28 2020 at 07:28):
(please change your handle to be a more meaningful name, thanks). It would seem that first of all you'd have to decide how you capture/express the relationship between a patient and a care practitioner. Once you know how you're going to express that in FHIR, you could base your filter on that information.
Dexter (Oct 28 2020 at 09:02):
Capturing the relationship, I thought I can do it by adding the physician in the patient's care team. How do I filter? I do see some endpoint search criteria that help, but say a physician has 5 patients under his care, and he wants to search for all that have, say, BP above a certain level. How do I achieve this?
René Spronk (Oct 28 2020 at 10:51):
Ok, so if indeed you capture the relationship by adding a practitioner to a CareTeam which has a patient as its subject (which would be pretty useless unless you also capture a CarePlan, or a Contract, or some other reason for having a CareTeam, but that as an aside), then one could search for all patients that one is responsible for: GET [base]/CareTeam?participant:Practitioner.identifier=tokenURL|token - this returns a list of CareTeams, and therefore a set of subject/patient identifiers. Subsequently one can search for observations for these patients. Trying to create a combined search that expresses "give me BPs over 130 for all patients that are in a CareTeam jointly with physician X" may be possible, but it'll be harder to construct than a multi step approach.
Note that if your question is specifically about hapi interceptors, or other hapi specifics, your question is best asked in the #hapi channel.
Serhii Storozhenko (Oct 28 2020 at 14:20):
Oh, I shouldn't create new topic probably. Can i ask questions here?
David Pyke (Oct 28 2020 at 14:20):
Questions specific to HAPI-FHIR will get better quality answers in #hapi
Lloyd McKenzie (Oct 28 2020 at 15:28):
All security/access-based filters will get tied into the back end. There are a few architectural approaches.
- You can execute all inbound queries against a database 'view' that enforces the access privileges a particular user (in a given context) has.
- You can take the SQL (or other) syntax for the inbound query and append it to the SQL/other syntax for the user's permissions such that the returned data is the intersection of the two.
- You can execute the query and then perform a post-filter to strip out the results the user doesn't have the right to see (or suppress the data elements within that set they're not allowed to see)
These mechanisms can be combined, and there can potentially be other approaches too. Each of the reference implementations has layers where you ought to be able to invoke these approaches.
Venkat (Oct 28 2020 at 16:04):
Hi Team,
I am preparing a FHIR JSON using fhir.r4-4.1.0 in java, in some cases some junk characters are coming before and after opening and closing curly braces ({ and } ) in the generated JSON like :Ý{ and ¨}¨ Is there any specific reason for this?
Thanks in advance,
Venkat.
Eric Prud'hommeaux (Oct 28 2020 at 16:13):
@Venkat , are you working on windows?
Eric Prud'hommeaux (Oct 28 2020 at 16:22):
anyways, i suspect something is being doubly-encoded
Dexter (Oct 29 2020 at 06:57):
Thank you for the response!
The views idea is really good! Could you elaborate on what you mean by a context, or point me to the docs?
I've been thinking of appending the query parameter to limit the result to only a few, but if there's 100 patients, then the HTML query will probably be too large. So I've thought of post-processing the result, but it might get too expensive on the DB in case I'm filtering out after the original query has been executed. So SQL filtering has to be best approach. I guess the best approach for me, from all the help I've received so far would be to just add it in the API, correct?
I've had trouble figuring out the implementation. Are there examples similar to what I seek? And where, in which part of the code do I implement there? The codebase of HAPI, where would I add in this implementation?
Lloyd McKenzie (Oct 29 2020 at 13:46):
Context would be that access privileges might be different in different situations - e.g. what access do you have when you're part of the care team va. not or you're listed as performer on a current encounter vs. not - or even when you're performing one business function vs. another.
If you have a rule that you can only see patients you're on the care team of, that's a simple extra join to your query, even if you're doing a search against thousands of patients
Lloyd McKenzie (Oct 29 2020 at 13:48):
If you have specific questions about how to do something in HAPI, your best place to ask is #hapi
Shiva Kumar Konduru (Nov 05 2020 at 15:55):
Hi everyone ....we are using hapifhir to call an FHIR compliant API...........as part of this...we need to search for Coverage resource.....need guidance in preparing the request params for the same...
Code to search the Coverage Resource -
Bundle bundle2 = client
.search()
.forResource(Coverage.class)
.where(Coverage.BENEFICIARY.hasChainedProperty(Patient.FAMILY.matches().value("UONOMI"))).
and(Coverage.BENEFICIARY.hasChainedProperty(Patient.GIVEN.matches().value("TYREEK"))).
and(Coverage.BENEFICIARY.hasChainedProperty(Patient.BIRTHDATE.beforeOrEquals().day("1926-12-29"))).
where(new TokenClientParam("Coverage.period.end").exactly().code("2020-11-05"))
.where(new TokenClientParam("Coverage.period.start").exactly().code("2020-11-05")).
and(Coverage.BENEFICIARY.hasChainedProperty(
Patient.IDENTIFIER.hasSystemWithAnyCode(("http://terminology.hl7.org/CodeSystem/v2-0203|MB|101210097")))).
include(Coverage.INCLUDE_BENEFICIARY)
.returnBundle(Bundle.class)
.withAdditionalHeader("Content-Type", "application/x-www-form-urlencoded").withAdditionalHeader("x-subject-id", "1")
.execute();
Error:
2020-11-05 21:27:43.968 TRACE 13960 --- [nio-8080-exec-3] ca.uhn.fhir.rest.client.impl.BaseClient : FHIR response:
ca.uhn.fhir.rest.client.apache.ApacheHttpResponse@37fecfeb
{"issue":[{"severity":"error","diagnostics":"","code":"invalid","expression":"Bundle","details":{"text":"object instance has properties which are not allowed by the schema: ['beneficiary.identifier','beneficiary.identifier..code','beneficiary.identifier..system','beneficiary.identifier..value']"}}],"resourceType":"OperationOutcome"}
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException: HTTP 400 Bad Request
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Eric Haas (Nov 05 2020 at 16:52):
try the #hapi stream
Guillaume Gaulard (Mar 25 2021 at 10:51):
(deleted)
Patrick Werner (Mar 25 2021 at 12:10):
please use the #hapi stream
Greg A (Mar 25 2021 at 13:18):
I feel like this might be a stupid question because I'm really new to HAPI FHIR and probably haven't done enough research on my own.
That said.. If I want to use hapi-fhir-validation but use a different ValueSet or CodeSet how would the best way to go about it be?
I see that in hapi-fhir-validation, there are .xsd, .xml & .sch files that all see to have definitions related to the *Sets. But.. I'm confused about the relation between those "hard-coded" value and what seems, from reading the documentation at https://hapifhir.io/hapi-fhir/docs/validation/instance_validator.html on configuring different validations.
Lloyd McKenzie (Mar 25 2021 at 13:22):
Take a look at profiling. It describes the rules for what sort of changes are allowed to vocabulary and what's not. If you define a profile, you can ask HAPI to validate against the profile. (You can't, however, tell it to not validate against the base resource rules.)
Ephraim Kigamba (Sep 08 2021 at 12:39):
Hi guys, I love for StructureMap transformations work. I'm a mobile implementer and we were able to add this functionality to the Google Android FHIR SDK in this PR https://github.com/google/android-fhir/pull/566. We were having a couple of challenges? One of the challenges is the performance on mobile devices. Each transform seems to take between 15 to 45 seconds which is long on a mobile device.
I believe the code loads all the files in the FHIR as part of loading the package. I see some performance options in the docs while interacting with the Restful API but not sure if we have such configurations for the transform process and package loading process. Any help/direction will be appreciated
Lloyd McKenzie (Sep 08 2021 at 13:11):
@Ephraim Kigamba This seems to be a partial duplicate of your post under https://chat.fhir.org/#narrow/stream/179166-implementers/topic/FHIR.20Resource.20StructureMap. Where did you intend your post to live?
Ephraim Kigamba (Sep 08 2021 at 13:12):
@Lloyd McKenzie Sorry, if both posts appear on the same thread. I assumed they are separate. I'll probably delete the previous post and tag the specific person on this topic
Navita (Sep 15 2021 at 07:12):
My team and I are trying to use FHIR for our project and looking into different FHIR servers. We are now exploring HAPI FHIR. What is your experience with HAPI FHIR? Or any other better FHIR server? Also, is there any JavaScript version of HAPI?
Ephraim Kigamba (Sep 21 2021 at 12:33):
@Navita HAPI FHIR is pretty stable and implements most of the SPEC. I've only had an issue with unimplemented FHIR Path functions. We have only had to add authentication support which was also easy. I don't know about Javascript with HAPI since we mostly use it as a backend
Adesh Atole (Sep 30 2021 at 20:02):
What are the hash values defined in getProperty() for r4 models?
Lloyd McKenzie (Sep 30 2021 at 20:21):
Might be best to ask on #hapi
Last updated: Apr 12 2022 at 19:14 UTC