3b. Request history of MedicationRequest resources since time of search
FHIR offers several approaches to observe when there are changes to resources. A fairly flexible approach that offers both push and pull patterns for synchronization is offered by the Subscription resource. An effective alternative for simple use cases is to poll the FHIR server with history requests.
A display of active MedicationRequest
resources may be GET /MedicationRequest?status=active
. Next, keep the display up-to-date, we’ll make an initial history request for the history of all MedicationRequest
resources from when we acquired our snapshot just a moment ago.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
_since | string |
RESPONSES
status: OK
{"resourceType":"Bundle","type":"transaction-response","entry":[{"resource":{"resourceType":"MedicationRequest","id":"30d709a4-d497-4480-bbb3-fcea2abcc5f0","meta":{"extension":[{"extension":[{"url":"clientname","valueString":"data_uploader"},{"url":"person","valueReference":{"reference":"Person/bea178a0-6ea4-4b47-99af-e4021bba8f99"}}],"url":"https://commure.com/fhir/provenance/StructureDefinition/creator-structure-map"}],"versionId":"c3d87032-4af3-4aba-b062-708aa0e30cc4","lastUpdated":"2020-10-23T21:40:53.169642+00:00"},"identifier":[{"system":"wtv","value":"medication-request-id"}],"status":"on-hold","intent":"order","medicationCodeableConcept":{"coding":[{"system":"http://www.nlm.nih.gov/research/umls/rxnorm","code":"861467","display":"Loratadine 5 MG Chewable Tablet"}],"text":"Loratadine 5 MG Chewable Tablet"},"subject":{"reference":"patient"},"authoredOn":"2015-04-08T02:11:28-04:00","dosageInstruction":[{"sequence":1,"timing":{"repeat":{"frequency":1,"period":4,"periodUnit":"h"}},"asNeededBoolean":false,"doseAndRate":[{"type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/dose-rate-type","code":"ordered","display":"Ordered"}]},"doseQuantity":{"value":1}}]}]},"response":{"status":"201","location":"https://api-53914125.developer.commure.com/api/v1/r4/MedicationRequest/30d709a4-d497-4480-bbb3-fcea2abcc5f0/_history/c3d87032-4af3-4aba-b062-708aa0e30cc4","etag":"W/\"c3d87032-4af3-4aba-b062-708aa0e30cc4\"","lastModified":"2020-10-23T21:40:53+00:00"}},{"resource":{"resourceType":"MedicationDispense","id":"a7a1f2a3-58bc-4c15-8023-392d56725714","meta":{"extension":[{"extension":[{"url":"clientname","valueString":"data_uploader"},{"url":"person","valueReference":{"reference":"Person/bea178a0-6ea4-4b47-99af-e4021bba8f99"}}],"url":"https://commure.com/fhir/provenance/StructureDefinition/creator-structure-map"}],"versionId":"32e593ac-8276-47d1-b1ad-fe1403f70c72","lastUpdated":"2020-10-23T21:40:53.250970+00:00"},"status":"unknown","medicationCodeableConcept":{"coding":[{"system":"http://www.nlm.nih.gov/research/umls/rxnorm","code":"665078","display":"Loratadine 5 MG Chewable Tablet"}],"text":"Loratadine 5 MG Chewable Tablet"},"subject":{"reference":"patient"},"authorizingPrescription":[{"reference":"MedicationRequest/30d709a4-d497-4480-bbb3-fcea2abcc5f0"}],"whenPrepared":"2019-06-01","dosageInstruction":[{"sequence":1,"text":"Twice Daily.","asNeededBoolean":true}]},"response":{"status":"201","location":"https://api-53914125.developer.commure.com/api/v1/r4/MedicationDispense/a7a1f2a3-58bc-4c15-8023-392d56725714/_history/32e593ac-8276-47d1-b1ad-fe1403f70c72","etag":"W/\"32e593ac-8276-47d1-b1ad-fe1403f70c72\"","lastModified":"2020-10-23T21:40:53+00:00"}}]}