Record diagnosis via REST API

How do you record a patient diagnosis via the REST API. AFAIK it should be an Observation without a value, but if I try that (post encounter containing obs that has no value) I get a validation error in the log:

failed to validate with reason: error.noValue

When I use the web app, the visit diagnoses are saved as rows in the encounter_diagnosis table, so I thought I could just POST to that, but the REST API does not support that resource.

How do I record a patient diagnosis via REST?

Did you try the patientdiagnoses resource?

Thanks, I have now tried that. However, I get errors posting to that endpoint: as is the case generally, REST docs are very cryptic and the exception reporting is 100% unusable, so I don’t know what I’m doing wrong.

The swagger docs provide this example:

  "diagnosis": "string",
  "encounter": "string",
  "condition": "string",
  "certainty": "string",
  "patient": "uuid",
  "rank": 0
  • patient seems to be a UUID.
  • By looking at patient_diagnoses I captured via the web app, I could get meaningful values for rank (1, 2…) and certainty (“PROVISIONAL”, “CONFIRMED”)
  • diagnosis just says “string” (not “uuid”) - does this mean I have to supply the full concept name?
  • encounter also says “string” (not “uuid”) - how do I reference an encounter if not be UUID?
  • same for condition?

Here’s my post:

  "diagnosis": "Depression",
  "encounter": "e43b6c7b-9a90-4afd-b24f-da24e24a3d23",
  "patient": "a1e24d37-c3fd-4d24-a607-b498cb430824",
  "certainty": "CONFIRMED",
  "rank": 1,

I couldn’t get an example to work yet.

Have you given up on upgrading the webservices rest module for better error reporting?

I did upgrade, but found that the error reporting that came back in the REST response was the same, just less verbose; the only thing that changed was that there was no longer that other exception (regarding SimpleObject conversion, I think) in the log.

So, server log is cleaner, REST error is less verbose, but still unusable.

I have now cloned the REST API Git repo so that I can browse the code properly. looks like what I want.