FHIR POST Observation error, and where do I find documentation?

Hello, I am on OpenMRS_referenceapplication-standalone-2.11.0

Making POST to http://localhost:8081/openmrs-standalone/ws/fhir2/R4/Observation/

To create an Observation using:

{
"resourceType": "Observation",
	"code": {
		"coding": [
			{
				"system": "http://openmrs.org",
				"code": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
				"display": "PULSE"
			},
			{
				"system": "http://loinc.org",
				"code": "8889-8",
				"display": "Heart Rate"
			}
		]
	},
	"valueQuantity": {
		"value": 87,
		"system": "http://unitsofmeasure.org",
		"code": "bpm"
	},
	"concept": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
	"obsDatetime": "2016-08-14T09:41:52",
	"issued": "2016-08-14T09:41:52.000",
	"status": "final",
	"subject": {
		"reference": "Patient/85511527-6223-11e6-a4f9-000d3a23bb00"
	},
	"referenceRange": [
		{
			"high": {
				"value": 120,
				"system": "http://unitsofmeasure.org",
				"code": "bpm"
			}
		}
	],
	"encounter": {
		"reference": "Encounter/11c1b0ab-d213-43b1-9ea2-6c0f58e2e459"
	}
}

I am getting 422 Unprocessable Entity error:

ERROR ‘obs id is null’ failed to validate with reason: obsDatetime: Cannot be empty or null, concept: Cannot be empty or null

And in my server log: Failure during REST processing: ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException: ‘obs id is null’ failed to validate with reason: obsDatetime: Cannot be empty or null, concept: Cannot be empty or null

But I did specify obsDatetime so what am I doing wrong?

I only have documentation from here:

https://wiki.openmrs.org/display/projects/Observation+Resource https://wiki.openmrs.org/display/projects/OpenMRS+FHIR+Module

But where do I find documentation on which elements are mandatory and what format and data types they have to have?

Thank-you

Formats and data types are all documented as part of the FHIR spec, e.g., for Observation.

There’s still some work to be done cleaning up error messages like that. The obsDatetime field, however, is the internal OpenMRS field. The corresponding FHIR field is effectiveDateTime.

Also, not that this is all that important, but “bpm” isn’t a valid UCUM unit. If you really want to use UCUM, the code should be “/min” (in OpenMRS we ignore this and the unit is determined by the underlying concept).

Thanks very much Ian, I changed it to effectiveDateTime and got past that now.

Sorry for the newbie questions. I have searched the OpenMRS documentation and the web and not been able to find the answers: The error I am receiving now is:

‘obs id is null’ failed to validate with reason: concept: Cannot be empty or null

And similarly from the server log: Failure during REST processing: ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException: ‘obs id is null’ failed to validate with reason: concept: Cannot be empty or null

I am obtaining the pulse concept from the OpenMRS Concept Dictionary, ie: for Pulse: http://localhost:8081/openmrs-standalone/dictionary/concept.htm?conceptId=5087 Is that the right place to find the concept code for making POSTs?

For pulse, I have tried both the Id: 5087 and the UUID: 5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

What should I be using?

My current JSON POST:

{
	"resourceType": "Observation",
	"code": {
		"coding": [
			{
				"system": "http://openmrs.org",
				"code": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
				"display": "PULSE"
			},
			{
				"system": "http://loinc.org",
				"code": "8889-8",
				"display": "Heart Rate"
			}
		]
	},
	"valueQuantity": {
		"value": 87,
		"system": "http://unitsofmeasure.org",
		"code": "/min"
	},
	"concept": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
	"effectiveDateTime": "2016-08-14T09:41:52",
	"issued": "2016-08-14T09:41:52.000",
	"status": "final",
	"referenceRange": [
		{
			"high": {
				"value": 120,
				"system": "http://unitsofmeasure.org",
				"code": "/min"
			}
		}
	],
	"encounter": {
		"reference": "Encounter/11c1b0ab-d213-43b1-9ea2-6c0f58e2e459"
	},
	"subject": {
		"reference": "Patient/da5e210f-a3c4-4c49-80f2-e2e5386db8ad",
		"type": "Patient",
		"display": "John Smith (OpenMRS ID: 1001MH)"
	}
}

Regarding the UCUM units, how would I normally find the valid UCUM unit for pulse? I could not find out through Google search and when I went to the full UCUM specifications: https://ucum.org/ucum.html it did not tell me the units for pulse or heart rate as “/min”.

Sorry for the newbie questions and thanks again.