Stream: implementers
Topic: FHIR integration to Android
Morris Miltz (Jun 25 2017 at 16:10):
Hi, i am new so hopefully you can help me ;)
I'm a German student and working on a Android App which should use fhir to get patient informations.
I tried the implementation with:
dependencies {
compile "ca.uhn.hapi.fhir:hapi-fhir-android:2.2:dstu2@jar"
}
I got this from: "http://hapifhir.io/doc_android.html".
I also programmed a test-code in eclipse which worked, but under the "dstu3" not at the "dstu2" version.
So my question is: "Do you know how i can implement a fhir-android dependence with version "dstu3"?
Thank you for your efforts!
Peter Scholz (Jun 26 2017 at 07:50):
I guess @Patrick Werner could help along
Patrick Werner (Jun 26 2017 at 07:55):
Hi @Morris Miltz
I recently did a example on how to use hapo in android. This example is only about the needed dependencies and Android Compile Settings, doing network code inside an activity is very bad style and should be avoided in realt projects.
https://chat.fhir.org/#narrow/stream/hapi/subject/STU3.20on.20Android
Patrick Werner (Jun 26 2017 at 07:56):
just out of curiosity, at which university are you studying? Greetings from the Heilbronn University.
Morris Miltz (Jun 26 2017 at 08:15):
Hi @Peter Scholz @Patrick Werner,
thank you for your immediate answer.
I'm studying at the "HS Kempten" (Allgäu).
Thank you for the link i'll try it out.
Greetings from the Kempten University.
Morris Miltz (Jun 26 2017 at 08:56):
Hi @Patrick Werner it works great, thanks a lot.
But one last question.
How do i get the name from the Patient?
Do i need a parser?
Thank you for your efforts!
Greetings
Vadim Peretokin (Jun 26 2017 at 09:31):
Is this a patient on the server?
Morris Miltz (Jun 26 2017 at 09:46):
@Vadim Peretokin yes we've build a patient on the server via postman.
We search for the patient Id and it works great, but i don't know how the create a String with the patient name and birthday and so on
Vadim Peretokin (Jun 26 2017 at 09:54):
Once you've got the patient, you can use http://hapifhir.io/apidocs-dstu3/org/hl7/fhir/dstu3/model/Patient.html#getName-- and http://hapifhir.io/apidocs-dstu3/org/hl7/fhir/dstu3/model/Patient.html#getBirthDate--
Vadim Peretokin (Jun 26 2017 at 09:55):
You are able to search via hapi and download it, right? not just through postman?
Morris Miltz (Jun 26 2017 at 09:59):
Great thanks a lot.
Yes we're able to search via hapi.
I'll try your links know.
Morris Miltz (Jun 26 2017 at 10:37):
(deleted)
Morris Miltz (Jun 26 2017 at 14:05):
Hi, i have the problem that i don't know how i can convert from the URL to String or any requested type by using patient methods like @Vadim Peretokin showed me in his answer.
// Here you see a part of my code:
FhirContext ctx = FhirContext.forDstu3();
String serverBase = "http://fhirtest.uhn.ca/baseDstu3";
IGenericClient client = ctx.newRestfulGenericClient(serverBase);
try {
org.hl7.fhir.dstu3.model.Bundle results = client
.search()
.forResource(Patient.class)
//.where(Patient.FAMILY.matches().value("duck"))
.where(Patient.IDENTIFIER.exactly().code("156464"))
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class)
.execute();
The search works great, but like i said i don't know how to use the URL to create my Patient in Java.
Thank you for your efforts!
Greetings
Vadim Peretokin (Jun 27 2017 at 06:46):
@Morris Miltz well, you get a Bundle back from that, right (here's how it looks in FHIR and here's how it looks in HAPI).
Maybe getting a list of all Patients from the bundle with public <T extends IResource> List<T> getResources(Class<T> theClass)
Returns a list containing all resources of the given type from this bundle
will help?
Morris Miltz (Jun 29 2017 at 18:21):
@Vadim Peretokin Thanks a lot. Yes it helped
Srinivas Rupani (Jul 29 2021 at 12:53):
Hi any one can help on HAPI FHIR integration in Android
Srinivas Rupani (Jul 29 2021 at 12:55):
i'm facing an issue with android release build
Srinivas Rupani (Jul 29 2021 at 12:55):
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not find the HAPI-FHIR structure JAR on the classpath for version R4. Note that as of HAPI-FHIR v0.8, a separate FHIR strcture JAR must be added to your classpath (or project pom.xml if you are using Maven)
at ca.uhn.fhir.context.FhirContext.<init>(Unknown Source:114)
at ca.uhn.fhir.context.FhirContext.<init>(Unknown Source:1)
at ca.uhn.fhir.context.FhirContext.forR4(Unknown Source:4)
David Pyke (Jul 29 2021 at 12:56):
You'll get better answers on #hapi
Last updated: Apr 12 2022 at 19:14 UTC