Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

References/Resource Category: Difference between revisions

From OHC Network Wiki
More languages
Content deleted Content added
Migrate to {{SourceCode}} template
Fix unclosed wikilink so calculated_monetary_components row stores in ModelField table (via update-page on MediaWiki MCP Server)
 
(2 intermediate revisions by the same user not shown)
Line 56: Line 56:
{{Field|model=ResourceCategory|section=Tree structure|name=parent|type=FK → emr.ResourceCategory (CASCADE)|notes=Self-reference to the parent node; nullable. <code>related_name=&quot;children&quot;</code>. <code>__exclude__</code>d from spec serialization — written via slug lookup, read via <code>get_parent_json()</code>}}
{{Field|model=ResourceCategory|section=Tree structure|name=parent|type=FK → emr.ResourceCategory (CASCADE)|notes=Self-reference to the parent node; nullable. <code>related_name=&quot;children&quot;</code>. <code>__exclude__</code>d from spec serialization — written via slug lookup, read via <code>get_parent_json()</code>}}
{{Field|model=ResourceCategory|section=Tree structure|name=is_child|type=BooleanField|notes=Default <code>False</code>. Exposed on write (<code>ResourceCategoryWriteSpec</code>) and read}}
{{Field|model=ResourceCategory|section=Tree structure|name=is_child|type=BooleanField|notes=Default <code>False</code>. Exposed on write (<code>ResourceCategoryWriteSpec</code>) and read}}
{{Field|model=ResourceCategory|section=Tree structure|name=has_children|type=BooleanField|notes=Default <code>False</code>. Flips to <code>True</code> on the parent when a child is created (see [[#methods--save-behaviour}}
{{Field|model=ResourceCategory|section=Tree structure|name=has_children|type=BooleanField|notes=Default <code>False</code>. Flips to <code>True</code> on the parent when a child is created (see [[#methods--save-behaviour|Methods &amp; save behaviour]]}}
{{Field|model=ResourceCategory|section=Tree structure|name=root_org|type=FK → emr.ResourceCategory (CASCADE)|notes=Self-reference to the root of this node's tree; nullable. <code>related_name=&quot;root&quot;</code>. Not exposed in specs}}
{{Field|model=ResourceCategory|section=Tree structure|name=root_org|type=FK → emr.ResourceCategory (CASCADE)|notes=Self-reference to the root of this node's tree; nullable. <code>related_name=&quot;root&quot;</code>. Not exposed in specs}}
|}
|}
Line 105: Line 105:
! Notes
! Notes
{{Field|model=ResourceCategory|section=Charge item monetary components|name=configured_monetary_components|type=JSONField → list[MonetaryComponent] | None|notes=Components configured directly on this category}}
{{Field|model=ResourceCategory|section=Charge item monetary components|name=configured_monetary_components|type=JSONField → list[MonetaryComponent] | None|notes=Components configured directly on this category}}
{{Field|model=ResourceCategory|section=Charge item monetary components|name=calculated_monetary_components|type=JSONField → list[MonetaryComponent] | None|notes=Effective components after merging the parent's calculated components with this node's configured components (see [[#methods--save-behaviour}}
{{Field|model=ResourceCategory|section=Charge item monetary components|name=calculated_monetary_components|type=JSONField → list[MonetaryComponent] | None|notes=Effective components after merging the parent's calculated components with this node's configured components (see [[#methods--save-behaviour|Methods &amp; save behaviour]]}}
|}
|}


Line 262: Line 262:
* Monetary-component propagation runs through Celery, so descendants' <code>calculated_monetary_components</code> is eventually consistent after a write.
* Monetary-component propagation runs through Celery, so descendants' <code>calculated_monetary_components</code> is eventually consistent after a write.
* Monetary-component fields serialize only for <code>resource_type == &quot;charge_item_definition&quot;</code>; during merges, component identity rests on the nested <code>code.system</code> + <code>code.code</code> pair.
* Monetary-component fields serialize only for <code>resource_type == &quot;charge_item_definition&quot;</code>; during merges, component identity rests on the nested <code>code.system</code> + <code>code.code</code> pair.
* Categories can be '''deleted''' (<code>DELETE</code> on the category endpoint, added in ENG-441). Deletion is a soft delete (<code>deleted = True</code>) guarded by <code>validate_destroy</code>: a category with children, or with resources still linked through <code>ActivityDefinition.category</code>, <code>ChargeItemDefinition.category</code>, or <code>ProductKnowledge.category</code>, is rejected. Deleting the last remaining child resets the parent's <code>has_children</code> to <code>False</code>.