<?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%2FCondition</id>
	<title>References/Condition - 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%2FCondition"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Condition&amp;action=history"/>
	<updated>2026-07-06T07:12: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/Condition&amp;diff=398&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/Condition&amp;diff=398&amp;oldid=prev"/>
		<updated>2026-07-06T04:02: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:32, 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 269:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 269:&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;onset&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;abatement&amp;lt;/code&amp;gt; are structured choice-of-type objects (&amp;lt;code&amp;gt;*_datetime&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_age&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_string&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;), not arbitrary JSON. &amp;lt;code&amp;gt;onset_datetime&amp;lt;/code&amp;gt; must be timezone-aware and not in the future.&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;onset&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;abatement&amp;lt;/code&amp;gt; are structured choice-of-type objects (&amp;lt;code&amp;gt;*_datetime&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_age&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_string&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;), not arbitrary JSON. &amp;lt;code&amp;gt;onset_datetime&amp;lt;/code&amp;gt; must be timezone-aware and not in the future.&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;* Don&#039;t send &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, audit fields, or &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; from the client — the server owns them.&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;* Don&#039;t send &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, audit fields, or &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; from the client — the server owns them.&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/Condition&amp;diff=138&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/Condition&amp;diff=138&amp;oldid=prev"/>
		<updated>2026-07-04T22:44:17Z</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=Condition&lt;br /&gt;
|order=3&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|fhir=Condition&lt;br /&gt;
|model=Condition&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;Condition&amp;lt;/code&amp;gt; records a clinical problem, diagnosis, or symptom against a patient. It maps to the FHIR &amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; resource and shows up in the Care product UI as &amp;#039;&amp;#039;&amp;#039;Symptoms&amp;#039;&amp;#039;&amp;#039;.&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/condition.py &amp;lt;code&amp;gt;care/emr/models/condition.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/condition/spec.py &amp;lt;code&amp;gt;care/emr/resources/condition/spec.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Value set: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/condition/valueset.py &amp;lt;code&amp;gt;care/emr/resources/condition/valueset.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; lives across two layers, and the split matters when you read the code:&lt;br /&gt;
&lt;br /&gt;
* The Django model (&amp;lt;code&amp;gt;care/emr/models/condition.py&amp;lt;/code&amp;gt;) is storage. Its coded and timing fields (&amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;body_site&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;onset&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;abatement&amp;lt;/code&amp;gt;) are opaque &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;s — the model says nothing about their shape.&lt;br /&gt;
* The Pydantic resource specs (&amp;lt;code&amp;gt;care/emr/resources/condition/spec.py&amp;lt;/code&amp;gt;) are the API. They define the enums, the structure inside each JSON field, field validation, the value-set binding for &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt;, and the separate read and write schemas.&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;Condition&amp;lt;/code&amp;gt;&lt;br /&gt;
| A clinical condition, problem, diagnosis, or symptom recorded for a patient&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Condition&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;Condition&amp;lt;/code&amp;gt; fields ==&lt;br /&gt;
&lt;br /&gt;
=== Status &amp;amp;amp; classification ===&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=Condition|section=Status &amp;amp;amp; classification|name=clinical_status|type=CharField(100), nullable|notes=Clinical state. Spec binds to [[#clinicalstatuschoices-values}}&lt;br /&gt;
{{Field|model=Condition|section=Status &amp;amp;amp; classification|name=verification_status|type=CharField(100), nullable|notes=Level of certainty. Spec binds to [[#verificationstatuschoices-values}}&lt;br /&gt;
{{Field|model=Condition|section=Status &amp;amp;amp; classification|name=category|type=CharField(100), nullable|notes=Classification. Spec binds to [[#categorychoices-values}}&lt;br /&gt;
{{Field|model=Condition|section=Status &amp;amp;amp; classification|name=severity|type=CharField(100), nullable|notes=Subjective severity. Spec binds to [[#severitychoices-values}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Coded concepts ===&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=Condition|section=Coded concepts|name=code|type=JSONField (default=dict, not null/blank)|notes=The condition itself. On write, a single [[#coding-shape}}&lt;br /&gt;
{{Field|model=Condition|section=Coded concepts|name=body_site|type=JSONField (default=dict, not null/blank)|notes=Anatomical location(s). Exists on the model but no current spec exposes it — never written or read through the standard &amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; API.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Timing ===&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=Condition|section=Timing|name=onset|type=JSONField (default=dict)|notes=Choice-of-type onset, shaped by [[#conditiononsetspec-onset-shape}}&lt;br /&gt;
{{Field|model=Condition|section=Timing|name=abatement|type=JSONField (default=dict)|notes=When the condition resolved or went into remission. Shaped by [[#conditionabatementspec-abatement-shape}}&lt;br /&gt;
{{Field|model=Condition|section=Timing|name=recorded_date|type=DateTimeField, nullable|notes=When the condition was first recorded. Not exposed by the current specs.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Context &amp;amp;amp; notes ===&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=Condition|section=Context &amp;amp;amp; notes|name=patient|type=FK → Patient, on_delete=CASCADE|notes=Subject of the condition. Derived server-side from the encounter on create, never read from the client (&amp;lt;code&amp;gt;__exclude__&amp;lt;/code&amp;gt;).}}&lt;br /&gt;
{{Field|model=Condition|section=Context &amp;amp;amp; notes|name=encounter|type=FK → Encounter, nullable, on_delete=CASCADE|notes=Encounter the condition was recorded in. Set server-side on create (&amp;lt;code&amp;gt;__exclude__&amp;lt;/code&amp;gt;); the client supplies a UUID in the spec, which is validated to exist.}}&lt;br /&gt;
{{Field|model=Condition|section=Context &amp;amp;amp; notes|name=note|type=TextField, nullable|notes=Free-text clinical note.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Enums ==&lt;br /&gt;
&lt;br /&gt;
Every enum is a &amp;lt;code&amp;gt;str, Enum&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;care/emr/resources/condition/spec.py&amp;lt;/code&amp;gt;. The value stored and serialized is the string in the table.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ClinicalStatusChoices&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;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;recurrence&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;relapse&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;inactive&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remission&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;resolved&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;VerificationStatusChoices&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;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;unconfirmed&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;provisional&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;differential&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;confirmed&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;refuted&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;CategoryChoices&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;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;problem_list_item&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;encounter_diagnosis&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;chronic_condition&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;SeverityChoices&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;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mild&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;moderate&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;severe&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Nested JSON shapes ==&lt;br /&gt;
&lt;br /&gt;
These spec classes (all extend &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;) are the real structure behind the model&amp;#039;s JSON fields.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ConditionOnSetSpec&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;onset&amp;lt;/code&amp;gt; shape) ===&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;
! Default&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=Condition|section=ConditionOnSetSpec (onset shape)|name=onset_datetime|type=datetime | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Condition|section=ConditionOnSetSpec (onset shape)|name=onset_age|type=int | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Condition|section=ConditionOnSetSpec (onset shape)|name=onset_string|type=str | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Condition|section=ConditionOnSetSpec (onset shape)|name=note|type=str | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;ConditionAbatementSpec&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;abatement&amp;lt;/code&amp;gt; shape) ===&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;
! Default&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=Condition|section=ConditionAbatementSpec (abatement shape)|name=abatement_datetime|type=datetime | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Condition|section=ConditionAbatementSpec (abatement shape)|name=abatement_age|type=int | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Condition|section=ConditionAbatementSpec (abatement shape)|name=abatement_string|type=str | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=Condition|section=ConditionAbatementSpec (abatement shape)|name=note|type=str | None|notes=&amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; shape ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; is a single [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/common/coding.py &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt;], not a &amp;lt;code&amp;gt;CodeableConcept&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;
! Notes&lt;br /&gt;
{{Field|model=Condition|section=Coding shape|name=system|type=str | None|notes=Code system URI (e.g. &amp;lt;code&amp;gt;http://snomed.info/sct&amp;lt;/code&amp;gt;).}}&lt;br /&gt;
{{Field|model=Condition|section=Coding shape|name=version|type=str | None|notes=Code system version.}}&lt;br /&gt;
{{Field|model=Condition|section=Coding shape|name=code|type=str|notes=&amp;#039;&amp;#039;&amp;#039;Required.&amp;#039;&amp;#039;&amp;#039; The code value.}}&lt;br /&gt;
{{Field|model=Condition|section=Coding shape|name=display|type=str | None|notes=Human-readable label.}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; value-set binding ===&lt;br /&gt;
&lt;br /&gt;
On write, &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; is typed &amp;lt;code&amp;gt;ValueSetBoundCoding[CARE_CODITION_CODE_VALUESET.slug]&amp;lt;/code&amp;gt; — a &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; checked against the Condition code value set (&amp;lt;code&amp;gt;care/emr/resources/condition/valueset.py&amp;lt;/code&amp;gt;, slug &amp;lt;code&amp;gt;system-condition-code&amp;lt;/code&amp;gt;), which covers SNOMED CT concepts that are &amp;lt;code&amp;gt;is-a&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;404684003&amp;lt;/code&amp;gt; (&amp;#039;&amp;#039;Clinical finding&amp;#039;&amp;#039;). Codes outside it are rejected on &amp;lt;code&amp;gt;ConditionSpec&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ConditionUpdateSpec&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;ChronicConditionUpdateSpec&amp;lt;/code&amp;gt;. The read spec falls back to a plain &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; and skips value-set validation, so reads stay cheap.&lt;br /&gt;
&lt;br /&gt;
== Resource specs (API schema) ==&lt;br /&gt;
&lt;br /&gt;
Every spec extends &amp;lt;code&amp;gt;BaseConditionSpec&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt; and round-trips through &amp;lt;code&amp;gt;serialize&amp;lt;/code&amp;gt; (DB → Pydantic) and &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt; (Pydantic → DB). &amp;lt;code&amp;gt;BaseConditionSpec&amp;lt;/code&amp;gt; sets &amp;lt;code&amp;gt;__model__ = Condition&amp;lt;/code&amp;gt;, sets &amp;lt;code&amp;gt;__exclude__ = [&amp;amp;quot;patient&amp;amp;quot;, &amp;amp;quot;encounter&amp;amp;quot;]&amp;lt;/code&amp;gt; (both server-maintained, never trusted from the client), and exposes &amp;lt;code&amp;gt;id: UUID4&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;
! Exposes / behaviour&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BaseConditionSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared base&lt;br /&gt;
| &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;; excludes &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; from direct mapping.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ConditionSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create&lt;br /&gt;
| &amp;lt;code&amp;gt;clinical_status?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;verification_status&amp;lt;/code&amp;gt; (&amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;), &amp;lt;code&amp;gt;severity?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; (value-set bound, &amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;), &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; (UUID4, &amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;), &amp;lt;code&amp;gt;onset&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;={}&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;abatement&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;={}&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;note?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; (&amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;). Validates that the encounter exists; on create sets &amp;lt;code&amp;gt;obj.encounter&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;obj.patient = encounter.patient&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ConditionUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update&lt;br /&gt;
| &amp;lt;code&amp;gt;clinical_status?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;verification_status&amp;lt;/code&amp;gt; (&amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;), &amp;lt;code&amp;gt;severity?&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; (value-set bound, &amp;#039;&amp;#039;&amp;#039;required&amp;#039;&amp;#039;&amp;#039;), &amp;lt;code&amp;gt;onset&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;={}&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;abatement&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;={}&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;note?&amp;lt;/code&amp;gt;. Does &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; accept &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ChronicConditionUpdateSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · update (chronic)&lt;br /&gt;
| Extends &amp;lt;code&amp;gt;ConditionUpdateSpec&amp;lt;/code&amp;gt; and adds &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; (UUID4). On deserialize, if &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; is set, resolves it (&amp;lt;code&amp;gt;get_object_or_404&amp;lt;/code&amp;gt;) and assigns &amp;lt;code&amp;gt;obj.encounter&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ConditionReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail/list&lt;br /&gt;
| &amp;lt;code&amp;gt;clinical_status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;verification_status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;criticality&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;severity&amp;lt;/code&amp;gt; (all plain &amp;lt;code&amp;gt;str&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; (plain &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; (UUID4), &amp;lt;code&amp;gt;onset&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;abatement&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;note?&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;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Validation &amp;amp;amp; server-side behaviour ===&lt;br /&gt;
&lt;br /&gt;
* Encounter is required and verified on create. &amp;lt;code&amp;gt;ConditionSpec.validate_encounter_exists&amp;lt;/code&amp;gt; rejects unknown encounter UUIDs; &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; (create only) loads the encounter and derives &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; from it. Clients never set &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; directly.&lt;br /&gt;
* &amp;lt;code&amp;gt;verification_status&amp;lt;/code&amp;gt; is mandatory on both &amp;lt;code&amp;gt;ConditionSpec&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ConditionUpdateSpec&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; is mandatory only on create (&amp;lt;code&amp;gt;ConditionSpec&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; must belong to the bound value set (SNOMED CT clinical findings) on every write spec.&lt;br /&gt;
* &amp;lt;code&amp;gt;onset_datetime&amp;lt;/code&amp;gt; cannot be in the future and is forced timezone-aware; &amp;lt;code&amp;gt;abatement_datetime&amp;lt;/code&amp;gt; carries no such constraint.&lt;br /&gt;
* &amp;lt;code&amp;gt;ConditionReadSpec&amp;lt;/code&amp;gt; exposes &amp;lt;code&amp;gt;criticality&amp;lt;/code&amp;gt;, a string in the read schema with no backing column on the &amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; model. The standard serializer never populates it, so it comes back unset.&lt;br /&gt;
* Read serialization (&amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt;) maps &amp;lt;code&amp;gt;id = external_id&amp;lt;/code&amp;gt;, replaces &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; with its &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, and expands &amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;serialize_audit_users&amp;lt;/code&amp;gt; (cached &amp;lt;code&amp;gt;UserSpec&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;recorded_date&amp;lt;/code&amp;gt; exist on the model but no current spec reads or writes them — storage-only, outside the standard &amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; API surface.&lt;br /&gt;
&lt;br /&gt;
== Related models ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; links to two clinical records:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;patient   → FK Patient   (CASCADE, server-derived from encounter)&lt;br /&gt;
encounter → FK Encounter (CASCADE, nullable; required on create)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Deleting a &amp;lt;code&amp;gt;Patient&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Encounter&amp;lt;/code&amp;gt; cascades to its &amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; rows. The column allows a null &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt;, but the standard create flow always supplies one and derives &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; from it.&lt;br /&gt;
&lt;br /&gt;
== Methods &amp;amp;amp; save behaviour ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;serialize(obj)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;de_serialize(obj)&amp;lt;/code&amp;gt; (from &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;) convert between the &amp;lt;code&amp;gt;Condition&amp;lt;/code&amp;gt; model and the spec. Field mapping uses the model&amp;#039;s non-FK column names; &amp;lt;code&amp;gt;__exclude__&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;) and &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; are skipped during deserialization.&lt;br /&gt;
* &amp;lt;code&amp;gt;ConditionSpec.perform_extra_deserialization(is_update=False, obj)&amp;lt;/code&amp;gt; — create path: resolves the encounter and sets &amp;lt;code&amp;gt;obj.patient = obj.encounter.patient&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;ChronicConditionUpdateSpec.perform_extra_deserialization&amp;lt;/code&amp;gt; — resolves and assigns &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; when provided.&lt;br /&gt;
* &amp;lt;code&amp;gt;ConditionReadSpec.perform_extra_serialization&amp;lt;/code&amp;gt; — sets &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; external ids and serializes audit users.&lt;br /&gt;
* &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, audit fields, &amp;lt;code&amp;gt;meta&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;history&amp;lt;/code&amp;gt;, and soft-delete (&amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;) are platform-maintained via [[References/Base models &amp;amp;amp; conventions|&amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;]].&lt;br /&gt;
&lt;br /&gt;
== API integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Send &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; as a structured &amp;lt;code&amp;gt;Coding&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;{system, code, display}&amp;lt;/code&amp;gt;) drawn from the SNOMED CT clinical-finding value set, not as free text. Always include &amp;lt;code&amp;gt;verification_status&amp;lt;/code&amp;gt;; add &amp;lt;code&amp;gt;category&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;encounter&amp;lt;/code&amp;gt; when creating.&lt;br /&gt;
* &amp;lt;code&amp;gt;onset&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;abatement&amp;lt;/code&amp;gt; are structured choice-of-type objects (&amp;lt;code&amp;gt;*_datetime&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_age&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_string&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;), not arbitrary JSON. &amp;lt;code&amp;gt;onset_datetime&amp;lt;/code&amp;gt; must be timezone-aware and not in the future.&lt;br /&gt;
* Don&amp;#039;t send &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, audit fields, or &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; from the client — the server owns them.&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>