0

I have a problem with custom resources. I'm doing a restful server to access to clinical information form a external database, and I have a custom resource: MyAppointment, with a custom attribute. My question is, when a client uses my web service, need the client to have a class in his code identical that my MyAppointment.class for do this:

 // Create a client (only needed once)
FhirContext ctx = new FhirContext();
IGenericClient client = ctx.newRestfulGenericClient("http://localhost:8080/restful-server-example/fhir");

// Invoke the client
Bundle bundle = client.search().forResource(Appointment.class)
.where(new StringClientParam("patient").matches().value("1232"))
.where(new StringClientParam("fechaDesde").matches().value("2"))
.where(new StringClientParam("fechaHasta").matches().value("2"))
.execute();

**MyAppointment** appo= (**MyAppointment**) bundle.getEntry().get(0).getResource();

If not, how can the client get de Custom Resource?

Thanks

granadaCoder
  • 26,328
  • 10
  • 113
  • 146
  • Out of desperation and so little information about custom resources, I'm posting this question link here https://stackoverflow.com/questions/54153559/hapi-fhir-domainresource-what-url-do-you-use – granadaCoder Jan 12 '19 at 13:57

1 Answers1

0

That's the challenge with custom resources. At the moment, any implementation that uses custom resources isn't FHIR conformant and isn't going to interoperate with other FHIR solutions unless you have a specific site-specific agreement. So custom resources tend to work best in closed communities where everyone can use custom code. If you want to interoperate with the general community, you should use Basic.

We're exploring other alternatives for custom resources. However, those custom resources will likely be restricted to resources that don't cover space handled by existing resources. So, given that FHIR already has an Appointment resource, there wouldn't be support for introducing MyAppointment - the expectation is that you'd profile the existing Appointment resource and use constraints & extensions to reflect your local requirements. If you're finding that the existing Appointment resource simply can't be adapted to reflect your needs, please engage with the Patient Administration work group and share your issues. (And if you'd like to accelerate the work towards supporting custom resources in general, share your desires on http://chat.fhir.org.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10