hapi-fhir-jpaserver-starter icon indicating copy to clipboard operation
hapi-fhir-jpaserver-starter copied to clipboard

How to access the Database with the daoRegistry to create / read / update resources in custom functions on the server?

Open AdityaKBhadragond14 opened this issue 3 years ago • 2 comments

We are writing custom APIs to extend the functionality of the FHIR server. We are able to use the client

IGenericClient fhirClient = ctx.newRestfulGenericClient(serverBase);

to create, read and modify resources. But It seems wrong to use the RestfulClient when we are the same server.. Is there some documentation around using the daoRegistry?

cc: @joiskash

AdityaKBhadragond14 avatar May 17 '22 14:05 AdityaKBhadragond14

We've never really written any specific documentation on how to use the DaoRegistry (pull requests against the docs would certainly be appreciated!) but FWIW we have done this a lot internally, and I know lots of other HAPI FHIR users do this as well.

jamesagnew avatar Jun 06 '22 11:06 jamesagnew

Ok thanks @jamesagnew . Just a quick question though, is it ok to use the fhirClient like this ? We have basically added new services and controllers to the hapi-fhir-jpaserver-starter. Within those services we initialize the fhirClient using the docker network ip. And use it to create / update resources etc. I also asked this question in zulip chat, pasting the link below for your reference!

https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Logical.20element.20flow

joiskash avatar Jun 08 '22 12:06 joiskash