<?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%2FDiagnostic_Report</id>
	<title>References/Diagnostic Report - 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%2FDiagnostic_Report"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Diagnostic_Report&amp;action=history"/>
	<updated>2026-07-06T07:11:31Z</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/Diagnostic_Report&amp;diff=410&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/Diagnostic_Report&amp;diff=410&amp;oldid=prev"/>
		<updated>2026-07-06T04:03:31Z</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:33, 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 222:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 222:&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;note&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;conclusion&amp;lt;/code&amp;gt; carry human-readable narrative and are not parsed by the platform.&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;note&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;conclusion&amp;lt;/code&amp;gt; carry human-readable narrative and are not parsed by the 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;div&gt;* The detail (&amp;lt;code&amp;gt;Retrieve&amp;lt;/code&amp;gt;) payload embeds the linked service request, its requester, the encounter (with patient), audit users, and all child observations — none of which are writable.&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;* The detail (&amp;lt;code&amp;gt;Retrieve&amp;lt;/code&amp;gt;) payload embeds the linked service request, its requester, the encounter (with patient), audit users, and all child observations — none of which are writable.&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 clinical}}&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;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;Wiki: ohcnwiki.tellmey.fyi&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-140:rev-410:wikidiff2=table:1.14.2:bc2a06be --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=References/Diagnostic_Report&amp;diff=140&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/Diagnostic_Report&amp;diff=140&amp;oldid=prev"/>
		<updated>2026-07-04T22:44:20Z</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=clinical&lt;br /&gt;
|title=Diagnostic Report&lt;br /&gt;
|order=7&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|fhir=DiagnosticReport&lt;br /&gt;
|model=DiagnosticReport&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;DiagnosticReport&amp;lt;/code&amp;gt; records the results and interpretation of a diagnostic test, tied to the &amp;lt;code&amp;gt;ServiceRequest&amp;lt;/code&amp;gt; that ordered it. You create one to report on an investigation, then read it back with its observations, encounter, and requester embedded.&lt;br /&gt;
&lt;br /&gt;
The Django model (&amp;lt;code&amp;gt;care/emr/models/diagnostic_report.py&amp;lt;/code&amp;gt;) imposes no shape: it persists &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; as opaque &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;s and &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; as a free &amp;lt;code&amp;gt;CharField&amp;lt;/code&amp;gt;. Shape and validation come from the Pydantic resource specs (&amp;lt;code&amp;gt;care/emr/resources/diagnostic_report/&amp;lt;/code&amp;gt;) — the status enum, the coded-concept structure, the bound value sets, and the separate read/write API schemas. The specs build on &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt; and serialize between the API and the model.&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/diagnostic_report.py &amp;lt;code&amp;gt;care/emr/models/diagnostic_report.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/diagnostic_report/spec.py &amp;lt;code&amp;gt;care/emr/resources/diagnostic_report/spec.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Valueset: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/diagnostic_report/valueset.py &amp;lt;code&amp;gt;care/emr/resources/diagnostic_report/valueset.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;DiagnosticReport&amp;lt;/code&amp;gt;&lt;br /&gt;
| Results and interpretation of a diagnostic test or investigation, tied to a &amp;lt;code&amp;gt;ServiceRequest&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DiagnosticReport&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 that provides &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;DiagnosticReport&amp;lt;/code&amp;gt; fields ==&lt;br /&gt;
&lt;br /&gt;
=== Classification ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Model type&lt;br /&gt;
! Spec shape&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CharField(255)&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;DiagnosticReportStatusChoices&amp;lt;/code&amp;gt; (enum, required)&lt;br /&gt;
| Lifecycle status. Stored as free text but constrained to the enum below on write. Optional on update.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt; (null)&lt;br /&gt;
| &amp;lt;code&amp;gt;Coding { system, version?, code, display? }&amp;lt;/code&amp;gt;, &amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| Service section the report belongs to. &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; is validated against the &amp;#039;&amp;#039;&amp;#039;Diagnostic Service Sections&amp;#039;&amp;#039;&amp;#039; value set.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt; (null)&lt;br /&gt;
| &amp;lt;code&amp;gt;Coding { system, version?, code, display? }&amp;lt;/code&amp;gt;, optional&lt;br /&gt;
| The test or panel performed. &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; is validated against the &amp;#039;&amp;#039;&amp;#039;Observation&amp;#039;&amp;#039;&amp;#039; value set (LOINC). Nullable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; shape (from &amp;lt;code&amp;gt;care/emr/resources/common/coding.py&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;extra=&amp;amp;quot;forbid&amp;amp;quot;&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Required&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=DiagnosticReport|section=Classification|name=system|type=str|notes=optional}}&lt;br /&gt;
{{Field|model=DiagnosticReport|section=Classification|name=version|type=str|notes=optional}}&lt;br /&gt;
{{Field|model=DiagnosticReport|section=Classification|name=code|type=str|notes=&amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;}}&lt;br /&gt;
{{Field|model=DiagnosticReport|section=Classification|name=display|type=str|notes=optional}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Narrative ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Model type&lt;br /&gt;
! Spec shape&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;TextField&amp;lt;/code&amp;gt; (null)&lt;br /&gt;
| &amp;lt;code&amp;gt;str | None&amp;lt;/code&amp;gt;&lt;br /&gt;
| Free-text comments. Not parsed by the platform.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;conclusion&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;TextField&amp;lt;/code&amp;gt; (null)&lt;br /&gt;
| &amp;lt;code&amp;gt;str | None&amp;lt;/code&amp;gt;&lt;br /&gt;
| Clinical interpretation/summary of the results. Not parsed by the platform.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Relationships ===&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=DiagnosticReport|section=Relationships|name=facility|type=FK → facility.Facility|notes=&amp;lt;code&amp;gt;PROTECT&amp;lt;/code&amp;gt;, nullable. Facility the report is scoped to. Set server-side; not a writable spec field.}}&lt;br /&gt;
{{Field|model=DiagnosticReport|section=Relationships|name=patient|type=FK → emr.Patient|notes=&amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;. Subject of the report. Set server-side; not a writable spec field.}}&lt;br /&gt;
{{Field|model=DiagnosticReport|section=Relationships|name=encounter|type=FK → emr.Encounter|notes=&amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;. Encounter the report was produced under. Set server-side; not a writable spec field.}}&lt;br /&gt;
{{Field|model=DiagnosticReport|section=Relationships|name=service_request|type=FK → emr.ServiceRequest|notes=&amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;. The order this report fulfils. Write-only on create (resolved from &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;); excluded from base serialization via &amp;lt;code&amp;gt;__exclude__&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Enum values ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;DiagnosticReportStatusChoices&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;code&amp;gt;spec.py&amp;lt;/code&amp;gt;. (&amp;lt;code&amp;gt;modified&amp;lt;/code&amp;gt; is defined in source but commented out and is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; an active value.)&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;registered&amp;lt;/code&amp;gt;&lt;br /&gt;
| Report exists / has been registered&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;partial&amp;lt;/code&amp;gt;&lt;br /&gt;
| Some results available, report incomplete&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;preliminary&amp;lt;/code&amp;gt;&lt;br /&gt;
| Provisional results pending verification&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;&lt;br /&gt;
| Verified, complete report&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bound value sets ==&lt;br /&gt;
&lt;br /&gt;
Coded fields validate their &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; against a registered Care value set (&amp;lt;code&amp;gt;ValueSetBoundCoding&amp;lt;/code&amp;gt;). A &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; outside the bound set is rejected at deserialization.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Value set&lt;br /&gt;
! Slug&lt;br /&gt;
! Included system(s)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;&lt;br /&gt;
| Diagnostic Service Sections&lt;br /&gt;
| &amp;lt;code&amp;gt;system-diagnostic-service-sections-code&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;http://terminology.hl7.org/CodeSystem/v2-0074&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt;&lt;br /&gt;
| Observation&lt;br /&gt;
| &amp;lt;code&amp;gt;system-observation&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;http://loinc.org&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;code&amp;gt;care/emr/resources/base.py&amp;lt;/code&amp;gt;) through &amp;lt;code&amp;gt;DiagnosticReportSpecBase&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;serialize&amp;lt;/code&amp;gt; builds the read payload from the model (mapping &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;); &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt; writes spec fields back to the model. 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 handle server-side behaviour — resolving foreign keys on write, embedding related resources on read.&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;DiagnosticReportSpecBase&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared base&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; (enum, required), &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; (bound Coding, required), &amp;lt;code&amp;gt;code?&amp;lt;/code&amp;gt; (bound Coding), &amp;lt;code&amp;gt;note?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;conclusion?&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;__model__ = DiagnosticReport&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;__exclude__ = [&amp;amp;quot;service_request&amp;amp;quot;]&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DiagnosticReportCreateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| Base + &amp;lt;code&amp;gt;service_request: UUID4&amp;lt;/code&amp;gt; (required, the request&amp;#039;s &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; resolves it via &amp;lt;code&amp;gt;get_object_or_404(ServiceRequest, external_id=...)&amp;lt;/code&amp;gt; and sets &amp;lt;code&amp;gt;obj.service_request&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DiagnosticReportUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| Base, but &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; is optional (&amp;lt;code&amp;gt;DiagnosticReportStatusChoices | None&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;service_request&amp;lt;/code&amp;gt; is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; writable on update.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DiagnosticReportListSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list&lt;br /&gt;
| Base + &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;service_request: dict | None&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt; sets &amp;lt;code&amp;gt;id = external_id&amp;lt;/code&amp;gt; and embeds the linked request via &amp;lt;code&amp;gt;BaseServiceRequestSpec.serialize(...)&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DiagnosticReportRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail&lt;br /&gt;
| Extends &amp;lt;code&amp;gt;ListSpec&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;observations: list[dict]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;encounter: dict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_by?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;updated_by?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;requester?&amp;lt;/code&amp;gt;. See serialization below.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;DiagnosticReportRetrieveSpec.perform_extra_serialization&amp;lt;/code&amp;gt; (server-side, read) ===&lt;br /&gt;
&lt;br /&gt;
The detail read enriches the list payload so a viewer gets the report, its observations, and its context in one call:&lt;br /&gt;
&lt;br /&gt;
* Calls the &amp;lt;code&amp;gt;ListSpec&amp;lt;/code&amp;gt; hook (sets &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;, embeds &amp;lt;code&amp;gt;service_request&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;serialize_audit_users&amp;lt;/code&amp;gt; → populates &amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt; from cache (&amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;observations&amp;lt;/code&amp;gt; → all &amp;lt;code&amp;gt;Observation&amp;lt;/code&amp;gt; rows where &amp;lt;code&amp;gt;diagnostic_report == obj&amp;lt;/code&amp;gt;, each via &amp;lt;code&amp;gt;ObservationRetrieveSpec.serialize(...)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt; → if &amp;lt;code&amp;gt;service_request.requester_id&amp;lt;/code&amp;gt; is set, loaded from cache via &amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;EncounterListSpec.serialize(obj.encounter)&amp;lt;/code&amp;gt;, with &amp;lt;code&amp;gt;encounter[&amp;amp;quot;patient&amp;amp;quot;]&amp;lt;/code&amp;gt; set to &amp;lt;code&amp;gt;PatientRetrieveSpec.serialize(obj.encounter.patient, facility=obj.facility)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
These embedded fields (&amp;lt;code&amp;gt;service_request&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;observations&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;requester&amp;lt;/code&amp;gt;, audit users) are &amp;#039;&amp;#039;&amp;#039;read-only&amp;#039;&amp;#039;&amp;#039; and are not accepted on create/update.&lt;br /&gt;
&lt;br /&gt;
== Related models ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DiagnosticReport&amp;lt;/code&amp;gt; is the only model defined in this file. It sits downstream of a &amp;lt;code&amp;gt;ServiceRequest&amp;lt;/code&amp;gt; and is anchored to a patient and encounter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;diagnostic_report&lt;br /&gt;
  facility        → FK facility.Facility (PROTECT, nullable)&lt;br /&gt;
  patient         → FK emr.Patient (CASCADE)&lt;br /&gt;
  encounter       → FK emr.Encounter (CASCADE)&lt;br /&gt;
  service_request → FK emr.ServiceRequest (CASCADE)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Deleting a &amp;lt;code&amp;gt;Patient&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Encounter&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;ServiceRequest&amp;lt;/code&amp;gt; cascades to its diagnostic reports; the &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt; link is &amp;lt;code&amp;gt;PROTECT&amp;lt;/code&amp;gt;ed. Routine deletes are soft, via &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;. On retrieve, related &amp;lt;code&amp;gt;Observation&amp;lt;/code&amp;gt; records are pulled in through the reverse FK (&amp;lt;code&amp;gt;Observation.diagnostic_report&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Methods &amp;amp;amp; save behaviour ==&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Create&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;DiagnosticReportCreateSpec.de_serialize&amp;lt;/code&amp;gt;): writes &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;conclusion&amp;lt;/code&amp;gt; onto the model; &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; resolves &amp;lt;code&amp;gt;service_request&amp;lt;/code&amp;gt; from its &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; (404 if missing). &amp;lt;code&amp;gt;facility&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; come from the request context in the view layer, not the payload.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Update&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;DiagnosticReportUpdateSpec&amp;lt;/code&amp;gt;): same base fields, but &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; is optional, so a partial status change is allowed. &amp;lt;code&amp;gt;service_request&amp;lt;/code&amp;gt; cannot be reassigned.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Read&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;Retrieve&amp;lt;/code&amp;gt;): no model writes; all enrichment happens in &amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt; (see above). User and service-request lookups go through the serializer cache (&amp;lt;code&amp;gt;model_from_cache&amp;lt;/code&amp;gt;).&lt;br /&gt;
* Coded fields are validated at deserialization: &amp;lt;code&amp;gt;category.code&amp;lt;/code&amp;gt; must be in the Diagnostic Service Sections value set; &amp;lt;code&amp;gt;code.code&amp;lt;/code&amp;gt; (when present) must be in the Observation value set. &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; must be a &amp;lt;code&amp;gt;DiagnosticReportStatusChoices&amp;lt;/code&amp;gt; value.&lt;br /&gt;
&lt;br /&gt;
== API integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Diagnostic reports are exposed through Care&amp;#039;s REST API and align with the FHIR &amp;lt;code&amp;gt;DiagnosticReport&amp;lt;/code&amp;gt; resource; payload field names follow the spec classes above.&lt;br /&gt;
* &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; are coded concepts (&amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;system&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt;), not free strings. Populate &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; from the bound value set — anything outside it is rejected, and &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; forbids extra keys.&lt;br /&gt;
* &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; is stored as a free &amp;lt;code&amp;gt;CharField&amp;lt;/code&amp;gt;, but the spec restricts writes to the &amp;lt;code&amp;gt;DiagnosticReportStatusChoices&amp;lt;/code&amp;gt; enum (&amp;lt;code&amp;gt;registered&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;partial&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;preliminary&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A report fulfils exactly one &amp;lt;code&amp;gt;service_request&amp;lt;/code&amp;gt;. Create the [[References/Service Request]] first, then pass its &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; as &amp;lt;code&amp;gt;service_request&amp;lt;/code&amp;gt; on create.&lt;br /&gt;
* &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;conclusion&amp;lt;/code&amp;gt; carry human-readable narrative and are not parsed by the platform.&lt;br /&gt;
* The detail (&amp;lt;code&amp;gt;Retrieve&amp;lt;/code&amp;gt;) payload embeds the linked service request, its requester, the encounter (with patient), audit users, and all child observations — none of which are writable.&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>