File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,20 @@ def self.modify!(results, random_seed = 3)
264264 puts " - Altered Medication: #{ med_bundle . entry . first . resource . id } "
265265 end
266266
267+ # change one medication request from an order to a self prescription, if needed
268+ # we need at least two intents in order to demonstrate the multi-or search requirement for intent
269+ any_non_order = results . any? { |b | b . entry . any? { |e | e . resource . resourceType == 'MedicationRequest' && e . resource . intent != 'order' } }
270+ selection_medication_request = results . find { |b | DataScript ::Constraints . has ( b , FHIR ::MedicationRequest ) }
271+ if !any_non_order && selection_medication_request
272+ changed_medication = selection_medication_request . entry . select { |e | e . resource . resourceType == 'MedicationRequest' } . last . resource
273+ changed_medication . intent = 'plan'
274+ changed_medication . reportedBoolean = true
275+ changed_medication . reportedReference = nil
276+ changed_medication . requester = changed_medication . subject . clone
277+ changed_medication . encounter = nil
278+ puts " - Altered Medication Request to have 'plan' intent: #{ changed_medication . id } "
279+ end
280+
267281 # select by device
268282 selection_device = results . find { |b | DataScript ::Constraints . has ( b , FHIR ::Device ) }
269283 if selection_device
You can’t perform that action at this time.
0 commit comments