<?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%2FSchedule_%26_Availability</id>
	<title>References/Schedule &amp; Availability - 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%2FSchedule_%26_Availability"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Schedule_%26_Availability&amp;action=history"/>
	<updated>2026-07-06T05:23:06Z</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/Schedule_%26_Availability&amp;diff=459&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/Schedule_%26_Availability&amp;diff=459&amp;oldid=prev"/>
		<updated>2026-07-06T04:19:19Z</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:49, 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 328:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 328:&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;* When reading a &amp;lt;code&amp;gt;SchedulableResource&amp;lt;/code&amp;gt;, dispatch on &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt; to pick the populated relation (&amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;healthcare_service&amp;lt;/code&amp;gt;) — only one is set, and you can&#039;t assume which.&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;* When reading a &amp;lt;code&amp;gt;SchedulableResource&amp;lt;/code&amp;gt;, dispatch on &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt; to pick the populated relation (&amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;healthcare_service&amp;lt;/code&amp;gt;) — only one is set, and you can&#039;t assume which.&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;* A &amp;lt;code&amp;gt;ChargeItemDefinition&amp;lt;/code&amp;gt; referenced by a schedule can&#039;t be deleted while the schedule exists (&amp;lt;code&amp;gt;PROTECT&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;* A &amp;lt;code&amp;gt;ChargeItemDefinition&amp;lt;/code&amp;gt; referenced by a schedule can&#039;t be deleted while the schedule exists (&amp;lt;code&amp;gt;PROTECT&amp;lt;/code&amp;gt;).&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 scheduling}}&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/Schedule_%26_Availability&amp;diff=175&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/Schedule_%26_Availability&amp;diff=175&amp;oldid=prev"/>
		<updated>2026-07-04T22:45:40Z</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=scheduling&lt;br /&gt;
|title=Schedule &amp;amp; Availability&lt;br /&gt;
|order=1&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|model=Schedule&amp;amp;Availability&lt;br /&gt;
|reference=References/User &amp;amp;amp; Skills&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
A schedule is a repeatable block of time during which a resource — a practitioner, location, or healthcare service — can be booked. You attach availabilities to it (these decide how the block splits into slots) and exceptions that block out specific dates.&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/scheduling/schedule.py &amp;lt;code&amp;gt;care/emr/models/scheduling/schedule.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Resource specs: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/scheduling/schedule/spec.py &amp;lt;code&amp;gt;schedule/spec.py&amp;lt;/code&amp;gt;], [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/scheduling/availability_exception/spec.py &amp;lt;code&amp;gt;availability_exception/spec.py&amp;lt;/code&amp;gt;], [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/scheduling/resource/spec.py &amp;lt;code&amp;gt;resource/spec.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
The Django model (&amp;lt;code&amp;gt;care/emr/models/scheduling/schedule.py&amp;lt;/code&amp;gt;) is storage only, down to the opaque &amp;lt;code&amp;gt;Availability.availability&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;. The contract lives in the Pydantic resource specs (&amp;lt;code&amp;gt;care/emr/resources/scheduling/...&amp;lt;/code&amp;gt;): the enums, the real shape of that JSON field, the validation rules, and the separate read/write schemas. Everything below &amp;lt;code&amp;gt;## Models&amp;lt;/code&amp;gt; describes the specs.&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;SchedulableResource&amp;lt;/code&amp;gt;&lt;br /&gt;
| A bookable resource (a user, location, or healthcare service) within a facility&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Schedule&amp;lt;/code&amp;gt;&lt;br /&gt;
| A named, date-bounded block of availability attached to a resource&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Availability&amp;lt;/code&amp;gt;&lt;br /&gt;
| Slot configuration for a schedule (slot size, tokens, weekly recurrence)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityException&amp;lt;/code&amp;gt;&lt;br /&gt;
| A date/time range that blocks a resource (leave, holidays)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All four 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;Schedule&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;
! Req.&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=Schedule&amp;amp;Availability|section=Schedule fields|name=resource|type=FK → SchedulableResource (CASCADE)|notes=server}}&lt;br /&gt;
{{Field|model=Schedule&amp;amp;Availability|section=Schedule fields|name=name|type=CharField(255)|notes=yes}}&lt;br /&gt;
{{Field|model=Schedule&amp;amp;Availability|section=Schedule fields|name=valid_from|type=DateTimeField|notes=yes}}&lt;br /&gt;
{{Field|model=Schedule&amp;amp;Availability|section=Schedule fields|name=valid_to|type=DateTimeField|notes=yes}}&lt;br /&gt;
{{Field|model=Schedule&amp;amp;Availability|section=Schedule fields|name=revisit_allowed_days|type=IntegerField|notes=no}}&lt;br /&gt;
{{Field|model=Schedule&amp;amp;Availability|section=Schedule fields|name=is_public|type=BooleanField|notes=yes}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Billing links ===&lt;br /&gt;
&lt;br /&gt;
Both charge links are set only through the &amp;lt;code&amp;gt;set_charge_item_definition&amp;lt;/code&amp;gt; action (see [[#resource-specs-api-schema|Resource specs]]) — never the create/update body.&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=Schedule&amp;amp;Availability|section=Billing links|name=charge_item_definition|type=FK → ChargeItemDefinition (PROTECT)|notes=Nullable; charge applied to bookings against this schedule. &amp;lt;code&amp;gt;related_name=&amp;amp;quot;schedule_charge_item_definition&amp;amp;quot;&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Schedule&amp;amp;Availability|section=Billing links|name=revisit_charge_item_definition|type=FK → ChargeItemDefinition (PROTECT)|notes=Nullable; charge applied when a booking falls within &amp;lt;code&amp;gt;revisit_allowed_days&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;related_name=&amp;amp;quot;schedule_revisit_charge_item_definition&amp;amp;quot;&amp;lt;/code&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Enums ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;SchedulableResourceTypeOptions&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Discriminates the kind of entity a schedule or exception attaches to. On write, send it as &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;; the matching &amp;lt;code&amp;gt;resource_id&amp;lt;/code&amp;gt; is that entity&amp;#039;s &amp;lt;code&amp;gt;external_id&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;
! Resolves to&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;practitioner&amp;lt;/code&amp;gt;&lt;br /&gt;
| A [[References/User &amp;amp;amp; Skills&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt;&lt;br /&gt;
| A &amp;lt;code&amp;gt;FacilityLocation&amp;lt;/code&amp;gt; in the facility (serialized via &amp;lt;code&amp;gt;FacilityLocationListSpec&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;healthcare_service&amp;lt;/code&amp;gt;&lt;br /&gt;
| A [[References/Healthcare Service&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;SchedulableResource.resource_type&amp;lt;/code&amp;gt; model column defaults to the string &amp;lt;code&amp;gt;&amp;amp;quot;practitioner&amp;amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;SlotTypeOptions&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The type of an individual &amp;lt;code&amp;gt;Availability&amp;lt;/code&amp;gt; block (&amp;lt;code&amp;gt;Availability.slot_type&amp;lt;/code&amp;gt; on the model, &amp;lt;code&amp;gt;slot_type&amp;lt;/code&amp;gt; in the spec).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;open&amp;lt;/code&amp;gt;&lt;br /&gt;
| Open block; &amp;lt;code&amp;gt;slot_size_in_minutes&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;tokens_per_slot&amp;lt;/code&amp;gt; are cleared to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; on save&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;appointment&amp;lt;/code&amp;gt;&lt;br /&gt;
| Time-precise appointment block; requires both &amp;lt;code&amp;gt;slot_size_in_minutes&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;tokens_per_slot&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;closed&amp;lt;/code&amp;gt;&lt;br /&gt;
| Closed block; &amp;lt;code&amp;gt;slot_size_in_minutes&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;tokens_per_slot&amp;lt;/code&amp;gt; are cleared to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; on save&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Related models ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;SchedulableResource&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The bookable entity within a facility, and the join point that booking hangs off. Exactly one of &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;healthcare_service&amp;lt;/code&amp;gt; points at the underlying resource; &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt; says which. You never create one directly: &amp;lt;code&amp;gt;Schedule&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AvailabilityException&amp;lt;/code&amp;gt; writes call &amp;lt;code&amp;gt;get_or_create_resource(resource_type, resource_id, facility)&amp;lt;/code&amp;gt; server-side, which checks the target belongs to the facility first.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;facility            → FK Facility (CASCADE)&lt;br /&gt;
resource_type       → CharField(255), default &amp;quot;practitioner&amp;quot;&lt;br /&gt;
user                → FK User (CASCADE, nullable)&lt;br /&gt;
location            → FK FacilityLocation (CASCADE, nullable)&lt;br /&gt;
healthcare_service  → FK HealthcareService (CASCADE, nullable)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Three &amp;lt;code&amp;gt;UniqueConstraint&amp;lt;/code&amp;gt;s keep one &amp;lt;code&amp;gt;SchedulableResource&amp;lt;/code&amp;gt; per facility, &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;, and target:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Constraint&lt;br /&gt;
! Fields&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;unique_facility_resource_user&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;unique_facility_resource_location&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;unique_facility_resource_healthcare_service&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;healthcare_service&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
On read, &amp;lt;code&amp;gt;serialize_resource(obj)&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;resource/spec.py&amp;lt;/code&amp;gt;) dispatches on &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;HealthcareServiceReadSpec&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;FacilityLocationListSpec&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;Availability&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Decides how a schedule&amp;#039;s time divides into bookable slots. One schedule can carry several availabilities — say, a morning block and an afternoon block.&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;
! Req.&lt;br /&gt;
! Spec detail&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;schedule&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK Schedule&amp;lt;/code&amp;gt; (CASCADE)&lt;br /&gt;
| server&lt;br /&gt;
| Excluded from the availability spec; set from the URL / parent schedule&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CharField(255)&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| Block name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;slot_type&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CharField&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| One of [[#slottypeoptions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;slot_size_in_minutes&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;IntegerField&amp;lt;/code&amp;gt; (nullable)&lt;br /&gt;
| conditional&lt;br /&gt;
| &amp;lt;code&amp;gt;int | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ge=1&amp;lt;/code&amp;gt;. Required when &amp;lt;code&amp;gt;slot_type == appointment&amp;lt;/code&amp;gt;; forced to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; otherwise&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;tokens_per_slot&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;IntegerField&amp;lt;/code&amp;gt; (nullable)&lt;br /&gt;
| conditional&lt;br /&gt;
| &amp;lt;code&amp;gt;int | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ge=1&amp;lt;/code&amp;gt;. Capacity per slot. Required when &amp;lt;code&amp;gt;slot_type == appointment&amp;lt;/code&amp;gt;; forced to &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; otherwise&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;create_tokens&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;BooleanField&amp;lt;/code&amp;gt;&lt;br /&gt;
| no&lt;br /&gt;
| Default &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt;. When &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt;, each booking gets a token (queue/token workflows)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;TextField&amp;lt;/code&amp;gt; (nullable)&lt;br /&gt;
| no&lt;br /&gt;
| Spec default &amp;lt;code&amp;gt;&amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;availability&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;dict&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| Despite the &amp;lt;code&amp;gt;dict&amp;lt;/code&amp;gt; default, the spec models it as a &amp;lt;code&amp;gt;list[AvailabilityDateTimeSpec]&amp;lt;/code&amp;gt; (weekly recurrence). See below&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;availability&amp;lt;/code&amp;gt; JSON shape — &amp;lt;code&amp;gt;AvailabilityDateTimeSpec&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
Each entry is one weekly recurrence window. The field stores a list of these objects, not a single dict.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;AvailabilityDateTimeSpec {&lt;br /&gt;
  day_of_week: int   # 0–6, validated le=6 (Monday=0 … Sunday=6, ISO-style)&lt;br /&gt;
  start_time: time   # HH:MM:SS&lt;br /&gt;
  end_time:   time   # HH:MM:SS&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The list is validated by &amp;lt;code&amp;gt;AvailabilityForScheduleSpec.validate_availability&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;validate_for_slot_type&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Every entry needs &amp;lt;code&amp;gt;start_time &amp;amp;lt; end_time&amp;lt;/code&amp;gt; (strict).&lt;br /&gt;
* No two entries on the &amp;#039;&amp;#039;&amp;#039;same&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;day_of_week&amp;lt;/code&amp;gt; may overlap (&amp;lt;code&amp;gt;has_overlapping_availability&amp;lt;/code&amp;gt;: ranges overlap when &amp;lt;code&amp;gt;a.start ≤ b.end and b.start ≤ a.end&amp;lt;/code&amp;gt;). On create, overlap is checked across all availabilities of the same schedule.&lt;br /&gt;
* For &amp;lt;code&amp;gt;slot_type == appointment&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;slot_size_in_minutes&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;tokens_per_slot&amp;lt;/code&amp;gt; are mandatory, each window&amp;#039;s duration must be an exact multiple of &amp;lt;code&amp;gt;slot_size_in_minutes&amp;lt;/code&amp;gt;, and the resulting slot count must not exceed &amp;lt;code&amp;gt;settings.MAX_SLOTS_PER_AVAILABILITY&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;30&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;AvailabilityException&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Blocks a resource for a date/time range regardless of its schedules — leave, holidays, one-off closures.&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;
! Req.&lt;br /&gt;
! Spec detail&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;resource&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK SchedulableResource&amp;lt;/code&amp;gt; (CASCADE)&lt;br /&gt;
| server&lt;br /&gt;
| Resolved from &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;resource_id&amp;lt;/code&amp;gt; (get-or-create); excluded from the spec body&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CharField(255)&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| Exception name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;TextField&amp;lt;/code&amp;gt; (nullable)&lt;br /&gt;
| no&lt;br /&gt;
| &amp;lt;code&amp;gt;str | None&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;valid_from&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;DateField&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt;. Must be ≥ today and ≤ &amp;lt;code&amp;gt;valid_to&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;valid_to&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;DateField&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt;. Must be ≥ today&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;start_time&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;TimeField&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;code&amp;gt;time&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;end_time&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;TimeField&amp;lt;/code&amp;gt;&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;code&amp;gt;time&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;code&amp;gt;EMRResource&amp;lt;/code&amp;gt; ([&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/base.py &amp;lt;code&amp;gt;base.py&amp;lt;/code&amp;gt;]), which provides &amp;lt;code&amp;gt;serialize()&amp;lt;/code&amp;gt; (DB → pydantic), &amp;lt;code&amp;gt;de_serialize()&amp;lt;/code&amp;gt; (pydantic → DB), and 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;__exclude__&amp;lt;/code&amp;gt; lists fields skipped during (de)serialization.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Spec&lt;br /&gt;
! Role&lt;br /&gt;
! Exposes / behaviour&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ScheduleBaseSpec&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;is_public&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;__exclude__ = [&amp;amp;quot;resource&amp;amp;quot;, &amp;amp;quot;facility&amp;amp;quot;]&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ScheduleCreateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;valid_from&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;valid_to&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;availabilities: list[AvailabilityForScheduleSpec]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resource_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;is_public&amp;lt;/code&amp;gt;. Validates dates ≥ now, &amp;lt;code&amp;gt;valid_from ≤ valid_to&amp;lt;/code&amp;gt;, and cross-availability non-overlap. &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; stashes &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;_resource_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;_resource_type&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;availabilities&amp;lt;/code&amp;gt; on the instance for the viewset&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ScheduleUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;valid_from&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;valid_to&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;is_public&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; blocks narrowing validity that would drop allocated slots — it compares &amp;lt;code&amp;gt;Sum(TokenSlot.allocated)&amp;lt;/code&amp;gt; across the old vs new range and raises if they differ&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ScheduleReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list + detail&lt;br /&gt;
| All of the above plus &amp;lt;code&amp;gt;availabilities&amp;lt;/code&amp;gt; (re-serialized from &amp;lt;code&amp;gt;Availability&amp;lt;/code&amp;gt; rows), &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;charge_item_definition&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;revisit_charge_item_definition&amp;lt;/code&amp;gt; (full &amp;lt;code&amp;gt;ChargeItemDefinitionReadSpec&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;revisit_allowed_days&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;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityBaseSpec&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;__exclude__ = [&amp;amp;quot;schedule&amp;amp;quot;]&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityForScheduleSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write/read (nested in schedule)&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;slot_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;slot_size_in_minutes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;tokens_per_slot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;create_tokens&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;availability: list[AvailabilityDateTimeSpec]&amp;lt;/code&amp;gt;. Carries the availability + slot-type validators&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityCreateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create (standalone)&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;schedule: UUID4&amp;lt;/code&amp;gt;; on create, re-checks overlap against all existing availabilities of that schedule&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityDateTimeSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| nested&lt;br /&gt;
| &amp;lt;code&amp;gt;day_of_week&amp;lt;/code&amp;gt; (le=6), &amp;lt;code&amp;gt;start_time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;end_time&amp;lt;/code&amp;gt; — the shape of the &amp;lt;code&amp;gt;availability&amp;lt;/code&amp;gt; JSON field&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityExceptionBaseSpec&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;reason&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;valid_from&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;valid_to&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;start_time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;end_time&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;__exclude__ = [&amp;amp;quot;resource&amp;amp;quot;, &amp;amp;quot;facility&amp;amp;quot;]&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityExceptionWriteSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create/upsert&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resource_id&amp;lt;/code&amp;gt;. Validates dates ≥ today and &amp;lt;code&amp;gt;valid_from ≤ valid_to&amp;lt;/code&amp;gt;; stashes &amp;lt;code&amp;gt;_resource_type&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;_resource_id&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AvailabilityExceptionReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list + detail&lt;br /&gt;
| Base fields; &amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt; maps &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ChargeItemDefinitionSetSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write (action body)&lt;br /&gt;
| &amp;lt;code&amp;gt;charge_item_definition: str | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;re_visit_allowed_days: int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;re_visit_charge_item_definition: str | None&amp;lt;/code&amp;gt; — body for &amp;lt;code&amp;gt;POST .../set_charge_item_definition&amp;lt;/code&amp;gt; (charge fields resolved by &amp;lt;code&amp;gt;slug&amp;lt;/code&amp;gt; within the facility)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Server-maintained behaviour (viewset hooks) ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Resource resolution.&amp;#039;&amp;#039;&amp;#039; On schedule or exception create, &amp;lt;code&amp;gt;get_or_create_resource(resource_type, resource_id, facility)&amp;lt;/code&amp;gt; checks the target is in the facility (a practitioner must be a &amp;lt;code&amp;gt;FacilityOrganizationUser&amp;lt;/code&amp;gt;; a location or healthcare service must belong to the facility), then gets-or-creates the &amp;lt;code&amp;gt;SchedulableResource&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt; is injected from the URL via &amp;lt;code&amp;gt;clean_create_data&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Nested availability create.&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;ScheduleViewSet.perform_create&amp;lt;/code&amp;gt; (atomic) sets &amp;lt;code&amp;gt;resource&amp;lt;/code&amp;gt;, saves the schedule, then de-serializes and saves each &amp;lt;code&amp;gt;availability&amp;lt;/code&amp;gt; linked to it.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Charge items.&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;revisit_allowed_days&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;charge_item_definition&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;revisit_charge_item_definition&amp;lt;/code&amp;gt; move only through the &amp;lt;code&amp;gt;set_charge_item_definition&amp;lt;/code&amp;gt; detail action, never the create/update body.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Locking + slot guards.&amp;#039;&amp;#039;&amp;#039; Update and destroy take a &amp;lt;code&amp;gt;Lock(&amp;amp;quot;booking:resource:&amp;amp;lt;id&amp;amp;gt;&amp;amp;quot;)&amp;lt;/code&amp;gt;. Deleting a schedule or availability is rejected when future allocated &amp;lt;code&amp;gt;TokenSlot&amp;lt;/code&amp;gt;s exist; otherwise availabilities and slots are soft-deleted (&amp;lt;code&amp;gt;deleted=True&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Exception slot clearing.&amp;#039;&amp;#039;&amp;#039; Creating an &amp;lt;code&amp;gt;AvailabilityException&amp;lt;/code&amp;gt; soft-deletes overlapping &amp;lt;code&amp;gt;TokenSlot&amp;lt;/code&amp;gt;s, but rejects the request if any are already allocated (&amp;amp;quot;There are bookings during this exception&amp;amp;quot;).&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;List requires resource.&amp;#039;&amp;#039;&amp;#039; The &amp;lt;code&amp;gt;Schedule&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AvailabilityException&amp;lt;/code&amp;gt; list endpoints require &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;resource_id&amp;lt;/code&amp;gt; query params and scope results to that &amp;lt;code&amp;gt;SchedulableResource&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Slots are computed from &amp;lt;code&amp;gt;Availability&amp;lt;/code&amp;gt; at read time, not stored as rows on the schedule.&lt;br /&gt;
* When reading a &amp;lt;code&amp;gt;SchedulableResource&amp;lt;/code&amp;gt;, dispatch on &amp;lt;code&amp;gt;resource_type&amp;lt;/code&amp;gt; to pick the populated relation (&amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;healthcare_service&amp;lt;/code&amp;gt;) — only one is set, and you can&amp;#039;t assume which.&lt;br /&gt;
* A &amp;lt;code&amp;gt;ChargeItemDefinition&amp;lt;/code&amp;gt; referenced by a schedule can&amp;#039;t be deleted while the schedule exists (&amp;lt;code&amp;gt;PROTECT&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>