<?xml version="1.0" encoding="UTF-8"?>

<CodeSystem xmlns="http://hl7.org/fhir">
  <id value="managed-subscription"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: CodeSystem managed-subscription</b></p><a name="managed-subscription"> </a><a name="hcmanaged-subscription"> </a><p>This case-sensitive code system <code>https://projo.evoleen.com/fhir/CodeSystem/managed-subscription</code> defines the following codes:</p><table class="codes"><tr><td style="white-space:nowrap"><b>Code</b></td><td><b>Display</b></td><td><b>Definition</b></td></tr><tr><td style="white-space:nowrap">sidecar-cr-events<a name="managed-subscription-sidecar-cr-events"> </a></td><td>Sidecar CR events</td><td>Sidecar-owned. Criteria: CommunicationRequest?status=active,revoked&amp;medium=whatsapp&amp;category:not=identity-resolution. Delivers to the cr-events queue.</td></tr><tr><td style="white-space:nowrap">projo-cr-status-events<a name="managed-subscription-projo-cr-status-events"> </a></td><td>Projo CR status events</td><td>Orchestrator-owned. Criteria: CommunicationRequest?status=completed,revoked&amp;category:not=identity-resolution. Delivers to the cr-status-events queue; triggers handleCommunicationRequestStatus.</td></tr><tr><td style="white-space:nowrap">projo-identity-resolution-events<a name="managed-subscription-projo-identity-resolution-events"> </a></td><td>Projo identity resolution events</td><td>Orchestrator-owned. Criteria: CommunicationRequest?status=active&amp;category=identity-resolution-required. Delivers to the identity-resolution-events queue; triggers identityResolution.</td></tr><tr><td style="white-space:nowrap">projo-careplan-bootstrap<a name="managed-subscription-projo-careplan-bootstrap"> </a></td><td>Projo CarePlan bootstrap</td><td>Orchestrator-owned. Criteria: CarePlan?status=active&amp;_tag:not=careplan-scheduling|scheduled. Delivers to the fhir-events queue; triggers carePlanCreated (which then calls $subscribe-due-events).</td></tr></table></div>
  </text>
  <url value="https://projo.evoleen.com/fhir/CodeSystem/managed-subscription"/>
  <version value="0.1.0"/>
  <name value="ManagedSubscription"/>
  <title value="Fire Arrow Managed Subscription"/>
  <status value="draft"/>
  <experimental value="true"/>
  <date value="2024-01-01"/>
  <publisher value="Projo"/>
  <contact>
    <name value="Projo"/>
    <telecom>
      <system value="url"/>
      <value value="https://projo.evoleen.com"/>
    </telecom>
  </contact>
  <description value="Tag value on Subscription.meta.tag identifying the four managed Subscriptions that wire the orchestrator and sidecar together. Each consuming app's sweeper (every 5 min) reconciles its own Subscription by _tag search (always indexed in HAPI), NOT by criteria — so criteria changes are recoverable without duplicates. Codes: sidecar-cr-events, projo-cr-status-events, projo-identity-resolution-events, projo-careplan-bootstrap."/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="CH"/>
      <display value="Switzerland"/>
    </coding>
  </jurisdiction>
  <purpose value="Documentation-only artifact. Projo's runtime extensions, code systems, identifier systems and search parameter are TypeScript constants and bootstrap-time resources, NOT deployed StructureDefinitions. This StructureDefinition exists to document the contract; the source of truth is src/functions/src/lib/fhir/types.ts and docs/FHIR_EXTENSIONS.md."/>
  <copyright value="Copyright (c) Projo. Licensed under CC0-1.0 (public domain dedication). FHIR(R) is the registered trademark of HL7 and is used with permission. This IG references WhatsApp(R), a trademark of Meta Platforms, Inc., for descriptive purposes only."/>
  <caseSensitive value="true"/>
  <content value="complete"/>
  <count value="4"/>
  <concept>
    <code value="sidecar-cr-events"/>
    <display value="Sidecar CR events"/>
    <definition value="Sidecar-owned. Criteria: CommunicationRequest?status=active,revoked&amp;medium=whatsapp&amp;category:not=identity-resolution. Delivers to the cr-events queue."/>
  </concept>
  <concept>
    <code value="projo-cr-status-events"/>
    <display value="Projo CR status events"/>
    <definition value="Orchestrator-owned. Criteria: CommunicationRequest?status=completed,revoked&amp;category:not=identity-resolution. Delivers to the cr-status-events queue; triggers handleCommunicationRequestStatus."/>
  </concept>
  <concept>
    <code value="projo-identity-resolution-events"/>
    <display value="Projo identity resolution events"/>
    <definition value="Orchestrator-owned. Criteria: CommunicationRequest?status=active&amp;category=identity-resolution-required. Delivers to the identity-resolution-events queue; triggers identityResolution."/>
  </concept>
  <concept>
    <code value="projo-careplan-bootstrap"/>
    <display value="Projo CarePlan bootstrap"/>
    <definition value="Orchestrator-owned. Criteria: CarePlan?status=active&amp;_tag:not=careplan-scheduling|scheduled. Delivers to the fhir-events queue; triggers carePlanCreated (which then calls $subscribe-due-events)."/>
  </concept>
</CodeSystem>