<?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%2FObservation</id>
	<title>References/Observation - 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%2FObservation"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Observation&amp;action=history"/>
	<updated>2026-07-06T05:20:21Z</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/Observation&amp;diff=408&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/Observation&amp;diff=408&amp;oldid=prev"/>
		<updated>2026-07-06T04:03:07Z</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 444:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 444:&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;* On read, the list and detail specs blank out &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;questionnaire_response&amp;lt;/code&amp;gt;, so don&#039;t rely on those being populated in observation payloads.&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;* On read, the list and detail specs blank out &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;questionnaire_response&amp;lt;/code&amp;gt;, so don&#039;t rely on those being populated in observation payloads.&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;* Prefer structured observations. Allergy and medication checks read coded values, not free text, so unstructured data leaves them blind.&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;* Prefer structured observations. Allergy and medication checks read coded values, not free text, so unstructured data leaves them blind.&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;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=References/Observation&amp;diff=143&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/Observation&amp;diff=143&amp;oldid=prev"/>
		<updated>2026-07-04T22:44:24Z</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=Observation&lt;br /&gt;
|order=5&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|fhir=Observation&lt;br /&gt;
|model=Observation&lt;br /&gt;
|reference=References/Base models &amp;amp;amp; conventions&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
An &amp;lt;code&amp;gt;Observation&amp;lt;/code&amp;gt; is one named, coded data point about a subject — almost always a patient: a blood pressure reading, a temperature, a coded answer captured through a questionnaire. &amp;lt;code&amp;gt;main_code&amp;lt;/code&amp;gt; records &amp;#039;&amp;#039;what&amp;#039;&amp;#039; was observed (usually bound to LOINC) and &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; holds the result. You rarely create one by hand; most observations are materialized when a questionnaire is submitted.&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/observation.py &amp;lt;code&amp;gt;care/emr/models/observation.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Resource spec: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/observation/spec.py &amp;lt;code&amp;gt;care/emr/resources/observation/spec.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Value sets: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/observation/valueset.py &amp;lt;code&amp;gt;care/emr/resources/observation/valueset.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
The model is just storage; several fields are opaque &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;s. Their real structure lives in the Pydantic resource specs under &amp;lt;code&amp;gt;care/emr/resources/observation/&amp;lt;/code&amp;gt;, which own the enums, nested JSON shapes, validation, and the read/write schema split. Each field row below gives the storage column first, then the shape the spec enforces on top of it.&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;Observation&amp;lt;/code&amp;gt;&lt;br /&gt;
| A single coded measurement or finding about a patient, captured within an encounter&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Observation&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 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;Observation&amp;lt;/code&amp;gt; fields ==&lt;br /&gt;
&lt;br /&gt;
=== Classification &amp;amp;amp; coding ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Storage type&lt;br /&gt;
! Spec shape / 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;
| Enum &amp;lt;code&amp;gt;ObservationStatus&amp;lt;/code&amp;gt; — &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;amended&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;. Required in specs. Questionnaire-sourced observations land as &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;is_group&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;BooleanField&amp;lt;/code&amp;gt;&lt;br /&gt;
| Default &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; marks a grouping/panel observation that holds &amp;lt;code&amp;gt;component&amp;lt;/code&amp;gt;/child observations instead of a single value. Not exposed in the resource specs&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; (default &amp;lt;code&amp;gt;{}&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: optional &amp;lt;code&amp;gt;Coding { system?, version?, code, display? }&amp;lt;/code&amp;gt;. FHIR observation category, derived from the questionnaire&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;main_code&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;{}&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: optional &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt;. What is being observed, typically LOINC (&amp;lt;code&amp;gt;CARE_OBSERVATION_VALUSET&amp;lt;/code&amp;gt;, system &amp;lt;code&amp;gt;http://loinc.org&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;alternate_coding&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;[]&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: optional &amp;lt;code&amp;gt;CodeableConcept { id?, coding?: Coding[], text }&amp;lt;/code&amp;gt;. Same concept expressed in other code systems&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Subject &amp;amp;amp; context ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Storage type&lt;br /&gt;
! Spec shape / notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;subject_type&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CharField(255)&amp;lt;/code&amp;gt;&lt;br /&gt;
| Enum &amp;lt;code&amp;gt;SubjectType&amp;lt;/code&amp;gt; — &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;. Spec defaults to &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;subject_id&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;UUIDField&amp;lt;/code&amp;gt;&lt;br /&gt;
| The subject entity&amp;#039;s id. Set server-side; not in the spec body&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK → Patient&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;. Set server-side, not in the spec body&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK → Encounter&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;. Spec field is &amp;lt;code&amp;gt;UUID4 | None&amp;lt;/code&amp;gt;. Where the observation was recorded&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;effective_datetime&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;DateTimeField&amp;lt;/code&amp;gt;&lt;br /&gt;
| When the observation was effective. Nullable in storage, but the spec requires a tz-aware &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; on create; optional on update&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Author &amp;amp;amp; performer ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Storage type&lt;br /&gt;
! Spec shape / notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;data_entered_by&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK → users.User&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;, nullable. &amp;lt;code&amp;gt;related_name=&amp;amp;quot;observations_entered&amp;amp;quot;&amp;lt;/code&amp;gt;. Write specs accept &amp;lt;code&amp;gt;data_entered_by_id: int&amp;lt;/code&amp;gt;; read specs serialize a nested &amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;performer&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;{}&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: optional &amp;lt;code&amp;gt;Performer { type: PerformerType (related_person|user), id: str }&amp;lt;/code&amp;gt;. Use it when the performer differs from the data-entry user&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Value ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Storage type&lt;br /&gt;
! Spec shape / notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;value_type&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CharField(255)&amp;lt;/code&amp;gt;&lt;br /&gt;
| Enum &amp;lt;code&amp;gt;QuestionType&amp;lt;/code&amp;gt; (from the questionnaire module). Tells the client how to read &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; — see the table below. Required in specs&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;&lt;br /&gt;
| Spec: &amp;lt;code&amp;gt;QuestionnaireSubmitResultValue { value?: str, unit?: Coding, coding?: Coding }&amp;lt;/code&amp;gt;. Required on create, optional on update. &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; holds the raw/string result, &amp;lt;code&amp;gt;unit&amp;lt;/code&amp;gt; the quantity unit, &amp;lt;code&amp;gt;coding&amp;lt;/code&amp;gt; the coded answer&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;&lt;br /&gt;
| Spec: &amp;lt;code&amp;gt;str | None&amp;lt;/code&amp;gt;. Free-text note&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Clinical qualifiers ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Storage type&lt;br /&gt;
! Spec shape / notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body_site&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;{}&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: optional &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; bound to &amp;lt;code&amp;gt;CARE_BODY_SITE_VALUESET&amp;lt;/code&amp;gt; (slug &amp;lt;code&amp;gt;system-body-site-observation&amp;lt;/code&amp;gt;, SNOMED CT). FHIR &amp;lt;code&amp;gt;Observation.bodySite&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;method&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;{}&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: optional &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; bound to &amp;lt;code&amp;gt;CARE_OBSERVATION_COLLECTION_METHOD&amp;lt;/code&amp;gt; (slug &amp;lt;code&amp;gt;system-collection-method&amp;lt;/code&amp;gt;, SNOMED CT). FHIR &amp;lt;code&amp;gt;Observation.method&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;reference_range&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;[]&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: &amp;lt;code&amp;gt;ReferenceRange[]&amp;lt;/code&amp;gt; (shape below), default &amp;lt;code&amp;gt;[]&amp;lt;/code&amp;gt;. Reference ranges for the value, usually carried over from the observation definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;interpretation&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;{}&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: free &amp;lt;code&amp;gt;dict&amp;lt;/code&amp;gt;, default &amp;lt;code&amp;gt;{}&amp;lt;/code&amp;gt;. Coded interpretation against the reference range (high/low/normal). Normal/abnormal/critical value sets exist (below) but are not enforced on this dict&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;interpretation_old&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CharField(255)&amp;lt;/code&amp;gt;&lt;br /&gt;
| Nullable. Legacy free-text interpretation, kept for backward compatibility. Not in the specs&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Structure &amp;amp;amp; relationships ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Storage type&lt;br /&gt;
! Spec shape / notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;parent&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;UUIDField&amp;lt;/code&amp;gt;&lt;br /&gt;
| Nullable. Spec: &amp;lt;code&amp;gt;UUID4 | None&amp;lt;/code&amp;gt; — the &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; of a parent observation, for nesting related observations&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;component&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;[]&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Spec: &amp;lt;code&amp;gt;Component[]&amp;lt;/code&amp;gt; (shape below), default &amp;lt;code&amp;gt;[]&amp;lt;/code&amp;gt;. Sub-observations sharing this context but carrying their own codes and values (FHIR &amp;lt;code&amp;gt;Observation.component&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;questionnaire_response&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK → QuestionnaireResponse&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;, nullable. Spec field is &amp;lt;code&amp;gt;UUID4 | None&amp;lt;/code&amp;gt;. The submission that produced this observation&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;diagnostic_report&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK → DiagnosticReport&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;, nullable. The report this observation belongs to, if any. Not in the write specs&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;observation_definition&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;FK → ObservationDefinition&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CASCADE&amp;lt;/code&amp;gt;, nullable. The definition this observation templates from. Serialized as &amp;lt;code&amp;gt;BaseObservationDefinitionSpec&amp;lt;/code&amp;gt; only in &amp;lt;code&amp;gt;ObservationRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Enum &amp;amp;amp; value-set reference ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ObservationStatus&amp;lt;/code&amp;gt; values ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;&lt;br /&gt;
| Recorded, complete and verified. The default for questionnaire-sourced observations&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;amended&amp;lt;/code&amp;gt;&lt;br /&gt;
| Was &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;, then corrected&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;&lt;br /&gt;
| Recorded in error; disregard it&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;PerformerType&amp;lt;/code&amp;gt; values (&amp;lt;code&amp;gt;performer.type&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;related_person&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;SubjectType&amp;lt;/code&amp;gt; values (&amp;lt;code&amp;gt;subject_type&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; (spec default)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;QuestionType&amp;lt;/code&amp;gt; values (&amp;lt;code&amp;gt;value_type&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
From the questionnaire module. The value tells the client which key of &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; to read.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! Value sourced from &amp;lt;code&amp;gt;QuestionnaireSubmitResultValue&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;&lt;br /&gt;
| grouping node (no direct value)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;&amp;amp;quot;true&amp;amp;quot;&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;&amp;amp;quot;false&amp;amp;quot;&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;decimal&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt;&lt;br /&gt;
| display-only&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dateTime&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;time&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;choice&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;coding&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;quantity&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;unit&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;structured&amp;lt;/code&amp;gt;&lt;br /&gt;
| structured payload&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Bound value sets ===&lt;br /&gt;
&lt;br /&gt;
Coded fields validate against registered Care value sets. A &amp;lt;code&amp;gt;body_site&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; coding outside its value set is rejected during 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;
! System(s)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;main_code&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CARE_OBSERVATION_VALUSET&amp;lt;/code&amp;gt;&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;
| &amp;lt;code&amp;gt;body_site&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CARE_BODY_SITE_VALUESET&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-body-site-observation&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;http://snomed.info/sct&amp;lt;/code&amp;gt; (curated concept list + descendants of &amp;lt;code&amp;gt;442083009&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;CARE_OBSERVATION_COLLECTION_METHOD&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;system-collection-method&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;http://snomed.info/sct&amp;lt;/code&amp;gt; (descendants of &amp;lt;code&amp;gt;272394005&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;129264002&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;386053000&amp;lt;/code&amp;gt;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These interpretation value sets are registered for the frontend and observation definitions, but are not enforced on the &amp;lt;code&amp;gt;interpretation&amp;lt;/code&amp;gt; dict:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value set&lt;br /&gt;
! Slug&lt;br /&gt;
! Concepts (system &amp;lt;code&amp;gt;http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| Normal&lt;br /&gt;
| &amp;lt;code&amp;gt;system-normal-coded-valueset&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; Normal, &amp;lt;code&amp;gt;ND&amp;lt;/code&amp;gt; Not detected, &amp;lt;code&amp;gt;NEG&amp;lt;/code&amp;gt; Negative&lt;br /&gt;
|-&lt;br /&gt;
| Abnormal&lt;br /&gt;
| &amp;lt;code&amp;gt;system-abnormal-coded-valueset&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt; Abnormal, &amp;lt;code&amp;gt;AA&amp;lt;/code&amp;gt; Critically abnormal, &amp;lt;code&amp;gt;H&amp;lt;/code&amp;gt; High, &amp;lt;code&amp;gt;HH&amp;lt;/code&amp;gt; Critically high, &amp;lt;code&amp;gt;L&amp;lt;/code&amp;gt; Low, &amp;lt;code&amp;gt;LL&amp;lt;/code&amp;gt; Critically low, &amp;lt;code&amp;gt;POS&amp;lt;/code&amp;gt; Positive, &amp;lt;code&amp;gt;DET&amp;lt;/code&amp;gt; Detected&lt;br /&gt;
|-&lt;br /&gt;
| Critical&lt;br /&gt;
| &amp;lt;code&amp;gt;system-critical-coded-valueset&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;C&amp;lt;/code&amp;gt; Critical, &amp;lt;code&amp;gt;CC&amp;lt;/code&amp;gt; Critical high, &amp;lt;code&amp;gt;CL&amp;lt;/code&amp;gt; Critical low, &amp;lt;code&amp;gt;CV&amp;lt;/code&amp;gt; Critical value&lt;br /&gt;
|-&lt;br /&gt;
| UCUM units&lt;br /&gt;
| &amp;lt;code&amp;gt;system-ucum-units&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;http://unitsofmeasure.org&amp;lt;/code&amp;gt; (all UCUM units)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Nested JSON shapes (from the spec) ==&lt;br /&gt;
&lt;br /&gt;
The structures behind the model&amp;#039;s &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;Coding {&lt;br /&gt;
  system:  str | null      # e.g. http://loinc.org&lt;br /&gt;
  version: str | null&lt;br /&gt;
  code:    str             # required&lt;br /&gt;
  display: str | null&lt;br /&gt;
}                          # extra keys forbidden&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== &amp;lt;code&amp;gt;CodeableConcept&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;alternate_coding&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;CodeableConcept {&lt;br /&gt;
  id:     str | null&lt;br /&gt;
  coding: Coding[] | null&lt;br /&gt;
  text:   str | null       # field present, required key&lt;br /&gt;
}                          # extra keys forbidden&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== &amp;lt;code&amp;gt;QuestionnaireSubmitResultValue&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;QuestionnaireSubmitResultValue {&lt;br /&gt;
  value:  str | null       # raw/string value&lt;br /&gt;
  unit:   Coding | null    # for quantity values&lt;br /&gt;
  coding: Coding | null    # for coded values&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== &amp;lt;code&amp;gt;Performer&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;performer&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;Performer {&lt;br /&gt;
  type: PerformerType      # related_person | user&lt;br /&gt;
  id:   str&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== &amp;lt;code&amp;gt;ReferenceRange&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;reference_range[]&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;ReferenceRange {&lt;br /&gt;
  min:            float | null&lt;br /&gt;
  max:            float | null&lt;br /&gt;
  unit:           str | null&lt;br /&gt;
  interpretation: str        # required&lt;br /&gt;
  value:          str | null&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== &amp;lt;code&amp;gt;Component&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;component[]&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;Component {&lt;br /&gt;
  value:           QuestionnaireSubmitResultValue   # required&lt;br /&gt;
  interpretation:  str | dict     = {}&lt;br /&gt;
  reference_range: ReferenceRange[] = []&lt;br /&gt;
  code:            Coding | null   = null&lt;br /&gt;
  note:            str            = &amp;quot;&amp;quot;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Resource specs (API schema) ==&lt;br /&gt;
&lt;br /&gt;
The Pydantic specs build on [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/base.py &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;], which provides &amp;lt;code&amp;gt;serialize&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt; 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. Every concrete spec inherits from &amp;lt;code&amp;gt;BaseObservationSpec&amp;lt;/code&amp;gt;.&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;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BaseObservationSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared base&lt;br /&gt;
| Defines the common fields: &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;main_code&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;alternate_coding&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;subject_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;effective_datetime&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;performer&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;value_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;body_site&amp;lt;/code&amp;gt; (bound), &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; (bound), &amp;lt;code&amp;gt;reference_range&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;interpretation&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;parent&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;questionnaire_response&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;component&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ObservationSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;data_entered_by_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_by_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;updated_by_id&amp;lt;/code&amp;gt; (all &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;). Used internally when materializing observations from a questionnaire submission&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ObservationUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| The base, but &amp;lt;code&amp;gt;effective_datetime&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; relax to optional (&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;) for partial updates&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ObservationReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list&lt;br /&gt;
| Swaps the user IDs for nested &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;data_entered_by&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;UserSpec&amp;lt;/code&amp;gt; objects&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ObservationRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail&lt;br /&gt;
| Extends &amp;lt;code&amp;gt;ObservationReadSpec&amp;lt;/code&amp;gt; and additionally serializes &amp;lt;code&amp;gt;observation_definition&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;BaseObservationDefinitionSpec&amp;lt;/code&amp;gt; when it is set&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Server-side behaviour ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;ObservationSpec.perform_extra_deserialization&amp;lt;/code&amp;gt; (create/update): sets &amp;lt;code&amp;gt;obj.external_id = self.id&amp;lt;/code&amp;gt;, copies &amp;lt;code&amp;gt;data_entered_by_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_by_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;updated_by_id&amp;lt;/code&amp;gt; onto the model, drops &amp;lt;code&amp;gt;data_entered_by_id&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;meta&amp;lt;/code&amp;gt;, and on &amp;#039;&amp;#039;&amp;#039;create&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;is_update&amp;lt;/code&amp;gt; is false) clears &amp;lt;code&amp;gt;obj.id&amp;lt;/code&amp;gt; so a new row is inserted.&lt;br /&gt;
* &amp;lt;code&amp;gt;ObservationReadSpec.perform_extra_serialization&amp;lt;/code&amp;gt;: maps &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;; deliberately blanks &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;questionnaire_response&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt; in the output to avoid extra DB queries; resolves the audit users (&amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt;) and &amp;lt;code&amp;gt;data_entered_by&amp;lt;/code&amp;gt; from cache (&amp;lt;code&amp;gt;model_from_cache&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;ObservationRetrieveSpec.perform_extra_serialization&amp;lt;/code&amp;gt;: calls the parent, then inlines the full &amp;lt;code&amp;gt;observation_definition&amp;lt;/code&amp;gt; when the FK is set.&lt;br /&gt;
* &amp;lt;code&amp;gt;body_site&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; are &amp;lt;code&amp;gt;ValueSetBoundCoding[...]&amp;lt;/code&amp;gt;: the supplied &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; is validated against its bound value set during deserialization and rejected if the code is not a member.&lt;br /&gt;
* &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt; only writes fields present in the model&amp;#039;s column mapping. Non-default values are persisted (&amp;lt;code&amp;gt;model_dump(exclude_defaults=True)&amp;lt;/code&amp;gt;), and unknown spec-only fields would land in &amp;lt;code&amp;gt;meta&amp;lt;/code&amp;gt; when &amp;lt;code&amp;gt;__store_metadata__&amp;lt;/code&amp;gt; is set — which, by default, it is not for observations.&lt;br /&gt;
&lt;br /&gt;
== Related models ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Observation&amp;lt;/code&amp;gt; is self-contained; it expresses relationships through foreign keys rather than secondary tables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;patient                → FK Patient (CASCADE)&lt;br /&gt;
encounter              → FK Encounter (CASCADE)&lt;br /&gt;
data_entered_by        → FK users.User (CASCADE, nullable)&lt;br /&gt;
questionnaire_response → FK QuestionnaireResponse (CASCADE, nullable)&lt;br /&gt;
diagnostic_report      → FK DiagnosticReport (CASCADE, nullable)&lt;br /&gt;
observation_definition → FK ObservationDefinition (CASCADE, nullable)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;parent&amp;lt;/code&amp;gt; is the exception: a soft, UUID-based self-reference to another observation&amp;#039;s &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, not a Django FK. It lets observations nest without a database constraint.&lt;br /&gt;
&lt;br /&gt;
== API integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Observations are exposed through Care&amp;#039;s REST API and align with the FHIR &amp;lt;code&amp;gt;Observation&amp;lt;/code&amp;gt; resource. FHIR field names (&amp;lt;code&amp;gt;effectiveDateTime&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bodySite&amp;lt;/code&amp;gt;, and so on) differ from the Django model names; the resource specs above are the authoritative request/response schemas.&lt;br /&gt;
* Most observations are created as a side effect of submitting a questionnaire. &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;value_type&amp;lt;/code&amp;gt; mirror the submission types (&amp;lt;code&amp;gt;QuestionnaireSubmitResultValue&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;QuestionType&amp;lt;/code&amp;gt;), and &amp;lt;code&amp;gt;questionnaire_response&amp;lt;/code&amp;gt; records provenance.&lt;br /&gt;
* &amp;lt;code&amp;gt;effective_datetime&amp;lt;/code&amp;gt; must be timezone-aware. Required on create, optional on update.&lt;br /&gt;
* &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; is one of &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;amended&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;; questionnaire-sourced observations are &amp;lt;code&amp;gt;final&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;body_site&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; are validated against their bound value sets, and &amp;lt;code&amp;gt;main_code&amp;lt;/code&amp;gt; is expected to bind to LOINC via &amp;lt;code&amp;gt;CARE_OBSERVATION_VALUSET&amp;lt;/code&amp;gt;.&lt;br /&gt;
* On read, the list and detail specs blank out &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;questionnaire_response&amp;lt;/code&amp;gt;, so don&amp;#039;t rely on those being populated in observation payloads.&lt;br /&gt;
* Prefer structured observations. Allergy and medication checks read coded values, not free text, so unstructured data leaves them blind.&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>