OpenMRS+Keycloak+Fhir2

@ibacher I used some recommendations regardin to host configuration from here

and it worked, I could get patient data and some observations. but there are a lot of another problems:

  1. http://localhost:8080/openmrs/ws/fhir2/R4/Device?_pretty=false&patient=1aaeea9e-4adf-4337-9b76-35863e842216&_count=1000

Status Code: 404 Not Found

response:

{"resourceType":"OperationOutcome","text":{"status":"generated","div":"<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Unknown resource type 'Device' - Server knows how to handle: [Condition, Group, MedicationRequest, Task, Immunization, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, OperationDefinition, Location]</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"},"issue":[{"severity":"error","code":"processing","diagnostics":"Unknown resource type 'Device' - Server knows how to handle: [Condition, Group, MedicationRequest, Task, Immunization, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, OperationDefinition, Location]"}]}
  1. http://localhost:8080/openmrs/ws/fhir2/R4/Flag?date=>=2022-02-21T04:48:43.589Z&subject=1aaeea9e-4adf-4337-9b76-35863e842216&identifier=system:sureAlert|74018-3,system:sureAlert|76281-5,system:sureAlert|74385-9&_count=200&_sort=date&_pretty=false

Status Code: 404 Not Found

response:

{"resourceType":"OperationOutcome","text":{"status":"generated","div":"<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Unknown resource type 'Flag' - Server knows how to handle: [Condition, Group, MedicationRequest, Task, Immunization, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, OperationDefinition, Location]</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"},"issue":[{"severity":"error","code":"processing","diagnostics":"Unknown resource type 'Flag' - Server knows how to handle: [Condition, Group, MedicationRequest, Task, Immunization, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, OperationDefinition, Location]"}]}
  1. http://localhost:8080/openmrs/ws/fhir2/R4/Media?subject=1aaeea9e-4adf-4337-9b76-35863e842216&_sort:desc=created&_count=5&status=completed&_pretty=false

Status Code: 404 Not Found

response:

{"resourceType":"OperationOutcome","text":{"status":"generated","div":"<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Unknown resource type 'Media' - Server knows how to handle: [Condition, Group, MedicationRequest, Task, Immunization, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, OperationDefinition, Location]</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"},"issue":[{"severity":"error","code":"processing","diagnostics":"Unknown resource type 'Media' - Server knows how to handle: [Condition, Group, MedicationRequest, Task, Immunization, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, OperationDefinition, Location]"}]}
  1. http://localhost:8080/openmrs/ws/fhir2/R4/DiagnosticReport?subject=1aaeea9e-4adf-4337-9b76-35863e842216&code=131328&date=>=2022-01-22T07:48:45.990Z&date=<=2022-02-21T07:48:45.990Z&_count=1&_sort:desc=_lastUpdated&_pretty=false

Status Code: 400 Bad Request

response:

{"resourceType":"OperationOutcome","text":{"status":"generated","div":"<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[DiagnosticReport] with parameters [[date, _pretty, _count, code, _sort:desc, subject]]</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"},"issue":[{"severity":"error","code":"not-supported","diagnostics":"Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[DiagnosticReport] with parameters [[date, _pretty, _count, code, _sort:desc, subject]]"}]}

Why there are no some endpoints?

1 Like

@theanandankit @ibacher do you have things regarding to 404?

As you can see from the error messages, we only support some endpoint and parameters for those endpoints. These are documented on the wiki. It’s important to realise that the purpose of the FHIR2 module is to expose existing OpenMRS data as FHIR resources, so where OpenMRS doesn’t have equivalent concepts (e.g. Device, Flag), there are no data by default. In other cases, (e.g., Media) the endpoint hasn’t been implemented yet.

As is standard for FHIR, the capability statement (/openmrs/ws/fhir2/R4/metadata) will provide you with the list of capabilities for your instance.