<?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%2FReport_%26_Templates</id>
	<title>References/Report &amp; Templates - 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%2FReport_%26_Templates"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Report_%26_Templates&amp;action=history"/>
	<updated>2026-07-06T05:20: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/Report_%26_Templates&amp;diff=471&amp;oldid=prev</id>
		<title>Admin: Add Navbox platform (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Report_%26_Templates&amp;diff=471&amp;oldid=prev"/>
		<updated>2026-07-06T04:23:55Z</updated>

		<summary type="html">&lt;p&gt;Add Navbox platform (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:53, 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 261:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 261:&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;template_type&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; must form a compatible pair (same &amp;lt;code&amp;gt;associating_model&amp;lt;/code&amp;gt;). The default &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;encounter_base&amp;lt;/code&amp;gt;, so templates target encounters unless changed.&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;template_type&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; must form a compatible pair (same &amp;lt;code&amp;gt;associating_model&amp;lt;/code&amp;gt;). The default &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;encounter_base&amp;lt;/code&amp;gt;, so templates target encounters unless changed.&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;Template.facility&amp;lt;/code&amp;gt; is nullable: null means instance-wide (&amp;lt;code&amp;gt;i-&amp;lt;/code&amp;gt; slug), set means facility-scoped (&amp;lt;code&amp;gt;f-&amp;lt;/code&amp;gt; slug).&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;Template.facility&amp;lt;/code&amp;gt; is nullable: null means instance-wide (&amp;lt;code&amp;gt;i-&amp;lt;/code&amp;gt; slug), set means facility-scoped (&amp;lt;code&amp;gt;f-&amp;lt;/code&amp;gt; slug).&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 platform}}&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/Report_%26_Templates&amp;diff=170&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/Report_%26_Templates&amp;diff=170&amp;oldid=prev"/>
		<updated>2026-07-04T22:45:32Z</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=platform&lt;br /&gt;
|title=Report &amp;amp; Templates&lt;br /&gt;
|order=3&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|model=Report&amp;amp;Templates&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;Template&amp;lt;/code&amp;gt; defines reusable report markup and render options; a &amp;lt;code&amp;gt;ReportUpload&amp;lt;/code&amp;gt; is one generated file (PDF/HTML/etc.) produced from that template and linked to a subject resource. You author templates through the API; report uploads are created for you by the file-upload flow.&lt;br /&gt;
&lt;br /&gt;
Two layers back this:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Storage layer&amp;#039;&amp;#039;&amp;#039; — the Django models (&amp;lt;code&amp;gt;care/emr/models/report/&amp;lt;/code&amp;gt;). Several fields are opaque (&amp;lt;code&amp;gt;TextField&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;); their real shape lives in the spec layer, not the model.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;API layer&amp;#039;&amp;#039;&amp;#039; — the Pydantic resource specs (&amp;lt;code&amp;gt;care/emr/resources/report/&amp;lt;/code&amp;gt;), built on [[References/Base models &amp;amp;amp; conventions|&amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;]]. These define the enums, validation, the structure of the JSON fields, and the read/write schemas the API exposes.&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;
* Models: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/models/report/report_upload.py &amp;lt;code&amp;gt;report_upload.py&amp;lt;/code&amp;gt;], [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/models/report/template.py &amp;lt;code&amp;gt;template.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/report/report_upload/spec.py &amp;lt;code&amp;gt;report/report_upload/spec.py&amp;lt;/code&amp;gt;], [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/report/template/spec.py &amp;lt;code&amp;gt;report/template/spec.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;ReportUpload&amp;lt;/code&amp;gt;&lt;br /&gt;
| An uploaded, generated report file (PDF/HTML/etc.) produced from a &amp;lt;code&amp;gt;Template&amp;lt;/code&amp;gt; and linked to a subject resource via &amp;lt;code&amp;gt;associating_id&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Template&amp;lt;/code&amp;gt;&lt;br /&gt;
| A facility-scoped (or instance-wide) reusable report definition (markup + render options) used to generate reports&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ReportUpload&amp;lt;/code&amp;gt; extends [[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;, &amp;lt;code&amp;gt;meta&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;history&amp;lt;/code&amp;gt; JSON, audit FKs, and soft-delete semantics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Template&amp;lt;/code&amp;gt; extends [[References/Base models &amp;amp;amp; conventions|&amp;lt;code&amp;gt;SlugBaseModel&amp;lt;/code&amp;gt;]], the facility-scoped slug variant (&amp;lt;code&amp;gt;FACILITY_SCOPED = True&amp;lt;/code&amp;gt;, which adds &amp;lt;code&amp;gt;slug&amp;lt;/code&amp;gt; handling on top of the EMR base). Slugs carry a prefix in storage: &amp;lt;code&amp;gt;f-&amp;amp;lt;facility_external_id&amp;amp;gt;-&amp;amp;lt;slug&amp;amp;gt;&amp;lt;/code&amp;gt; when facility-scoped, &amp;lt;code&amp;gt;i-&amp;amp;lt;slug&amp;amp;gt;&amp;lt;/code&amp;gt; when instance-wide (see [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/models/base.py &amp;lt;code&amp;gt;base.py&amp;lt;/code&amp;gt;]).&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;ReportUpload&amp;lt;/code&amp;gt; fields ==&lt;br /&gt;
&lt;br /&gt;
=== Core ===&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=Report&amp;amp;Templates|section=Core|name=template|type=FK → Template (PROTECT)|notes=Template the report was generated from. The template cannot be deleted while reports reference it}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Core|name=name|type=CharField(2000)|notes=Display name of the report. Required in every spec}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Core|name=internal_name|type=CharField(2000)|notes=Randomized storage key, auto-generated on save so the file name never leaks PII (see [[#methods--save-behaviour}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Core|name=associating_id|type=CharField(100)|notes=Non-null. Free-form identifier linking the report to its subject resource (e.g. an encounter)}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Core|name=upload_completed|type=BooleanField|notes=Default &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt;. Flips to &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; once the file upload to storage finishes}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Core|name=report_type|type=CharField(50)|notes=File/content type of the report; also exposed via the &amp;lt;code&amp;gt;file_type&amp;lt;/code&amp;gt; property for &amp;lt;code&amp;gt;S3FilesManager&amp;lt;/code&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Archival ===&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=Report&amp;amp;Templates|section=Archival|name=is_archived|type=BooleanField|notes=Default &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Archival|name=archive_reason|type=TextField|notes=Blank allowed}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Archival|name=archived_datetime|type=DateTimeField|notes=Nullable; set when the report is archived}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Archival|name=archived_by|type=FK → User (PROTECT)|notes=Nullable. &amp;lt;code&amp;gt;related_name=&amp;amp;quot;archived_reports&amp;amp;quot;&amp;lt;/code&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Inherited / metadata ===&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=Report&amp;amp;Templates|section=Inherited / metadata|name=meta|type=JSONField (default {})|notes=Inherited from &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;. Holds &amp;lt;code&amp;gt;mime_type&amp;lt;/code&amp;gt; (surfaced by specs as &amp;lt;code&amp;gt;mime_type&amp;lt;/code&amp;gt;) and other free-form metadata}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Inherited / metadata|name=history|type=JSONField (default {})|notes=Inherited audit history}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Inherited / metadata|name=created_by / updated_by|type=FK → User (SET_NULL)|notes=Inherited audit FKs; serialized as &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;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ReportUpload&amp;lt;/code&amp;gt; declares a class-level &amp;lt;code&amp;gt;files_manager = S3FilesManager(BucketType.REPORT)&amp;lt;/code&amp;gt;. The file body lives in object storage (REPORT bucket), not the database — the model row holds only metadata and the &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt; storage key.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;Template&amp;lt;/code&amp;gt; fields ==&lt;br /&gt;
&lt;br /&gt;
The Django model stores most config as plain strings plus an opaque &amp;lt;code&amp;gt;options&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;. The constraints live in the spec layer: it pins &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;default_format&amp;lt;/code&amp;gt;, and the slug, and validates the structure and mutual compatibility of &amp;lt;code&amp;gt;template_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;options&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 (model)&lt;br /&gt;
! Spec constraint&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=facility|type=FK → Facility (PROTECT, nullable)|notes=&amp;lt;code&amp;gt;UUID4 | None&amp;lt;/code&amp;gt; (write)}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=slug|type=CharField(255)|notes=written via &amp;lt;code&amp;gt;slug_value: SlugType&amp;lt;/code&amp;gt;; read as &amp;lt;code&amp;gt;slug&amp;lt;/code&amp;gt; + parsed &amp;lt;code&amp;gt;slug_config&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=name|type=CharField(255)|notes=&amp;lt;code&amp;gt;str&amp;lt;/code&amp;gt;, required}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=status|type=CharField(255)|notes=&amp;lt;code&amp;gt;TemplateStatusOptions&amp;lt;/code&amp;gt; enum}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=template_data|type=TextField|notes=&amp;lt;code&amp;gt;str&amp;lt;/code&amp;gt;, required (write)}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=template_type|type=CharField(255)|notes=&amp;lt;code&amp;gt;str&amp;lt;/code&amp;gt;, validated against &amp;lt;code&amp;gt;ReportTypeRegistry&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=default_format|type=CharField(255)|notes=&amp;lt;code&amp;gt;TemplateFormatOptions&amp;lt;/code&amp;gt; enum}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=context|type=CharField(100) (default &amp;amp;quot;encounter_base&amp;amp;quot;)|notes=&amp;lt;code&amp;gt;str&amp;lt;/code&amp;gt;, validated against &amp;lt;code&amp;gt;DataPointRegistry&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=description|type=TextField (blank, default &amp;amp;quot;&amp;amp;quot;)|notes=&amp;lt;code&amp;gt;str = &amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Report&amp;amp;Templates|section=Template fields|name=options|type=JSONField (default {})|notes=&amp;lt;code&amp;gt;dict = {}&amp;lt;/code&amp;gt;, validated against the format generator&amp;#039;s &amp;lt;code&amp;gt;options_model&amp;lt;/code&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;TemplateStatusOptions&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; is bound to this enum (&amp;lt;code&amp;gt;care/emr/resources/report/template/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;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;draft&amp;lt;/code&amp;gt;&lt;br /&gt;
| Template being authored, not yet usable&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt;&lt;br /&gt;
| Published, usable for generating reports&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;retired&amp;lt;/code&amp;gt;&lt;br /&gt;
| Withdrawn from use&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;TemplateFormatOptions&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;default_format&amp;lt;/code&amp;gt; is bound to this enum:&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;pdf&amp;lt;/code&amp;gt;&lt;br /&gt;
| Render to PDF (uses the PDF generator&amp;#039;s &amp;lt;code&amp;gt;options_model&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;html&amp;lt;/code&amp;gt;&lt;br /&gt;
| Render to HTML (uses the HTML generator&amp;#039;s &amp;lt;code&amp;gt;options_model&amp;lt;/code&amp;gt;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;slug_config&amp;lt;/code&amp;gt; shape (read) ===&lt;br /&gt;
&lt;br /&gt;
On read, &amp;lt;code&amp;gt;TemplateReadSpec&amp;lt;/code&amp;gt; parses the stored prefixed slug back into a &amp;lt;code&amp;gt;slug_config&amp;lt;/code&amp;gt; dict:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;slug_config (facility-scoped) → { facility: &amp;lt;facility_external_id&amp;gt;, slug_value: &amp;lt;slug&amp;gt; }&lt;br /&gt;
slug_config (instance-wide)   → { slug_value: &amp;lt;slug&amp;gt; }   # parsed from &amp;quot;i-&amp;lt;slug&amp;gt;&amp;quot;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Resource specs (API schema) ==&lt;br /&gt;
&lt;br /&gt;
All specs subclass [[References/Base models &amp;amp;amp; conventions|&amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;]]. Read runs &amp;lt;code&amp;gt;serialize()&amp;lt;/code&amp;gt; → DB-field copy → &amp;lt;code&amp;gt;perform_extra_serialization()&amp;lt;/code&amp;gt; hook. Write runs &amp;lt;code&amp;gt;de_serialize()&amp;lt;/code&amp;gt; → DB-field copy → &amp;lt;code&amp;gt;perform_extra_deserialization()&amp;lt;/code&amp;gt; hook.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ReportUpload&amp;lt;/code&amp;gt; specs (&amp;lt;code&amp;gt;report/report_upload/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 / behaviour&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ReportUploadBaseSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared&lt;br /&gt;
| &amp;lt;code&amp;gt;id: UUID4 | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;name: str&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ReportUploadListSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;template&amp;lt;/code&amp;gt; (nested &amp;lt;code&amp;gt;TemplateReadSpec&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;report_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;associating_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;archived_by&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;archived_datetime&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;upload_completed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;is_archived&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;archive_reason&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_date&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;extension&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;uploaded_by&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mime_type&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ReportUploadRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail&lt;br /&gt;
| Extends list spec; adds &amp;lt;code&amp;gt;signed_url&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;read_signed_url&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Server-maintained read behaviour (&amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; ← &amp;lt;code&amp;gt;obj.external_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;extension&amp;lt;/code&amp;gt; ← &amp;lt;code&amp;gt;obj.get_extension()&amp;lt;/code&amp;gt; (dotted extension parsed from &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;mime_type&amp;lt;/code&amp;gt; ← &amp;lt;code&amp;gt;obj.meta[&amp;amp;quot;mime_type&amp;amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;template&amp;lt;/code&amp;gt; ← serialized via &amp;lt;code&amp;gt;TemplateReadSpec&amp;lt;/code&amp;gt; (full nested template object).&lt;br /&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; populated from the user cache via &amp;lt;code&amp;gt;serialize_audit_users&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Signed URLs (retrieve only):&amp;#039;&amp;#039;&amp;#039; a freshly created object (&amp;lt;code&amp;gt;_just_created&amp;lt;/code&amp;gt;) gets a write/upload &amp;lt;code&amp;gt;signed_url&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;files_manager.signed_url(obj)&amp;lt;/code&amp;gt;; any other read gets a &amp;lt;code&amp;gt;read_signed_url&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;files_manager.read_signed_url(obj)&amp;lt;/code&amp;gt;. Exactly one is populated per response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;ReportUpload&amp;lt;/code&amp;gt; has no &amp;lt;code&amp;gt;CreateSpec&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;UpdateSpec&amp;lt;/code&amp;gt; in this module. Uploads come from the file-upload flow ([[References/File Upload]]), and the report metadata and &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt; are platform-maintained. See [[#methods--save-behaviour|save behaviour]].&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
=== &amp;lt;code&amp;gt;Template&amp;lt;/code&amp;gt; specs (&amp;lt;code&amp;gt;report/template/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 / behaviour&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TemplateBaseSpec&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;name&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;TemplateStatusOptions&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;default_format&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;TemplateFormatOptions&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;description = &amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;options = {}&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;__exclude__ = [&amp;amp;quot;facility&amp;amp;quot;]&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TemplateCreateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;facility: UUID4 | None&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;slug_value: SlugType&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;template_data: str&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;template_type: str&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;context: str&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TemplateUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| Identical to &amp;lt;code&amp;gt;TemplateCreateSpec&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;pass&amp;lt;/code&amp;gt; subclass)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TemplateReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list&lt;br /&gt;
| Base fields + &amp;lt;code&amp;gt;slug_config: dict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;slug: str&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;template_type: str&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;context: str&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;template_data&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TemplateRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail&lt;br /&gt;
| Extends read spec; adds nested &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;FacilityBareMinimumSpec&amp;lt;/code&amp;gt;) and &amp;lt;code&amp;gt;template_data: str&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Write-side validation and side effects (&amp;lt;code&amp;gt;TemplateCreateSpec&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;slug_value&amp;lt;/code&amp;gt; — &amp;lt;code&amp;gt;SlugType&amp;lt;/code&amp;gt;: 5–50 chars, pattern &amp;lt;code&amp;gt;^[a-zA-Z0-9][a-zA-Z0-9_-]*[a-zA-Z0-9]$&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;template_type&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;field_validator&amp;lt;/code&amp;gt;) — non-empty and resolvable via &amp;lt;code&amp;gt;ReportTypeRegistry&amp;lt;/code&amp;gt;, else &amp;lt;code&amp;gt;Invalid report type&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;field_validator&amp;lt;/code&amp;gt;) — non-empty and resolvable via &amp;lt;code&amp;gt;DataPointRegistry&amp;lt;/code&amp;gt;, else &amp;lt;code&amp;gt;Invalid Context type&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;validate_report_type_and_context&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;model_validator&amp;lt;/code&amp;gt;, after):&lt;br /&gt;
** both &amp;lt;code&amp;gt;template_type&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; must resolve, else &amp;lt;code&amp;gt;Invalid report type or context&amp;lt;/code&amp;gt;;&lt;br /&gt;
** their &amp;lt;code&amp;gt;associating_model&amp;lt;/code&amp;gt; must match (&amp;lt;code&amp;gt;template_type.associating_model == context.__associating_model__&amp;lt;/code&amp;gt;), else &amp;lt;code&amp;gt;Report Type and Context are not compatible&amp;lt;/code&amp;gt;;&lt;br /&gt;
** &amp;lt;code&amp;gt;options&amp;lt;/code&amp;gt; is validated against &amp;lt;code&amp;gt;GeneratorRegistry.get(default_format).options_model&amp;lt;/code&amp;gt;, so the allowed &amp;lt;code&amp;gt;options&amp;lt;/code&amp;gt; keys depend on whether &amp;lt;code&amp;gt;default_format&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;pdf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;html&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; (side effects): resolves &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt; external ID to the &amp;lt;code&amp;gt;Facility&amp;lt;/code&amp;gt; row (&amp;lt;code&amp;gt;get_object_or_404&amp;lt;/code&amp;gt;) when provided, and sets &amp;lt;code&amp;gt;obj.slug = self.slug_value&amp;lt;/code&amp;gt; (the raw value; the model prefixes it in &amp;lt;code&amp;gt;calculate_slug&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Read-side behaviour:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;TemplateReadSpec.perform_extra_serialization&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;id ← external_id&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;slug_config ← obj.parse_slug(obj.slug)&amp;lt;/code&amp;gt; (see [[#slug_config-shape-read|&amp;lt;code&amp;gt;slug_config&amp;lt;/code&amp;gt; shape]]).&lt;br /&gt;
* &amp;lt;code&amp;gt;TemplateRetrieveSpec&amp;lt;/code&amp;gt;: additionally serializes &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;FacilityBareMinimumSpec&amp;lt;/code&amp;gt; when set.&lt;br /&gt;
&lt;br /&gt;
== Methods &amp;amp;amp; save behaviour ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ReportUpload.save()&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
On create (no &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;) or when &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt; is empty, &amp;lt;code&amp;gt;save()&amp;lt;/code&amp;gt; generates a random &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;uuid4()&amp;lt;/code&amp;gt; plus the current epoch. This intermediate name decouples the stored object from the human-readable &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, so a storage or data leak never exposes PII in file names.&lt;br /&gt;
&lt;br /&gt;
* Pass &amp;lt;code&amp;gt;skip_internal_name=True&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;save()&amp;lt;/code&amp;gt; to bypass generation and keep an explicitly set &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt;.&lt;br /&gt;
* If &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt; already held a value, its file extension is parsed (via &amp;lt;code&amp;gt;parse_file_extension&amp;lt;/code&amp;gt;) and appended to the new randomized name.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ReportUpload.get_extension()&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Returns the dotted extension(s) parsed from &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt; (e.g. &amp;lt;code&amp;gt;.pdf&amp;lt;/code&amp;gt;), or &amp;lt;code&amp;gt;&amp;amp;quot;&amp;amp;quot;&amp;lt;/code&amp;gt; if none. Surfaced as the &amp;lt;code&amp;gt;extension&amp;lt;/code&amp;gt; field in read specs.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ReportUpload.file_type&amp;lt;/code&amp;gt; (property) ===&lt;br /&gt;
&lt;br /&gt;
Alias for &amp;lt;code&amp;gt;report_type&amp;lt;/code&amp;gt;, kept for compatibility with &amp;lt;code&amp;gt;S3FilesManager&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;Template&amp;lt;/code&amp;gt; slug methods (inherited from &amp;lt;code&amp;gt;SlugBaseModel&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;calculate_slug()&amp;lt;/code&amp;gt; — returns the prefixed slug: &amp;lt;code&amp;gt;f-&amp;amp;lt;facility.external_id&amp;amp;gt;-&amp;amp;lt;slug&amp;amp;gt;&amp;lt;/code&amp;gt; when facility-scoped, else &amp;lt;code&amp;gt;i-&amp;amp;lt;slug&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;parse_slug(slug)&amp;lt;/code&amp;gt; — the inverse; returns &amp;lt;code&amp;gt;slug_config&amp;lt;/code&amp;gt; (used by &amp;lt;code&amp;gt;TemplateReadSpec&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== API integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Report files live in object storage (S3-compatible REPORT bucket) and are read through &amp;lt;code&amp;gt;S3FilesManager&amp;lt;/code&amp;gt;; the database row is metadata only.&lt;br /&gt;
* &amp;lt;code&amp;gt;internal_name&amp;lt;/code&amp;gt; is platform-maintained — never set it from a client. Reserve &amp;lt;code&amp;gt;skip_internal_name&amp;lt;/code&amp;gt; for controlled migrations. It is exposed only via &amp;lt;code&amp;gt;ReportUploadRetrieveSpec&amp;lt;/code&amp;gt;.&lt;br /&gt;
* A freshly created report returns an upload &amp;lt;code&amp;gt;signed_url&amp;lt;/code&amp;gt;; subsequent reads return a &amp;lt;code&amp;gt;read_signed_url&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
* Treat a report as available only once &amp;lt;code&amp;gt;upload_completed&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Populate &amp;lt;code&amp;gt;associating_id&amp;lt;/code&amp;gt; when generating a report so the file can be retrieved in its subject resource&amp;#039;s context.&lt;br /&gt;
* &amp;lt;code&amp;gt;Template.options&amp;lt;/code&amp;gt; is validated server-side against the chosen format&amp;#039;s generator schema, not an arbitrary bag; valid keys depend on &amp;lt;code&amp;gt;default_format&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;pdf&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;html&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;template_type&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; must form a compatible pair (same &amp;lt;code&amp;gt;associating_model&amp;lt;/code&amp;gt;). The default &amp;lt;code&amp;gt;context&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;encounter_base&amp;lt;/code&amp;gt;, so templates target encounters unless changed.&lt;br /&gt;
* &amp;lt;code&amp;gt;Template.facility&amp;lt;/code&amp;gt; is nullable: null means instance-wide (&amp;lt;code&amp;gt;i-&amp;lt;/code&amp;gt; slug), set means facility-scoped (&amp;lt;code&amp;gt;f-&amp;lt;/code&amp;gt; slug).&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>