<?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%2FSupply_Request</id>
	<title>References/Supply 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%2FSupply_Request"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Supply_Request&amp;action=history"/>
	<updated>2026-07-06T05:20:38Z</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/Supply_Request&amp;diff=454&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/Supply_Request&amp;diff=454&amp;oldid=prev"/>
		<updated>2026-07-06T04:17:49Z</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:47, 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 267:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 267:&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;tags&amp;lt;/code&amp;gt; on &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; is an integer array of tag IDs, rendered to tag objects on read by the facility tag manager.&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;tags&amp;lt;/code&amp;gt; on &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; is an integer array of tag IDs, rendered to tag objects on read by the facility tag manager.&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;external_id&amp;lt;/code&amp;gt; (from &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;) is the stable public identifier in API URLs — never the internal primary key.&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;external_id&amp;lt;/code&amp;gt; (from &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;) is the stable public identifier in API URLs — never the internal primary key.&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 supply}}&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/Supply_Request&amp;diff=180&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/Supply_Request&amp;diff=180&amp;oldid=prev"/>
		<updated>2026-07-04T22:45:51Z</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=supply&lt;br /&gt;
|title=Supply Request&lt;br /&gt;
|order=4&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|model=SupplyRequest&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;SupplyRequest&amp;lt;/code&amp;gt; is a single line item: a quantity of one catalogue item (&amp;lt;code&amp;gt;ProductKnowledge&amp;lt;/code&amp;gt;) that someone wants moved. Requests never stand alone — each belongs to a &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; that groups them and describes the movement into a destination facility location, optionally from a supplier organization and/or an origin location. You create requests when an order needs stock; you read them back as part of the order they hang off.&lt;br /&gt;
&lt;br /&gt;
The Django model is only storage. &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;priority&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;intent&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;supplied_item_condition&amp;lt;/code&amp;gt; are plain &amp;lt;code&amp;gt;CharField&amp;lt;/code&amp;gt;s with no DB-level constraint, so the database will hold any string. The allowed values, validation, and request/response shapes live in the Pydantic resource specs under &amp;lt;code&amp;gt;care/emr/resources/inventory/supply_request/&amp;lt;/code&amp;gt;, covered below.&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/supply_request.py &amp;lt;code&amp;gt;care/emr/models/supply_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/inventory/supply_request/spec.py &amp;lt;code&amp;gt;care/emr/resources/inventory/supply_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/inventory/supply_request/request_order.py &amp;lt;code&amp;gt;care/emr/resources/inventory/supply_request/request_order.py&amp;lt;/code&amp;gt;]&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;SupplyRequest&amp;lt;/code&amp;gt;&lt;br /&gt;
| A request for a quantity of a catalogue item (product knowledge), grouped under an order&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt;&lt;br /&gt;
| An order that groups supply requests for movement of items into a destination facility location&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;]], the shared Care EMR base providing &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, audit fields (&amp;lt;code&amp;gt;created_date&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;modified_date&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;), soft-delete via &amp;lt;code&amp;gt;deleted&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;SupplyRequest&amp;lt;/code&amp;gt; fields ==&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;
! Notes&lt;br /&gt;
{{Field|model=SupplyRequest|section=SupplyRequest fields|name=status|type=CharField(255)|notes=Lifecycle status, spec-bound to &amp;lt;code&amp;gt;SupplyRequestStatusOptions&amp;lt;/code&amp;gt; (see below). Required on write.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=SupplyRequest fields|name=quantity|type=DecimalField|notes=&amp;lt;code&amp;gt;max_digits=20&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;decimal_places=6&amp;lt;/code&amp;gt;, nullable in DB. The write spec accepts a &amp;lt;code&amp;gt;Decimal&amp;lt;/code&amp;gt; capped to &amp;lt;code&amp;gt;decimal_places=0&amp;lt;/code&amp;gt; (whole numbers); the read spec returns it as an &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=SupplyRequest fields|name=supplied_item_condition|type=CharField(255)|notes=Model-only — no current spec reads or writes it, so it&amp;#039;s unreachable through the API.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=SupplyRequest fields|name=item|type=FK → ProductKnowledge|notes=&amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;. The catalogue item being requested. Required on create, resolved server-side from an &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;. Cannot be changed afterwards.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=SupplyRequest fields|name=order|type=FK → RequestOrder|notes=&amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;, nullable in DB but required by the spec on both create and update. Resolved server-side from an &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;SupplyRequestStatusOptions&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
Defined in &amp;lt;code&amp;gt;spec.py&amp;lt;/code&amp;gt; and bound to &amp;lt;code&amp;gt;SupplyRequest.status&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;draft&amp;lt;/code&amp;gt;&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;suspended&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;processed&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;entered_in_error&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Related models ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The order is the unit you actually work with. It collects one or more &amp;lt;code&amp;gt;SupplyRequest&amp;lt;/code&amp;gt; rows and carries the routing: a required &amp;lt;code&amp;gt;destination&amp;lt;/code&amp;gt; facility location, plus an optional &amp;lt;code&amp;gt;supplier&amp;lt;/code&amp;gt; organization and &amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt; location.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;supplier    → FK Organization (nullable, CASCADE)&lt;br /&gt;
origin      → FK FacilityLocation (nullable, CASCADE, related_name=&amp;quot;origin_request_orders&amp;quot;)&lt;br /&gt;
destination → FK FacilityLocation (CASCADE, related_name=&amp;quot;destination_request_orders&amp;quot;)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=name|type=CharField(255)|notes=Required.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=status|type=CharField(255)|notes=Spec-bound to &amp;lt;code&amp;gt;SupplyRequestOrderStatusOptions&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=note|type=TextField|notes=Optional (&amp;lt;code&amp;gt;str | None&amp;lt;/code&amp;gt;).}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=tags|type=ArrayField[int]|notes=Default &amp;lt;code&amp;gt;list&amp;lt;/code&amp;gt;; tag IDs, not a relational join. Expanded to tag objects on read via &amp;lt;code&amp;gt;SingleFacilityTagManager&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=priority|type=CharField(255)|notes=Spec-bound to &amp;lt;code&amp;gt;SupplyRequestPriorityOptions&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=intent|type=CharField(255)|notes=Spec-bound to &amp;lt;code&amp;gt;SupplyRequestIntentOptions&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=reason|type=CharField(255)|notes=Spec-bound to &amp;lt;code&amp;gt;SupplyRequestReason&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=category|type=CharField(255)|notes=Spec-bound to &amp;lt;code&amp;gt;SupplyRequestCategoryOptions&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=supplier|type=FK → Organization|notes=Nullable &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;. On write, must be an organization with &amp;lt;code&amp;gt;org_type == &amp;amp;quot;product_supplier&amp;amp;quot;&amp;lt;/code&amp;gt; — the server rejects anything else.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=origin|type=FK → FacilityLocation|notes=Nullable &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;related_name=&amp;amp;quot;origin_request_orders&amp;amp;quot;&amp;lt;/code&amp;gt;. The sending location.}}&lt;br /&gt;
{{Field|model=SupplyRequest|section=RequestOrder|name=destination|type=FK → FacilityLocation|notes=&amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;related_name=&amp;amp;quot;destination_request_orders&amp;amp;quot;&amp;lt;/code&amp;gt;. The receiving location. Required.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;destination&amp;lt;/code&amp;gt; both point at &amp;lt;code&amp;gt;FacilityLocation&amp;lt;/code&amp;gt; but carry distinct &amp;lt;code&amp;gt;related_name&amp;lt;/code&amp;gt;s, so one location can list the orders it sends (&amp;lt;code&amp;gt;origin_request_orders&amp;lt;/code&amp;gt;) separately from the orders it receives (&amp;lt;code&amp;gt;destination_request_orders&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; enum values ===&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;code&amp;gt;request_order.py&amp;lt;/code&amp;gt;. Each binds to the matching &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;CharField&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SupplyRequestOrderStatusOptions&amp;lt;/code&amp;gt; (→ &amp;lt;code&amp;gt;status&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;draft&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;pending&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;in_progress&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;abandoned&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;
&lt;br /&gt;
&amp;lt;code&amp;gt;SUPPLY_REQUEST_ORDER_COMPLETED_STATUSES&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[abandoned, entered_in_error, completed]&amp;lt;/code&amp;gt; marks the terminal/closed statuses.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SupplyRequestIntentOptions&amp;lt;/code&amp;gt; (→ &amp;lt;code&amp;gt;intent&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;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;directive&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;SupplyRequestCategoryOptions&amp;lt;/code&amp;gt; (→ &amp;lt;code&amp;gt;category&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;central&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;nonstock&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SupplyRequestPriorityOptions&amp;lt;/code&amp;gt; (→ &amp;lt;code&amp;gt;priority&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;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;SupplyRequestReason&amp;lt;/code&amp;gt; (→ &amp;lt;code&amp;gt;reason&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;patient_care&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ward_stock&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Resource specs (API schema) ==&lt;br /&gt;
&lt;br /&gt;
Every spec extends [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/base.py &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;] (&amp;lt;code&amp;gt;serialize&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt;, with &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). Write specs resolve foreign keys from &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; values in &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt;; read specs expand related objects in &amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Supply request specs (&amp;lt;code&amp;gt;spec.py&amp;lt;/code&amp;gt;) ===&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;
! Fields&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BaseSupplyRequestSpec&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;quantity&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;__model__ = SupplyRequest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;__exclude__ = [&amp;amp;quot;item&amp;amp;quot;]&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;quantity: Decimal(max_digits=20, decimal_places=0)&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;status: SupplyRequestStatusOptions&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SupplyRequestWriteSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| base + &amp;lt;code&amp;gt;item: UUID4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;order: UUID4&amp;lt;/code&amp;gt;&lt;br /&gt;
| Resolves &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;ProductKnowledge&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;order&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; by &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;; 404 if either is missing.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SupplyRequestUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| base + &amp;lt;code&amp;gt;order: UUID4&amp;lt;/code&amp;gt;&lt;br /&gt;
| Resolves &amp;lt;code&amp;gt;order&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; by &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;. Omits &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt; — the catalogue item is fixed once created.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SupplyRequestReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail/list&lt;br /&gt;
| base + &amp;lt;code&amp;gt;quantity: int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;item: dict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;order: dict&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt; expanded via &amp;lt;code&amp;gt;ProductKnowledgeReadSpec&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;order&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;SupplyRequestOrderReadSpec&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Request order specs (&amp;lt;code&amp;gt;request_order.py&amp;lt;/code&amp;gt;) ===&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;
! Fields&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BaseSupplyRequestOrderSpec&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;name&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&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;reason&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;__model__ = RequestOrder&amp;lt;/code&amp;gt;. Coded fields bound to their enums; &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt; optional.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SupplyRequestOrderWriteSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create/update&lt;br /&gt;
| base + &amp;lt;code&amp;gt;supplier: UUID4 | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;origin: UUID4 | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;destination: UUID4&amp;lt;/code&amp;gt;&lt;br /&gt;
| Resolves &amp;lt;code&amp;gt;supplier&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;destination&amp;lt;/code&amp;gt; by &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;. Raises &amp;lt;code&amp;gt;ValidationError&amp;lt;/code&amp;gt; unless &amp;lt;code&amp;gt;supplier.org_type == &amp;amp;quot;product_supplier&amp;amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SupplyRequestOrderReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail/list&lt;br /&gt;
| base + &amp;lt;code&amp;gt;supplier&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;origin: dict | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;destination: dict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;tags: list[dict]&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;, &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;
| &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;supplier&amp;lt;/code&amp;gt; expanded via &amp;lt;code&amp;gt;OrganizationReadSpec&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;destination&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;FacilityLocationListSpec&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;tags&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;SingleFacilityTagManager&amp;lt;/code&amp;gt;; audit users via &amp;lt;code&amp;gt;serialize_audit_users&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Validation and server-maintained behaviour ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;FK resolution.&amp;#039;&amp;#039;&amp;#039; Every foreign key on write comes in as an &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; UUID and is resolved server-side with &amp;lt;code&amp;gt;get_object_or_404&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;order&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;supplier&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;destination&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Supplier type guard.&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;SupplyRequestOrderWriteSpec&amp;lt;/code&amp;gt; rejects any &amp;lt;code&amp;gt;supplier&amp;lt;/code&amp;gt; whose &amp;lt;code&amp;gt;org_type&amp;lt;/code&amp;gt; is not &amp;lt;code&amp;gt;product_supplier&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; handling.&amp;#039;&amp;#039;&amp;#039; Read specs set &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt; never writes &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; back to the row.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;quantity&amp;lt;/code&amp;gt;.&amp;#039;&amp;#039;&amp;#039; Write accepts a &amp;lt;code&amp;gt;Decimal&amp;lt;/code&amp;gt; pinned to &amp;lt;code&amp;gt;decimal_places=0&amp;lt;/code&amp;gt; (whole numbers) even though the DB column allows &amp;lt;code&amp;gt;decimal_places=6&amp;lt;/code&amp;gt;; read returns an &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt; immutability.&amp;#039;&amp;#039;&amp;#039; Create takes &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;SupplyRequestUpdateSpec&amp;lt;/code&amp;gt; drops it, so the requested catalogue item can&amp;#039;t change after creation.&lt;br /&gt;
&lt;br /&gt;
== Methods and save behaviour ==&lt;br /&gt;
&lt;br /&gt;
* Neither model overrides &amp;lt;code&amp;gt;save()&amp;lt;/code&amp;gt;; standard &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt; audit and soft-delete behaviour applies.&lt;br /&gt;
* Status is free-text at the DB layer — the lifecycle is enforced only by the spec enums at the API boundary. Neither model tracks &amp;lt;code&amp;gt;status_history&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Deleting a &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; cascades to its &amp;lt;code&amp;gt;SupplyRequest&amp;lt;/code&amp;gt; rows (the &amp;lt;code&amp;gt;order&amp;lt;/code&amp;gt; FK is &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;); deleting a referenced &amp;lt;code&amp;gt;ProductKnowledge&amp;lt;/code&amp;gt; cascades to the request.&lt;br /&gt;
&lt;br /&gt;
== API integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Payload field names match the spec fields above. Foreign keys go out as &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; UUIDs on write and come back as expanded objects on read.&lt;br /&gt;
* Send &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;priority&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;intent&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; as the exact strings listed above — they&amp;#039;re validated against the spec enums.&lt;br /&gt;
* &amp;lt;code&amp;gt;supplied_item_condition&amp;lt;/code&amp;gt; lives on the model but no current spec surfaces it.&lt;br /&gt;
* &amp;lt;code&amp;gt;quantity&amp;lt;/code&amp;gt; travels as a whole number through the specs; the DB column keeps six decimal places regardless.&lt;br /&gt;
* &amp;lt;code&amp;gt;tags&amp;lt;/code&amp;gt; on &amp;lt;code&amp;gt;RequestOrder&amp;lt;/code&amp;gt; is an integer array of tag IDs, rendered to tag objects on read by the facility tag manager.&lt;br /&gt;
* &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; (from &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;) is the stable public identifier in API URLs — never the internal primary key.&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>