<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ohcnwiki.tellmey.fyi/index.php?action=history&amp;feed=atom&amp;title=References%2FMedication_Request</id>
	<title>References/Medication Request - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ohcnwiki.tellmey.fyi/index.php?action=history&amp;feed=atom&amp;title=References%2FMedication_Request"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Medication_Request&amp;action=history"/>
	<updated>2026-07-06T05:18:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.4</generator>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=References/Medication_Request&amp;diff=444&amp;oldid=prev</id>
		<title>Admin: Automated edit (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Medication_Request&amp;diff=444&amp;oldid=prev"/>
		<updated>2026-07-06T04:14:27Z</updated>

		<summary type="html">&lt;p&gt;Automated edit (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:44, 6 July 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 504:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 504:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Updates reach only &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;dispense_status&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Updates reach only &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;dispense_status&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; use &amp;lt;code&amp;gt;SET_NULL&amp;lt;/code&amp;gt;, so a request outlives the user, product, or prescription it referenced.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; use &amp;lt;code&amp;gt;SET_NULL&amp;lt;/code&amp;gt;, so a request outlives the user, product, or prescription it referenced.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Navbox medications}}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Related}}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Related}}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=References/Medication_Request&amp;diff=165&amp;oldid=prev</id>
		<title>Admin: OHC identity seed</title>
		<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Medication_Request&amp;diff=165&amp;oldid=prev"/>
		<updated>2026-07-04T22:45:23Z</updated>

		<summary type="html">&lt;p&gt;OHC identity seed&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Doc header&lt;br /&gt;
|type=reference&lt;br /&gt;
|domain=medications&lt;br /&gt;
|title=Medication Request&lt;br /&gt;
|order=1&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|model=MedicationRequest&lt;br /&gt;
|reference=References/Base models &amp;amp;amp; conventions&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;MedicationRequest&amp;lt;/code&amp;gt; records a prescriber&amp;#039;s intent to supply or administer a medication to a patient — the FHIR [&amp;lt;nowiki/&amp;gt;https://hl7.org/fhir/medicationrequest.html &amp;lt;code&amp;gt;MedicationRequest&amp;lt;/code&amp;gt;] resource. You create one whenever a drug is ordered during an encounter; it carries the medication, dosage instructions, timing, and route as structured JSON, grouped under a prescription.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Source:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Model: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/models/medication_request.py &amp;lt;code&amp;gt;care/emr/models/medication_request.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Spec: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/medication/request/spec.py &amp;lt;code&amp;gt;resources/medication/request/spec.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Spec: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/medication/request_prescription/spec.py &amp;lt;code&amp;gt;resources/medication/request_prescription/spec.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Value sets: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/tree/develop/care/emr/resources/medication/valueset &amp;lt;code&amp;gt;resources/medication/valueset/&amp;lt;/code&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
Several fields are opaque &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;s whose structure the Django model never declares. The contract lives in the Pydantic resource specs under &amp;lt;code&amp;gt;care/emr/resources/medication/request/&amp;lt;/code&amp;gt;: the enums, the nested shape of those JSON fields, validation rules, the read/write schema split, and the server-side side effects. The tables below merge both layers.&lt;br /&gt;
&lt;br /&gt;
== Models ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Model&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestPrescription&amp;lt;/code&amp;gt;&lt;br /&gt;
| Groups medication requests authored together for an encounter (a prescription)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequest&amp;lt;/code&amp;gt;&lt;br /&gt;
| A single medication order/request for a patient within an encounter&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Both extend [[References/Base models &amp;amp;amp; conventions|&amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;]], which supplies &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_date&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;modified_date&amp;lt;/code&amp;gt;, soft-delete via &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;history&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;meta&amp;lt;/code&amp;gt; JSON.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;MedicationRequest&amp;lt;/code&amp;gt; fields ==&lt;br /&gt;
&lt;br /&gt;
=== Order status &amp;amp;amp; intent ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Required&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=MedicationRequest|section=Order status &amp;amp;amp; intent|name=status|type=CharField(100) → MedicationRequestStatus|notes=Yes (spec)}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Order status &amp;amp;amp; intent|name=status_reason|type=CharField(100) → StatusReason | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Order status &amp;amp;amp; intent|name=intent|type=CharField(100) → MedicationRequestIntent|notes=Yes (spec)}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Order status &amp;amp;amp; intent|name=category|type=CharField(100) → MedicationRequestCategory|notes=Yes (spec)}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Order status &amp;amp;amp; intent|name=priority|type=CharField(100) → MedicationRequestPriority|notes=Yes (spec)}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Order status &amp;amp;amp; intent|name=do_not_perform|type=BooleanField → bool|notes=Yes}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Order status &amp;amp;amp; intent|name=dispense_status|type=CharField(100) → MedicationRequestDispenseStatus | None|notes=No}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Medication &amp;amp;amp; dosage ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Required&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=MedicationRequest|section=Medication &amp;amp;amp; dosage|name=medication|type=JSONField → ValueSetBoundCoding[system-medication] | None|notes=Conditional}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Medication &amp;amp;amp; dosage|name=method|type=JSONField|notes=n/a}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Medication &amp;amp;amp; dosage|name=dosage_instruction|type=JSONField → list[DosageInstruction]|notes=Yes}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Medication &amp;amp;amp; dosage|name=note|type=TextField → str | None|notes=No}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Subject &amp;amp;amp; provenance ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Required&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=MedicationRequest|section=Subject &amp;amp;amp; provenance|name=patient|type=FK → Patient|notes=server-set}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Subject &amp;amp;amp; provenance|name=encounter|type=FK → Encounter|notes=Yes (create)}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Subject &amp;amp;amp; provenance|name=authored_on|type=DateTimeField → datetime|notes=Yes (spec)}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Subject &amp;amp;amp; provenance|name=requester|type=FK → users.User|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Subject &amp;amp;amp; provenance|name=requested_product|type=FK → ProductKnowledge|notes=Conditional}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=Subject &amp;amp;amp; provenance|name=prescription|type=FK → MedicationRequestPrescription|notes=No}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Enum values ==&lt;br /&gt;
&lt;br /&gt;
Spec enums use &amp;#039;&amp;#039;&amp;#039;underscored&amp;#039;&amp;#039;&amp;#039; member values (&amp;lt;code&amp;gt;on_hold&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;original_order&amp;lt;/code&amp;gt;), not the hyphenated FHIR spellings. These are the exact strings the API accepts and returns.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;MedicationRequestStatus&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;on_hold&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ended&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;stopped&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;completed&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cancelled&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;draft&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;StatusReason&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning (FHIR)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;altchoice&amp;lt;/code&amp;gt;&lt;br /&gt;
| Alternative choice&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clarif&amp;lt;/code&amp;gt;&lt;br /&gt;
| Prescription requires clarification&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;drughigh&amp;lt;/code&amp;gt;&lt;br /&gt;
| Drug level too high&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;hospadm&amp;lt;/code&amp;gt;&lt;br /&gt;
| Admission to hospital&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;labint&amp;lt;/code&amp;gt;&lt;br /&gt;
| Lab interference issues&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;non_avail&amp;lt;/code&amp;gt;&lt;br /&gt;
| Patient not available&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;preg&amp;lt;/code&amp;gt;&lt;br /&gt;
| Patient is pregnant or breastfeeding&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;salg&amp;lt;/code&amp;gt;&lt;br /&gt;
| Allergy&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sddi&amp;lt;/code&amp;gt;&lt;br /&gt;
| Drug interaction&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sdupther&amp;lt;/code&amp;gt;&lt;br /&gt;
| Duplicate therapy&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sintol&amp;lt;/code&amp;gt;&lt;br /&gt;
| Suspected intolerance&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;surg&amp;lt;/code&amp;gt;&lt;br /&gt;
| Patient scheduled for surgery&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;washout&amp;lt;/code&amp;gt;&lt;br /&gt;
| Washout&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;MedicationRequestIntent&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;proposal&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;plan&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;order&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;original_order&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;reflex_order&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filler_order&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;instance_order&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;MedicationRequestPriority&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;routine&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;urgent&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;asap&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;stat&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;MedicationRequestCategory&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;inpatient&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;outpatient&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;discharge&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;MedicationRequestDispenseStatus&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;complete&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;partial&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;incomplete&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;declined&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;TimingUnit&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
UCUM time units used by &amp;lt;code&amp;gt;Timing.repeat.period_unit&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bounds_duration.unit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Unit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt;&lt;br /&gt;
| second&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;min&amp;lt;/code&amp;gt;&lt;br /&gt;
| minute&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt;&lt;br /&gt;
| hour&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;&lt;br /&gt;
| day&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;wk&amp;lt;/code&amp;gt;&lt;br /&gt;
| week&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mo&amp;lt;/code&amp;gt;&lt;br /&gt;
| month&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;&lt;br /&gt;
| year&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;DoseType&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
Used by &amp;lt;code&amp;gt;DoseAndRate.type&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ordered&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;calculated&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;DosageInstruction&amp;lt;/code&amp;gt; nested spec ==&lt;br /&gt;
&lt;br /&gt;
Each entry in the &amp;lt;code&amp;gt;dosage_instruction&amp;lt;/code&amp;gt; JSON list deserializes to a &amp;lt;code&amp;gt;DosageInstruction&amp;lt;/code&amp;gt; (Pydantic, snake_case keys) — the structure hiding behind the opaque &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Required&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=sequence|type=int | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=text|type=str | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=additional_instruction|type=list[Coding] | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=patient_instruction|type=str | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=timing|type=Timing | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=as_needed_boolean|type=bool|notes=&amp;#039;&amp;#039;&amp;#039;Yes&amp;#039;&amp;#039;&amp;#039;}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=as_needed_for|type=Coding | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=site|type=Coding | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=route|type=Coding | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=method|type=Coding | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=dose_and_rate|type=DoseAndRate | None|notes=No}}&lt;br /&gt;
{{Field|model=MedicationRequest|section=DosageInstruction nested spec|name=max_dose_per_period|type=DoseRange | None|notes=No}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sub-types under &amp;lt;code&amp;gt;DosageInstruction&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;Timing {&lt;br /&gt;
  repeat: TimingRepeat        # required&lt;br /&gt;
  code: Coding | None         # e.g. BID/TID/QID timing abbreviation&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TimingRepeat {&lt;br /&gt;
  frequency: int              # required — repetitions per period&lt;br /&gt;
  period: Decimal(20,0)       # required — duration the frequency applies to&lt;br /&gt;
  period_unit: TimingUnit     # required — s|min|h|d|wk|mo|a&lt;br /&gt;
  bounds_duration: TimingQuantity  # required — total span&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TimingQuantity {              # integer-valued time amount&lt;br /&gt;
  value: Decimal(20,0)        # required&lt;br /&gt;
  unit: TimingUnit            # required&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DoseAndRate {&lt;br /&gt;
  type: DoseType              # required — ordered | calculated&lt;br /&gt;
  dose_range: DoseRange | None      # for titrated doses&lt;br /&gt;
  dose_quantity: DosageQuantity | None  # for regular doses&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DoseRange {&lt;br /&gt;
  low: DosageQuantity         # required&lt;br /&gt;
  high: DosageQuantity        # required&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DosageQuantity {              # measured dose amount&lt;br /&gt;
  value: Decimal(20,6)        # required&lt;br /&gt;
  unit: Coding                # required&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The Pydantic specs define these JSON keys as snake_case (&amp;lt;code&amp;gt;as_needed_boolean&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;period_unit&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dose_and_rate&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;max_dose_per_period&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bounds_duration&amp;lt;/code&amp;gt;), so that is how they sit in storage — not the camelCase FHIR wire format.&lt;br /&gt;
&lt;br /&gt;
== Bound value sets ==&lt;br /&gt;
&lt;br /&gt;
Coded fields bind to Care value sets through &amp;lt;code&amp;gt;ValueSetBoundCoding[&amp;amp;lt;slug&amp;amp;gt;]&amp;lt;/code&amp;gt;. On write, the supplied &amp;lt;code&amp;gt;Coding.code&amp;lt;/code&amp;gt; is validated against the value set; a code outside it is rejected. All draw from SNOMED CT (&amp;lt;code&amp;gt;http://snomed.info/sct&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Value set slug&lt;br /&gt;
! SNOMED CT scope&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;medication&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-medication&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;amp;lt;&amp;amp;lt; 763158003&amp;lt;/code&amp;gt; Medicinal product&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dosage_instruction[].route&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-route&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;is-a 284009009&amp;lt;/code&amp;gt; Route of administration&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dosage_instruction[].site&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-body-site&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;is-a 91723000&amp;lt;/code&amp;gt; Anatomical structure&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dosage_instruction[].method&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-administration-method&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;is-a 736665006&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dosage_instruction[].as_needed_for&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-as-needed-reason&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;is-a 404684003&amp;lt;/code&amp;gt; Clinical finding&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dosage_instruction[].additional_instruction&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-additional-instruction&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;is-a 419492006&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;system-medication-not-given&amp;lt;/code&amp;gt; lives in this directory too, but it binds on [[References/Medication Administration]], not on the request.&lt;br /&gt;
&lt;br /&gt;
== Resource specs (API schema) ==&lt;br /&gt;
&lt;br /&gt;
Every spec extends [[References/Base models &amp;amp;amp; conventions|&amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;]], which provides &amp;lt;code&amp;gt;serialize&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt; plus the &amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; hooks. &amp;lt;code&amp;gt;MedicationRequestResource&amp;lt;/code&amp;gt; sets &amp;lt;code&amp;gt;__exclude__ = [patient, encounter, requester, requested_product, prescription]&amp;lt;/code&amp;gt;, so those relations are wired up by hand instead of auto-mapped.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Spec class&lt;br /&gt;
! Role&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestAbstractSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared (fields)&lt;br /&gt;
| Plain &amp;lt;code&amp;gt;BaseModel&amp;lt;/code&amp;gt; holding the clinical fields: &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;status_reason&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;intent&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;priority&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;do_not_perform&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;medication&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dosage_instruction&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;authored_on&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dispense_status&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestResource&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared (binding)&lt;br /&gt;
| Binds the spec to the &amp;lt;code&amp;gt;MedicationRequest&amp;lt;/code&amp;gt; model and declares &amp;lt;code&amp;gt;__exclude__&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BaseMedicationRequestSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestResource&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;MedicationRequestAbstractSpec&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;id: UUID4&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; (UUID, required), &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; (UUIDs), and &amp;lt;code&amp;gt;create_prescription&amp;lt;/code&amp;gt;. Carries the validators and &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| Narrow — only &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dispense_status&amp;lt;/code&amp;gt; are mutable after create&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestReadWithoutPrescriptionSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · embedded&lt;br /&gt;
| Full read minus prescription; expands &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;ProductKnowledgeReadSpec&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt;), plus &amp;lt;code&amp;gt;created_date&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;modified_date&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail/list&lt;br /&gt;
| Adds expanded &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;MedicationRequestPrescriptionReadSpec&amp;lt;/code&amp;gt;) and the &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; external id&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;CreatePrescription&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · nested&lt;br /&gt;
| &amp;lt;code&amp;gt;{ name?, note?, alternate_identifier (required) }&amp;lt;/code&amp;gt; — inline prescription creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Validation (create — &amp;lt;code&amp;gt;MedicationRequestSpec&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Medication XOR product:&amp;#039;&amp;#039;&amp;#039; you cannot set both &amp;lt;code&amp;gt;medication&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt;, and one is required.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Prescription XOR create:&amp;#039;&amp;#039;&amp;#039; you cannot set both &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;create_prescription&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Encounter existence:&amp;#039;&amp;#039;&amp;#039; the &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; UUID must match an existing &amp;lt;code&amp;gt;Encounter&amp;lt;/code&amp;gt; (field validator).&lt;br /&gt;
* &amp;lt;code&amp;gt;authored_on&amp;lt;/code&amp;gt;, and any nested &amp;lt;code&amp;gt;PeriodSpec&amp;lt;/code&amp;gt;/timing datetimes, must be timezone-aware.&lt;br /&gt;
&lt;br /&gt;
=== Server-side side effects (&amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; is resolved from its UUID, then &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; is copied from &amp;lt;code&amp;gt;encounter.patient&amp;lt;/code&amp;gt; — the client never sets &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; directly.&lt;br /&gt;
* &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt; are resolved by &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;requested_product.facility&amp;lt;/code&amp;gt; is set and differs from &amp;lt;code&amp;gt;encounter.facility&amp;lt;/code&amp;gt;, the write raises &amp;lt;code&amp;gt;&amp;amp;quot;Product not found in facility&amp;amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; is resolved by &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, scoped to the same &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;create_prescription&amp;lt;/code&amp;gt; looks up an existing prescription by &amp;lt;code&amp;gt;(alternate_identifier, encounter)&amp;lt;/code&amp;gt;. A match that is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt; raises &amp;lt;code&amp;gt;&amp;amp;quot;Prescription is not active&amp;amp;quot;&amp;lt;/code&amp;gt;; no match creates a new &amp;lt;code&amp;gt;MedicationRequestPrescription&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;status=active&amp;lt;/code&amp;gt;, copying &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;prescribed_by=requester&amp;lt;/code&amp;gt;) and links the request to it.&lt;br /&gt;
&lt;br /&gt;
=== Serialization (read) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt; sets &amp;lt;code&amp;gt;id = external_id&amp;lt;/code&amp;gt; and expands &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt;, and the audit users (&amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt;) from cache. &amp;lt;code&amp;gt;MedicationRequestReadSpec&amp;lt;/code&amp;gt; goes further, expanding &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; and emitting &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; as its external id.&lt;br /&gt;
&lt;br /&gt;
== Related models ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;MedicationRequestPrescription&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The container that groups every medication request authored together for an encounter into one prescription. Each request points back via &amp;lt;code&amp;gt;MedicationRequest.prescription&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;encounter            → FK Encounter (CASCADE)&lt;br /&gt;
patient              → FK Patient (CASCADE)&lt;br /&gt;
name                 → CharField(100), nullable&lt;br /&gt;
note                 → TextField, nullable&lt;br /&gt;
prescribed_by        → FK users.User (CASCADE, nullable)&lt;br /&gt;
status               → CharField(100), nullable  → MedicationRequestPrescriptionStatus&lt;br /&gt;
approval_status      → CharField(100), nullable&lt;br /&gt;
alternate_identifier → CharField(100), nullable&lt;br /&gt;
tags                 → ArrayField[int], default []&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A &amp;lt;code&amp;gt;UniqueConstraint&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;unique_alternate_identifier_encounter&amp;lt;/code&amp;gt;) keeps &amp;lt;code&amp;gt;alternate_identifier&amp;lt;/code&amp;gt; unique per &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MedicationRequestPrescriptionStatus&amp;lt;/code&amp;gt; values ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;on_hold&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ended&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stopped&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;completed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cancelled&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;draft&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A pharmacist may only move a prescription between &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;on_hold&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;completed&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;MEDICATION_PRESCRIPTION_PHARMACIST_ALLOWED_STATUS&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== Prescription specs ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Spec class&lt;br /&gt;
! Role&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BaseMedicationRequestPrescriptionSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared&lt;br /&gt;
| &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;MedicationRequestPrescriptionStatus&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestPrescriptionWriteSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; (UUID), &amp;lt;code&amp;gt;prescribed_by&amp;lt;/code&amp;gt; (UUID); resolves &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;→&amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;prescribed_by&amp;lt;/code&amp;gt; server-side&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestPrescriptionUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| Same shared fields, no new FKs&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestPrescriptionReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;created_date&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;modified_date&amp;lt;/code&amp;gt;, expanded &amp;lt;code&amp;gt;prescribed_by&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;tags&amp;lt;/code&amp;gt; (rendered via &amp;lt;code&amp;gt;SingleFacilityTagManager&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestPrescriptionRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail&lt;br /&gt;
| Adds audit &amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestPrescriptionRetrieveMedicationsSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail+children&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;medications&amp;lt;/code&amp;gt; (each via &amp;lt;code&amp;gt;MedicationRequestReadWithoutPrescriptionSpec&amp;lt;/code&amp;gt;) and full &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;EncounterRetrieveSpec&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MedicationRequestPrescriptionRetrieveDetailedSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;EncounterListSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Methods &amp;amp;amp; save behaviour ==&lt;br /&gt;
&lt;br /&gt;
* Read and write run through the inherited &amp;lt;code&amp;gt;EMRResource.serialize&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt; dumps with &amp;lt;code&amp;gt;exclude_defaults=True&amp;lt;/code&amp;gt;, maps the remaining fields onto the model, then calls &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; for the relation and prescription handling above.&lt;br /&gt;
* &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; always comes from &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;; the client never writes it.&lt;br /&gt;
* Inline prescription creation (&amp;lt;code&amp;gt;create_prescription&amp;lt;/code&amp;gt;) is idempotent on &amp;lt;code&amp;gt;(alternate_identifier, encounter)&amp;lt;/code&amp;gt; and proceeds only when an existing match is &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;authored_on&amp;lt;/code&amp;gt; falls back to &amp;lt;code&amp;gt;timezone.now&amp;lt;/code&amp;gt; at the model layer when omitted.&lt;br /&gt;
&lt;br /&gt;
== API integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Coded fields take a single &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; object &amp;lt;code&amp;gt;{ system, code, display }&amp;lt;/code&amp;gt; validated against bound SNOMED CT value sets — send a &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; from the right value set or the write fails.&lt;br /&gt;
* Enum members are underscored (&amp;lt;code&amp;gt;on_hold&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;original_order&amp;lt;/code&amp;gt;); send those literals, not the FHIR hyphenated forms.&lt;br /&gt;
* &amp;lt;code&amp;gt;dosage_instruction&amp;lt;/code&amp;gt; carries SIG text, timing/frequency, PRN flags, dose and rate, and max-dose limits — write the full nested shape (snake_case keys) rather than free text alone.&lt;br /&gt;
* On create, send either &amp;lt;code&amp;gt;medication&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt; (not both) and at most one of &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;create_prescription&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Updates reach only &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;dispense_status&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;requested_product&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;prescription&amp;lt;/code&amp;gt; use &amp;lt;code&amp;gt;SET_NULL&amp;lt;/code&amp;gt;, so a request outlives the user, product, or prescription it referenced.&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>