Missing field in FHIR APIs

I am adding procedure orders and vitals for a patient i created in OpenEMR. On resulting the orders with values and units i am able to retrieve Observation resources (using Observation.Read FHIR api) with the added labs and vitals results/units.

The labs and vitals are added for a specific encounter and i am expecting to see the encounter resource reference field (Observation.Encounter) in the observation resource. I can only see the subject field that has the patient reference.

Is there anyway i can enable the API to include Encounter reference as well. I want to be able to filter (categorize) observations based on patient encounters.

Also, the system/Observation.write scope is not present. Is there a way to enable this scope and start posting Observation resources in system context. ?

OpenEMR Version
I’m using OpenEMR version : 7.0.0

I’m using: Edge

Operating System
I’m using: Linux

Did you check the logs?
Was there anything pertinent in them?
Please paste them here (surround with three backticks (```) for readability.
You can also turn on User Debugging under Administration->Globals->Logging User Debugging Options=>All


Can someone help me with the above question.

Thanks and Regards,

You could add in the encounter by making changes to the FhirObservationVitalsService.php class (and hopefully giving us a pull request to add this functionality for everyone).

If you want to add in the write capabilities, it will be quite a bit of work for the Observation resource due to the fact it maps to so many different tables. If you want to only enable it for the posting of vitals you’d need to dig into the FhirObservationService, FhirObservationVitalsService, and the ScopeRepository class.

Thank you Stephen. I will look into this !