@fuego-systems/core 0.1.12 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ export declare const EGES_EQUIPO_SYSTEM = "https://www.cdrossi.com/eges/equipo";
9
9
  export declare const EGES_TURNO_SYSTEM = "https://www.cdrossi.com/eges/turno";
10
10
  export declare const EGES_PRACTICA_SYSTEM = "https://www.cdrossi.com/eges/practica";
11
11
  export declare const EGES_PRESTACION_SYSTEM = "https://www.cdrossi.com/eges/prestacion";
12
+ export declare const EGES_CONDICION_RESPUESTA_SYSTEM = "https://www.cdrossi.com/eges/condicion-respuesta";
12
13
  export declare const RENAPER_BASE = "https://www.argentina.gob.ar/interior/renaper";
13
14
  export declare const MATRICULA_NACIONAL_SYSTEM = "https://www.argentina.gob.ar/interior/renaper/matricula-nacional";
14
15
  export declare const MATRICULA_PROVINCIAL_SYSTEM = "https://www.argentina.gob.ar/interior/renaper/matricula-provincial";
@@ -27,6 +28,68 @@ export declare const MIGRATE_SITE_TASK_CODE = "eges-migrate-site";
27
28
  export declare const MIGRATE_SERVICE_TASK_CODE = "eges-migrate-service";
28
29
  export declare const MIGRATE_APPOINTMENT_TASK_CODE = "eges-migrate-appointment";
29
30
  export declare const REVIEW_APPOINTMENT_TASK_CODE = "review-appointment";
31
+ export declare const SYNCHRONIZE_APPOINTMENT_TASK_CODE = "synchronize-appointment";
32
+ /**
33
+ * Coding system for `Task.businessStatus` values used by the Rossi admin
34
+ * review workflow. Distinct from `Task.status` (FHIR lifecycle), which is
35
+ * driven by the booking pipeline. `businessStatus` captures staff-side
36
+ * review state that is independent of whether the appointment has been
37
+ * confirmed in EGES.
38
+ */
39
+ export declare const TASK_BUSINESS_STATUS_SYSTEM = "https://www.cdrossi.com/fhir/CodeSystem/task-business-status";
40
+ /**
41
+ * `Task.businessStatus.coding[].code` value set by the reception role when
42
+ * marking a review as seen/checked, without confirming the underlying
43
+ * appointment.
44
+ */
45
+ export declare const TASK_BUSINESS_STATUS_REVIEWED_CODE = "reviewed";
46
+ /** `system|code` search token for `Task?business-status` filters on the reviewed state. */
47
+ export declare const TASK_BUSINESS_STATUS_REVIEWED_TOKEN = "https://www.cdrossi.com/fhir/CodeSystem/task-business-status|reviewed";
48
+ /**
49
+ * Task.code value identifying a "send appointment confirmation email" job. The
50
+ * code is fully self-describing (not an `eges-migrate-*` migration code) — these
51
+ * Tasks are produced by the appointments-portal $create flow rather than the
52
+ * EGES migration pipeline.
53
+ */
54
+ export declare const SEND_APPOINTMENT_CONFIRMATION_EMAIL_TASK_CODE = "send-appointment-confirmation-email";
55
+ /** Task.input code for the booking-session UUID (mirrors `ServiceRequest.requisition.value`). */
56
+ export declare const EMAIL_TASK_INPUT_SESSION_GROUP_ID = "session-group-id";
57
+ /** Task.input code for the recipient email address resolved from `Patient.telecom`. */
58
+ export declare const EMAIL_TASK_INPUT_RECIPIENT_EMAIL = "recipient-email";
59
+ /** Task.input code carrying `Patient/{id}` for the recipient's patient record. */
60
+ export declare const EMAIL_TASK_INPUT_PATIENT_REF = "patient-ref";
61
+ /** Task.input code for the optional IANA timezone used to format appointment times in the email. */
62
+ export declare const EMAIL_TASK_INPUT_TIMEZONE = "timezone";
63
+ /** Task.output code for the recipient email address that was actually used. */
64
+ export declare const EMAIL_TASK_OUTPUT_RECIPIENT = "recipient";
65
+ /** Task.output code for the count of appointments included in the email body. */
66
+ export declare const EMAIL_TASK_OUTPUT_APPOINTMENT_COUNT = "appointment-count";
67
+ /**
68
+ * Task.output code for the rendered email subject line. Captured on the Task
69
+ * in both success and failure paths so the rendered message can be inspected
70
+ * locally (no SMTP/SES configured) and audited in prod (no need to hunt
71
+ * through SES logs).
72
+ */
73
+ export declare const EMAIL_TASK_OUTPUT_SUBJECT = "subject";
74
+ /** Task.output code for the rendered email HTML body. Companion to `subject`/`text`. */
75
+ export declare const EMAIL_TASK_OUTPUT_HTML = "html";
76
+ /** Task.output code for the rendered email plain-text body. Companion to `subject`/`html`. */
77
+ export declare const EMAIL_TASK_OUTPUT_TEXT = "text";
78
+ /**
79
+ * Task.code for the user-invitation email. Rossi Admin invites a user
80
+ * (`sendEmail:false` so Medplum sends nothing) and enqueues this Task; the
81
+ * `send-user-invite-email` bot resolves the one-time set-password link from the
82
+ * user's `UserSecurityRequest` and sends a branded invitation email.
83
+ */
84
+ export declare const SEND_USER_INVITE_EMAIL_TASK_CODE = "send-user-invite-email";
85
+ /**
86
+ * Task.input code carrying `ProjectMembership/{id}` for the invited member. The
87
+ * bot resolves the recipient email, display name, and the `User` (for the
88
+ * one-time `UserSecurityRequest`) from that membership server-side — it never
89
+ * trusts a caller-supplied recipient, so a crafted Task cannot redirect an
90
+ * invite secret to another address.
91
+ */
92
+ export declare const INVITE_TASK_INPUT_MEMBERSHIP_REF = "invite-membership-ref";
30
93
  export declare const HL7_IMPORT_TASK_SYSTEM = "http://example.org/CodeSystem/hl7-import-tasks";
31
94
  export declare const HL7_IMPORT_APPOINTMENT_TASK_CODE = "import-orm-o01-appointment";
32
95
  export declare const HL7_IMPORT_TASK_INPUT_SYSTEM = "http://example.org/CodeSystem/hl7-import-task-inputs";
@@ -110,6 +173,15 @@ export declare const HS_SEARCH_ALIASES_EXTENSION_URL = "https://www.cdrossi.com/
110
173
  * }
111
174
  */
112
175
  export declare const HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL = "https://www.cdrossi.com/fhir/StructureDefinition/hs-search-protocol-aliases";
176
+ /** Extension URL marking a Practitioner as a technician/operator (patient-facing surfaces must hide the name). */
177
+ export declare const PRACTITIONER_IS_TECHNICIAN_EXTENSION_URL = "https://www.cdrossi.com/fhir/StructureDefinition/is-technician";
178
+ /**
179
+ * Identifier system to dedupe Communication resources auditing sent confirmation
180
+ * emails. The paired Provenance carries no identifier of its own (FHIR R4
181
+ * Provenance has no `identifier` element); it is deduped by its `target`
182
+ * reference to this Communication.
183
+ */
184
+ export declare const COMMUNICATION_EMAIL_KEY_SYSTEM = "https://www.cdrossi.com/fhir/communication-email-key";
113
185
  /** Identifier system for insurance company (payer) Organization resources */
114
186
  export declare const INSURER_IDENTIFIER_SYSTEM = "https://www.cdrossi.com/fhir/CodeSystem/insurers";
115
187
  /** HL7 organization-type code system */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,iCAAiC,CAAA;AACvD,eAAO,MAAM,gBAAgB,iCAAiC,CAAA;AAE9D,eAAO,MAAM,oBAAoB,0CAAiC,CAAA;AAClE,eAAO,MAAM,qBAAqB,4CAAmC,CAAA;AACrE,eAAO,MAAM,oBAAoB,0CAAiC,CAAA;AAClE,eAAO,MAAM,kBAAkB,wCAA+B,CAAA;AAC9D,eAAO,MAAM,6BAA6B,mDAA0C,CAAA;AACpF,eAAO,MAAM,kBAAkB,wCAA+B,CAAA;AAC9D,eAAO,MAAM,iBAAiB,uCAA8B,CAAA;AAC5D,eAAO,MAAM,oBAAoB,0CAAiC,CAAA;AAClE,eAAO,MAAM,sBAAsB,4CAAmC,CAAA;AACtE,eAAO,MAAM,YAAY,kDAAkD,CAAA;AAC3E,eAAO,MAAM,yBAAyB,qEAAuC,CAAA;AAC7E,eAAO,MAAM,2BAA2B,uEAAyC,CAAA;AAEjF,eAAO,MAAM,mCAAmC,sEAAsE,CAAA;AACtH,eAAO,MAAM,mCAAmC,uDAAuC,CAAA;AACvF,eAAO,MAAM,mBAAmB,8CAA8B,CAAA;AAE9D,eAAO,MAAM,wBAAwB,8DAA8C,CAAA;AACnF,eAAO,MAAM,gCAAgC,cAAc,CAAA;AAG3D,eAAO,MAAM,mBAAmB,uCAAuB,CAAA;AACvD,eAAO,MAAM,yBAAyB,6CAA6B,CAAA;AACnE,eAAO,MAAM,0BAA0B,8CAA8B,CAAA;AACrE,eAAO,MAAM,8BAA8B,8BAAsC,CAAA;AACjF,eAAO,MAAM,yBAAyB,yBAAiC,CAAA;AACvE,eAAO,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ACnG,eAAO,MAAM,wBAAwB,gEAAgD,CAAA;AAErF,gIAAgI;AAChI,eAAO,MAAM,mCAAmC,2EAA2D,CAAA;AAE3G;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,uEAAuD,CAAA;AAEnG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wCAAwC,gFAAgE,CAAA;AAIrH,kHAAkH;AAClH,eAAO,MAAM,wCAAwC,mEAAmD,CAAA;AAIxG;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,yDAAyC,CAAA;AAIpF,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,qDAAqC,CAAA;AAE3E,wCAAwC;AACxC,eAAO,MAAM,eAAe,4DAA4D,CAAA;AAExF,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,SAAS,CAAA;AAIxC,6EAA6E;AAC7E,eAAO,MAAM,gCAAgC,4DAA4C,CAAA;AAIzF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,sCAAsB,CAAA;AAE3D;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,kBAAkB,CAAA;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,6EAA6D,CAAA;AAErG;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,yDAAyC,CAAA;AAEtF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,6DAA6D,CAAA;AACpG,eAAO,MAAM,wBAAwB,SAAS,CAAA"}
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INSURER_IDENTIFIER_SYSTEM = exports.HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL = exports.HS_SEARCH_ALIASES_EXTENSION_URL = exports.PD_HEALTHCARE_SERVICE_EXTENSION_URL = exports.HS_BILLING_EXTENSION_URL = exports.HS_PROTOCOL_EXTENSION_URL = exports.SPECIALITY_SYSTEM = exports.SERVICE_CATEGORY_SYSTEM = exports.SERVICE_CODES_SYSTEM = exports.PD_TYPE_PROTOCOL_GROUP = exports.PD_TYPE_SYSTEM = exports.ORDER_METADATA_EXTENSION_URL = exports.MEDICAL_ORDER_DOCUMENT_CODE = exports.MEDICAL_ORDER_DOCUMENT_SYSTEM = exports.HS_ADDON_SYSTEM = exports.HS_ACTION_SYSTEM = exports.SERVICE_REQUEST_GROUP_SYSTEM = exports.HL7_IMPORT_TASK_OUTPUT_SYSTEM = exports.HL7_IMPORT_TASK_INPUT_SYSTEM = exports.HL7_IMPORT_APPOINTMENT_TASK_CODE = exports.HL7_IMPORT_TASK_SYSTEM = exports.REVIEW_APPOINTMENT_TASK_CODE = exports.MIGRATE_APPOINTMENT_TASK_CODE = exports.MIGRATE_SERVICE_TASK_CODE = exports.MIGRATE_SITE_TASK_CODE = exports.MIGRATE_DEVICE_TASK_CODE = exports.MIGRATE_PATIENT_TASK_CODE = exports.MIGRATE_PRACTITIONER_TASK_CODE = exports.MIGRATE_TASK_OUTPUT_SYSTEM = exports.MIGRATE_TASK_INPUT_SYSTEM = exports.MIGRATE_TASK_SYSTEM = exports.PRACTITIONER_ROLE_REFERRING_CODE = exports.PRACTITIONER_ROLE_SYSTEM = exports.SERVICE_TYPE_SYSTEM = exports.REQUIRES_PRACTITIONER_EXTENSION_URL = exports.SCHEDULING_PARAMETERS_EXTENSION_URL = exports.MATRICULA_PROVINCIAL_SYSTEM = exports.MATRICULA_NACIONAL_SYSTEM = exports.RENAPER_BASE = exports.EGES_PRESTACION_SYSTEM = exports.EGES_PRACTICA_SYSTEM = exports.EGES_TURNO_SYSTEM = exports.EGES_EQUIPO_SYSTEM = exports.EGES_MEDICO_ASOCIACION_SYSTEM = exports.EGES_MEDICO_SYSTEM = exports.EGES_SUCURSAL_SYSTEM = exports.EGES_DOCUMENTO_SYSTEM = exports.EGES_PACIENTE_SYSTEM = exports.EGES_SYSTEM_BASE = exports.FHIR_BASE = void 0;
4
- exports.BILLING_CID_CONTEXT_CODE = exports.BILLING_CID_CONTEXT_SYSTEM = exports.BILLING_CID_PD_IDENTIFIER_SYSTEM = exports.BILLING_CODES_ORG_EXTENSION = exports.BILLING_CODES_TAG_CODE = exports.BILLING_CODES_TAG_SYSTEM = exports.INSURANCE_PLAN_IDENTIFIER_SYSTEM = exports.ORG_TYPE_PROV_CODE = exports.ORG_TYPE_PAY_CODE = exports.ORG_TYPE_SYSTEM = void 0;
3
+ exports.HL7_IMPORT_TASK_OUTPUT_SYSTEM = exports.HL7_IMPORT_TASK_INPUT_SYSTEM = exports.HL7_IMPORT_APPOINTMENT_TASK_CODE = exports.HL7_IMPORT_TASK_SYSTEM = exports.INVITE_TASK_INPUT_MEMBERSHIP_REF = exports.SEND_USER_INVITE_EMAIL_TASK_CODE = exports.EMAIL_TASK_OUTPUT_TEXT = exports.EMAIL_TASK_OUTPUT_HTML = exports.EMAIL_TASK_OUTPUT_SUBJECT = exports.EMAIL_TASK_OUTPUT_APPOINTMENT_COUNT = exports.EMAIL_TASK_OUTPUT_RECIPIENT = exports.EMAIL_TASK_INPUT_TIMEZONE = exports.EMAIL_TASK_INPUT_PATIENT_REF = exports.EMAIL_TASK_INPUT_RECIPIENT_EMAIL = exports.EMAIL_TASK_INPUT_SESSION_GROUP_ID = exports.SEND_APPOINTMENT_CONFIRMATION_EMAIL_TASK_CODE = exports.TASK_BUSINESS_STATUS_REVIEWED_TOKEN = exports.TASK_BUSINESS_STATUS_REVIEWED_CODE = exports.TASK_BUSINESS_STATUS_SYSTEM = exports.SYNCHRONIZE_APPOINTMENT_TASK_CODE = exports.REVIEW_APPOINTMENT_TASK_CODE = exports.MIGRATE_APPOINTMENT_TASK_CODE = exports.MIGRATE_SERVICE_TASK_CODE = exports.MIGRATE_SITE_TASK_CODE = exports.MIGRATE_DEVICE_TASK_CODE = exports.MIGRATE_PATIENT_TASK_CODE = exports.MIGRATE_PRACTITIONER_TASK_CODE = exports.MIGRATE_TASK_OUTPUT_SYSTEM = exports.MIGRATE_TASK_INPUT_SYSTEM = exports.MIGRATE_TASK_SYSTEM = exports.PRACTITIONER_ROLE_REFERRING_CODE = exports.PRACTITIONER_ROLE_SYSTEM = exports.SERVICE_TYPE_SYSTEM = exports.REQUIRES_PRACTITIONER_EXTENSION_URL = exports.SCHEDULING_PARAMETERS_EXTENSION_URL = exports.MATRICULA_PROVINCIAL_SYSTEM = exports.MATRICULA_NACIONAL_SYSTEM = exports.RENAPER_BASE = exports.EGES_CONDICION_RESPUESTA_SYSTEM = exports.EGES_PRESTACION_SYSTEM = exports.EGES_PRACTICA_SYSTEM = exports.EGES_TURNO_SYSTEM = exports.EGES_EQUIPO_SYSTEM = exports.EGES_MEDICO_ASOCIACION_SYSTEM = exports.EGES_MEDICO_SYSTEM = exports.EGES_SUCURSAL_SYSTEM = exports.EGES_DOCUMENTO_SYSTEM = exports.EGES_PACIENTE_SYSTEM = exports.EGES_SYSTEM_BASE = exports.FHIR_BASE = void 0;
4
+ exports.BILLING_CID_CONTEXT_CODE = exports.BILLING_CID_CONTEXT_SYSTEM = exports.BILLING_CID_PD_IDENTIFIER_SYSTEM = exports.BILLING_CODES_ORG_EXTENSION = exports.BILLING_CODES_TAG_CODE = exports.BILLING_CODES_TAG_SYSTEM = exports.INSURANCE_PLAN_IDENTIFIER_SYSTEM = exports.ORG_TYPE_PROV_CODE = exports.ORG_TYPE_PAY_CODE = exports.ORG_TYPE_SYSTEM = exports.INSURER_IDENTIFIER_SYSTEM = exports.COMMUNICATION_EMAIL_KEY_SYSTEM = exports.PRACTITIONER_IS_TECHNICIAN_EXTENSION_URL = exports.HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL = exports.HS_SEARCH_ALIASES_EXTENSION_URL = exports.PD_HEALTHCARE_SERVICE_EXTENSION_URL = exports.HS_BILLING_EXTENSION_URL = exports.HS_PROTOCOL_EXTENSION_URL = exports.SPECIALITY_SYSTEM = exports.SERVICE_CATEGORY_SYSTEM = exports.SERVICE_CODES_SYSTEM = exports.PD_TYPE_PROTOCOL_GROUP = exports.PD_TYPE_SYSTEM = exports.ORDER_METADATA_EXTENSION_URL = exports.MEDICAL_ORDER_DOCUMENT_CODE = exports.MEDICAL_ORDER_DOCUMENT_SYSTEM = exports.HS_ADDON_SYSTEM = exports.HS_ACTION_SYSTEM = exports.SERVICE_REQUEST_GROUP_SYSTEM = void 0;
5
5
  exports.FHIR_BASE = 'https://www.cdrossi.com/fhir';
6
6
  exports.EGES_SYSTEM_BASE = 'https://www.cdrossi.com/eges';
7
7
  exports.EGES_PACIENTE_SYSTEM = `${exports.EGES_SYSTEM_BASE}/paciente`;
@@ -13,6 +13,7 @@ exports.EGES_EQUIPO_SYSTEM = `${exports.EGES_SYSTEM_BASE}/equipo`;
13
13
  exports.EGES_TURNO_SYSTEM = `${exports.EGES_SYSTEM_BASE}/turno`;
14
14
  exports.EGES_PRACTICA_SYSTEM = `${exports.EGES_SYSTEM_BASE}/practica`;
15
15
  exports.EGES_PRESTACION_SYSTEM = `${exports.EGES_SYSTEM_BASE}/prestacion`;
16
+ exports.EGES_CONDICION_RESPUESTA_SYSTEM = `${exports.EGES_SYSTEM_BASE}/condicion-respuesta`;
16
17
  exports.RENAPER_BASE = 'https://www.argentina.gob.ar/interior/renaper';
17
18
  exports.MATRICULA_NACIONAL_SYSTEM = `${exports.RENAPER_BASE}/matricula-nacional`;
18
19
  exports.MATRICULA_PROVINCIAL_SYSTEM = `${exports.RENAPER_BASE}/matricula-provincial`;
@@ -32,6 +33,68 @@ exports.MIGRATE_SITE_TASK_CODE = `${MIGRATE_TASK_BASE}-site`;
32
33
  exports.MIGRATE_SERVICE_TASK_CODE = `${MIGRATE_TASK_BASE}-service`;
33
34
  exports.MIGRATE_APPOINTMENT_TASK_CODE = `${MIGRATE_TASK_BASE}-appointment`;
34
35
  exports.REVIEW_APPOINTMENT_TASK_CODE = 'review-appointment';
36
+ exports.SYNCHRONIZE_APPOINTMENT_TASK_CODE = 'synchronize-appointment';
37
+ /**
38
+ * Coding system for `Task.businessStatus` values used by the Rossi admin
39
+ * review workflow. Distinct from `Task.status` (FHIR lifecycle), which is
40
+ * driven by the booking pipeline. `businessStatus` captures staff-side
41
+ * review state that is independent of whether the appointment has been
42
+ * confirmed in EGES.
43
+ */
44
+ exports.TASK_BUSINESS_STATUS_SYSTEM = `${exports.FHIR_BASE}/CodeSystem/task-business-status`;
45
+ /**
46
+ * `Task.businessStatus.coding[].code` value set by the reception role when
47
+ * marking a review as seen/checked, without confirming the underlying
48
+ * appointment.
49
+ */
50
+ exports.TASK_BUSINESS_STATUS_REVIEWED_CODE = 'reviewed';
51
+ /** `system|code` search token for `Task?business-status` filters on the reviewed state. */
52
+ exports.TASK_BUSINESS_STATUS_REVIEWED_TOKEN = `${exports.TASK_BUSINESS_STATUS_SYSTEM}|${exports.TASK_BUSINESS_STATUS_REVIEWED_CODE}`;
53
+ /**
54
+ * Task.code value identifying a "send appointment confirmation email" job. The
55
+ * code is fully self-describing (not an `eges-migrate-*` migration code) — these
56
+ * Tasks are produced by the appointments-portal $create flow rather than the
57
+ * EGES migration pipeline.
58
+ */
59
+ exports.SEND_APPOINTMENT_CONFIRMATION_EMAIL_TASK_CODE = 'send-appointment-confirmation-email';
60
+ /** Task.input code for the booking-session UUID (mirrors `ServiceRequest.requisition.value`). */
61
+ exports.EMAIL_TASK_INPUT_SESSION_GROUP_ID = 'session-group-id';
62
+ /** Task.input code for the recipient email address resolved from `Patient.telecom`. */
63
+ exports.EMAIL_TASK_INPUT_RECIPIENT_EMAIL = 'recipient-email';
64
+ /** Task.input code carrying `Patient/{id}` for the recipient's patient record. */
65
+ exports.EMAIL_TASK_INPUT_PATIENT_REF = 'patient-ref';
66
+ /** Task.input code for the optional IANA timezone used to format appointment times in the email. */
67
+ exports.EMAIL_TASK_INPUT_TIMEZONE = 'timezone';
68
+ /** Task.output code for the recipient email address that was actually used. */
69
+ exports.EMAIL_TASK_OUTPUT_RECIPIENT = 'recipient';
70
+ /** Task.output code for the count of appointments included in the email body. */
71
+ exports.EMAIL_TASK_OUTPUT_APPOINTMENT_COUNT = 'appointment-count';
72
+ /**
73
+ * Task.output code for the rendered email subject line. Captured on the Task
74
+ * in both success and failure paths so the rendered message can be inspected
75
+ * locally (no SMTP/SES configured) and audited in prod (no need to hunt
76
+ * through SES logs).
77
+ */
78
+ exports.EMAIL_TASK_OUTPUT_SUBJECT = 'subject';
79
+ /** Task.output code for the rendered email HTML body. Companion to `subject`/`text`. */
80
+ exports.EMAIL_TASK_OUTPUT_HTML = 'html';
81
+ /** Task.output code for the rendered email plain-text body. Companion to `subject`/`html`. */
82
+ exports.EMAIL_TASK_OUTPUT_TEXT = 'text';
83
+ /**
84
+ * Task.code for the user-invitation email. Rossi Admin invites a user
85
+ * (`sendEmail:false` so Medplum sends nothing) and enqueues this Task; the
86
+ * `send-user-invite-email` bot resolves the one-time set-password link from the
87
+ * user's `UserSecurityRequest` and sends a branded invitation email.
88
+ */
89
+ exports.SEND_USER_INVITE_EMAIL_TASK_CODE = 'send-user-invite-email';
90
+ /**
91
+ * Task.input code carrying `ProjectMembership/{id}` for the invited member. The
92
+ * bot resolves the recipient email, display name, and the `User` (for the
93
+ * one-time `UserSecurityRequest`) from that membership server-side — it never
94
+ * trusts a caller-supplied recipient, so a crafted Task cannot redirect an
95
+ * invite secret to another address.
96
+ */
97
+ exports.INVITE_TASK_INPUT_MEMBERSHIP_REF = 'invite-membership-ref';
35
98
  exports.HL7_IMPORT_TASK_SYSTEM = 'http://example.org/CodeSystem/hl7-import-tasks';
36
99
  exports.HL7_IMPORT_APPOINTMENT_TASK_CODE = 'import-orm-o01-appointment';
37
100
  exports.HL7_IMPORT_TASK_INPUT_SYSTEM = 'http://example.org/CodeSystem/hl7-import-task-inputs';
@@ -119,6 +182,17 @@ exports.HS_SEARCH_ALIASES_EXTENSION_URL = `${exports.FHIR_BASE}/StructureDefinit
119
182
  * }
120
183
  */
121
184
  exports.HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL = `${exports.FHIR_BASE}/StructureDefinition/hs-search-protocol-aliases`;
185
+ // ─── Practitioner ────────────────────────────────────────────────────────────
186
+ /** Extension URL marking a Practitioner as a technician/operator (patient-facing surfaces must hide the name). */
187
+ exports.PRACTITIONER_IS_TECHNICIAN_EXTENSION_URL = `${exports.FHIR_BASE}/StructureDefinition/is-technician`;
188
+ // ─── Email audit trail ───────────────────────────────────────────────────────
189
+ /**
190
+ * Identifier system to dedupe Communication resources auditing sent confirmation
191
+ * emails. The paired Provenance carries no identifier of its own (FHIR R4
192
+ * Provenance has no `identifier` element); it is deduped by its `target`
193
+ * reference to this Communication.
194
+ */
195
+ exports.COMMUNICATION_EMAIL_KEY_SYSTEM = `${exports.FHIR_BASE}/communication-email-key`;
122
196
  // ─── Organization (payer / insurance company) ─────────────────────────────────
123
197
  /** Identifier system for insurance company (payer) Organization resources */
124
198
  exports.INSURER_IDENTIFIER_SYSTEM = `${exports.FHIR_BASE}/CodeSystem/insurers`;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;AAAa,QAAA,SAAS,GAAG,8BAA8B,CAAA;AAC1C,QAAA,gBAAgB,GAAG,8BAA8B,CAAA;AAEjD,QAAA,oBAAoB,GAAG,GAAG,wBAAgB,WAAW,CAAA;AACrD,QAAA,qBAAqB,GAAG,GAAG,wBAAgB,aAAa,CAAA;AACxD,QAAA,oBAAoB,GAAG,GAAG,wBAAgB,WAAW,CAAA;AACrD,QAAA,kBAAkB,GAAG,GAAG,wBAAgB,SAAS,CAAA;AACjD,QAAA,6BAA6B,GAAG,GAAG,wBAAgB,oBAAoB,CAAA;AACvE,QAAA,kBAAkB,GAAG,GAAG,wBAAgB,SAAS,CAAA;AACjD,QAAA,iBAAiB,GAAG,GAAG,wBAAgB,QAAQ,CAAA;AAC/C,QAAA,oBAAoB,GAAG,GAAG,wBAAgB,WAAW,CAAA;AACrD,QAAA,sBAAsB,GAAG,G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;AACpC,QAAA,iBAAiB,GAAG,KAAK,CAAA;AAEtC,uEAAuE;AAC1D,QAAA,kBAAkB,GAAG,MAAM,CAAA;AAExC,iFAAiF;AAEjF,6EAA6E;AAChE,QAAA,gCAAgC,GAAG,GAAG,iBAAS,6BAA6B,CAAA;AAEzF,gFAAgF;AAEhF;;;GAGG;AACU,QAAA,wBAAwB,GAAG,GAAG,iBAAS,OAAO,CAAA;AAE3D;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,eAAe,CAAA;AAErD;;;;;;;;GAQG;AACU,QAAA,2BAA2B,GAAG,GAAG,iBAAS,8CAA8C,CAAA;AAErG;;;;;GAKG;AACU,QAAA,gCAAgC,GAAG,GAAG,iBAAS,0BAA0B,CAAA;AAEtF;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,0DAA0D,CAAA;AACvF,QAAA,wBAAwB,GAAG,MAAM,CAAA","sourcesContent":["export const FHIR_BASE = 'https://www.cdrossi.com/fhir'\nexport const EGES_SYSTEM_BASE = 'https://www.cdrossi.com/eges'\n\nexport const EGES_PACIENTE_SYSTEM = `${EGES_SYSTEM_BASE}/paciente`\nexport const EGES_DOCUMENTO_SYSTEM = `${EGES_SYSTEM_BASE}/documentos`\nexport const EGES_SUCURSAL_SYSTEM = `${EGES_SYSTEM_BASE}/sucursal`\nexport const EGES_MEDICO_SYSTEM = `${EGES_SYSTEM_BASE}/medico`\nexport const EGES_MEDICO_ASOCIACION_SYSTEM = `${EGES_SYSTEM_BASE}/medico-asociacion`\nexport const EGES_EQUIPO_SYSTEM = `${EGES_SYSTEM_BASE}/equipo`\nexport const EGES_TURNO_SYSTEM = `${EGES_SYSTEM_BASE}/turno`\nexport const EGES_PRACTICA_SYSTEM = `${EGES_SYSTEM_BASE}/practica`\nexport const EGES_PRESTACION_SYSTEM = `${EGES_SYSTEM_BASE}/prestacion`\nexport const RENAPER_BASE = 'https://www.argentina.gob.ar/interior/renaper'\nexport const MATRICULA_NACIONAL_SYSTEM = `${RENAPER_BASE}/matricula-nacional`\nexport const MATRICULA_PROVINCIAL_SYSTEM = `${RENAPER_BASE}/matricula-provincial`\n\nexport const SCHEDULING_PARAMETERS_EXTENSION_URL = 'http://medplum.com/fhir/StructureDefinition/scheduling-parameters'\nexport const REQUIRES_PRACTITIONER_EXTENSION_URL = `${FHIR_BASE}/requires-practitioner`\nexport const SERVICE_TYPE_SYSTEM = `${FHIR_BASE}/service-type`\n\nexport const PRACTITIONER_ROLE_SYSTEM = `${FHIR_BASE}/CodeSystem/practitioner-role`\nexport const PRACTITIONER_ROLE_REFERRING_CODE = 'referring'\n\nconst MIGRATE_TASK_BASE = 'eges-migrate'\nexport const MIGRATE_TASK_SYSTEM = `${FHIR_BASE}/tasks`\nexport const MIGRATE_TASK_INPUT_SYSTEM = `${FHIR_BASE}/task-inputs`\nexport const MIGRATE_TASK_OUTPUT_SYSTEM = `${FHIR_BASE}/task-outputs`\nexport const MIGRATE_PRACTITIONER_TASK_CODE = `${MIGRATE_TASK_BASE}-practitioner`\nexport const MIGRATE_PATIENT_TASK_CODE = `${MIGRATE_TASK_BASE}-patient`\nexport const MIGRATE_DEVICE_TASK_CODE = `${MIGRATE_TASK_BASE}-device`\nexport const MIGRATE_SITE_TASK_CODE = `${MIGRATE_TASK_BASE}-site`\nexport const MIGRATE_SERVICE_TASK_CODE = `${MIGRATE_TASK_BASE}-service`\nexport const MIGRATE_APPOINTMENT_TASK_CODE = `${MIGRATE_TASK_BASE}-appointment`\nexport const REVIEW_APPOINTMENT_TASK_CODE = 'review-appointment'\n\nexport const HL7_IMPORT_TASK_SYSTEM = 'http://example.org/CodeSystem/hl7-import-tasks'\nexport const HL7_IMPORT_APPOINTMENT_TASK_CODE = 'import-orm-o01-appointment'\nexport const HL7_IMPORT_TASK_INPUT_SYSTEM = 'http://example.org/CodeSystem/hl7-import-task-inputs'\nexport const HL7_IMPORT_TASK_OUTPUT_SYSTEM = 'http://example.org/CodeSystem/hl7-import-task-outputs'\n\n// ─── ServiceRequest ──────────────────────────────────────────────────────────\n\n/**\n * Identifier system used as `ServiceRequest.requisition.system` to correlate\n * multiple ServiceRequests (one per Appointment) authored in the same\n * appointments-portal wizard session. Maps to FHIR R4 `requisition` — \"A\n * shared identifier common to all service requests that were authorized more\n * or less simultaneously by a single author, representing the composite or\n * group identifier.\"\n */\nexport const SERVICE_REQUEST_GROUP_SYSTEM = `${FHIR_BASE}/service-request-group`\n\n/**\n * Coding system for HealthcareService action (variant) selections recorded\n * on `ServiceRequest.orderDetail[]`. The `code` is the PlanDefinition action\n * id from the contained protocol on the HealthcareService, and `display` is\n * the human-readable action label (e.g. \"Frente y perfil\").\n */\nexport const HS_ACTION_SYSTEM = `${FHIR_BASE}/CodeSystem/hs-action`\n\n/**\n * Coding system for HealthcareService addon selections recorded on\n * `ServiceRequest.orderDetail[]`. Same id/label shape as HS_ACTION_SYSTEM —\n * the distinct URI lets readers filter action vs. addons without ordering\n * assumptions on orderDetail.\n */\nexport const HS_ADDON_SYSTEM = `${FHIR_BASE}/CodeSystem/hs-addon`\n\n// ─── Medical order documents (portal requisitions) ──────────────────────────\n\n/**\n * Coding system used on `DocumentReference.type` for portal-uploaded medical\n * orders. Doubles as an identifier system so we can dedupe a `(session, order)`\n * pair across the sibling `Appointment/$create` calls the portal issues in\n * parallel for a multi-study booking.\n */\nexport const MEDICAL_ORDER_DOCUMENT_SYSTEM = `${FHIR_BASE}/CodeSystem/medical-order-document`\n\n/** `DocumentReference.type.coding[0].code` value paired with MEDICAL_ORDER_DOCUMENT_SYSTEM. */\nexport const MEDICAL_ORDER_DOCUMENT_CODE = 'medical-order'\n\n/**\n * Complex extension attached to DocumentReference. Sub-extensions carry the\n * structured OCR metadata (doctor, diagnosis, insurer, plan, patient data, …)\n * the appointments-portal parses from each scanned medical order.\n */\nexport const ORDER_METADATA_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/order-metadata`\n\n// ─── PlanDefinition type ─────────────────────────────────────────────────────\n\n/** Coding system for custom PlanDefinition types */\nexport const PD_TYPE_SYSTEM = `${FHIR_BASE}/CodeSystem/plan-definition-type`\n\n/** Type code that marks a PlanDefinition as a protocol-group (wrapping multiple concrete PDs) */\nexport const PD_TYPE_PROTOCOL_GROUP = 'protocol-group'\n\n// ─── HealthcareService model ──────────────────────────────────────────────────\n\n/** Identifier system for service codes on HealthcareService (mirrors the ServiceCodes CodeSystem URL) */\nexport const SERVICE_CODES_SYSTEM = `${FHIR_BASE}/CodeSystem/service-codes`\n\n/** Coding system for service categories on HealthcareService.category */\nexport const SERVICE_CATEGORY_SYSTEM = `${FHIR_BASE}/CodeSystem/service-category`\n\n/** Coding system for specialities on HealthcareService.specialty */\nexport const SPECIALITY_SYSTEM = `${FHIR_BASE}/CodeSystem/speciality`\n\n/** Extension URL for the mandatory PlanDefinition (clinical protocol) reference on HealthcareService */\nexport const HS_PROTOCOL_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-protocol`\n\n/** Extension URL for the optional ChargeItemDefinition (billing) reference on HealthcareService */\nexport const HS_BILLING_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-billing`\n\n/** Extension URL for the back-reference to the HealthcareService (study) for which this PlanDefinition is the protocol group */\nexport const PD_HEALTHCARE_SERVICE_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/pd-healthcare-service`\n\n/**\n * Extension URL for additional search aliases on HealthcareService.\n *\n * Stored as multiple same-URL extensions, each with a `valueString`.\n * These are indexed at weight 1.2 by the search indexer.\n * Using an extension instead of HealthcareService.alias[] because the local\n * FHIR profile does not permit the standard alias field.\n *\n * @example\n * { url: HS_SEARCH_ALIASES_EXTENSION_URL, valueString: \"placa de tórax\" }\n */\nexport const HS_SEARCH_ALIASES_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-search-aliases`\n\n/**\n * @example\n * {\n * url: HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL,\n * extension: [\n * { url: \"alias\", valueString: \"placa de tórax\" },\n * { url: \"protocol\", valueString: \"9a9056df-0e54-4c2a-a3ce-eb58405f1ec9\" },\n * { url: \"addon\", valueString: \"a7101b76-6f1a-4562-8689-edaee07d6b95\" },\n * { url: \"addon\", valueString: \"97b7c2ce-6f1a-4562-8689-f21a8673e009\" }\n * ]\n * }\n */\nexport const HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-search-protocol-aliases`\n\n// ─── Organization (payer / insurance company) ─────────────────────────────────\n\n/** Identifier system for insurance company (payer) Organization resources */\nexport const INSURER_IDENTIFIER_SYSTEM = `${FHIR_BASE}/CodeSystem/insurers`\n\n/** HL7 organization-type code system */\nexport const ORG_TYPE_SYSTEM = 'http://terminology.hl7.org/CodeSystem/organization-type'\n\n/** organization-type code for payer/insurance */\nexport const ORG_TYPE_PAY_CODE = 'pay'\n\n/** organization-type code for healthcare provider (the main clinic) */\nexport const ORG_TYPE_PROV_CODE = 'prov'\n\n// ─── InsurancePlan ────────────────────────────────────────────────────────────\n\n/** Identifier system for InsurancePlan resources (specific plan products) */\nexport const INSURANCE_PLAN_IDENTIFIER_SYSTEM = `${FHIR_BASE}/CodeSystem/insurance-plans`\n\n// ─── Billing CodeSystem discovery tag ────────────────────────────────────────\n\n/**\n * Tag system applied to every billing-codes CodeSystem resource,\n * enabling dynamic discovery via `CodeSystem?_tag=<system>|<code>`.\n */\nexport const BILLING_CODES_TAG_SYSTEM = `${FHIR_BASE}/tags`\n\n/**\n * Tag code that marks a CodeSystem as a billing codes system.\n * Every billing CodeSystem must carry:\n * meta.tag = [{ system: BILLING_CODES_TAG_SYSTEM, code: BILLING_CODES_TAG_CODE }]\n */\nexport const BILLING_CODES_TAG_CODE = 'billing-codes'\n\n/**\n * Extension URL stored on a billing CodeSystem to record which billing\n * Organization (obra social) owns / uses this billing code system.\n *\n * Value type: Reference (Organization)\n *\n * Example:\n * extension: [{ url: BILLING_CODES_ORG_EXTENSION, valueReference: { reference: 'Organization/123' } }]\n */\nexport const BILLING_CODES_ORG_EXTENSION = `${FHIR_BASE}/extensions/billing-code-system-organization`\n\n/**\n * Identifier system used to tag every billing ChargeItemDefinition with the ID\n * of the PlanDefinition it belongs to, enabling reliable search via\n * `ChargeItemDefinition?identifier=<system>|<planDefinitionId>`.\n * (The FHIR R4 `instance` search parameter is not supported by Medplum.)\n */\nexport const BILLING_CID_PD_IDENTIFIER_SYSTEM = `${FHIR_BASE}/billing/plan-definition`\n\n/**\n * Usage-context type system used to scope a ChargeItemDefinition to a specific InsurancePlan.\n * useContext.code.system = BILLING_CID_CONTEXT_SYSTEM\n * useContext.code.code = BILLING_CID_CONTEXT_CODE\n * useContext.valueReference → InsurancePlan\n */\nexport const BILLING_CID_CONTEXT_SYSTEM = 'http://terminology.hl7.org/CodeSystem/usage-context-type'\nexport const BILLING_CID_CONTEXT_CODE = 'user'\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;AAAa,QAAA,SAAS,GAAG,8BAA8B,CAAA;AAC1C,QAAA,gBAAgB,GAAG,8BAA8B,CAAA;AAEjD,QAAA,oBAAoB,GAAG,GAAG,wBAAgB,WAAW,CAAA;AACrD,QAAA,qBAAqB,GAAG,GAAG,wBAAgB,aAAa,CAAA;AACxD,QAAA,oBAAoB,GAAG,GAAG,wBAAgB,WAAW,CAAA;AACrD,QAAA,kBAAkB,GAAG,GAAG,wBAAgB,SAAS,CAAA;AACjD,QAAA,6BAA6B,GAAG,GAAG,wBAAgB,oBAAoB,CAAA;AACvE,QAAA,kBAAkB,GAAG,GAAG,wBAAgB,SAAS,CAAA;AACjD,QAAA,iBAAiB,GAAG,GAAG,wBAAgB,QAAQ,CAAA;AAC/C,QAAA,oBAAoB,GAAG,GAAG,wBAAgB,WAAW,CAAA;AACrD,QAAA,sBAAsB,GAAG,GAAG,wBAAgB,aAAa,CAAA;AACzD,QAAA,+BAA+B,GAAG,GAAG,wBAAgB,sBAAsB,CAAA;AAC3E,QAAA,YAAY,GAAG,+CAA+C,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hF;;;GAGG;AACU,QAAA,wBAAwB,GAAG,GAAG,iBAAS,OAAO,CAAA;AAE3D;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,eAAe,CAAA;AAErD;;;;;;;;GAQG;AACU,QAAA,2BAA2B,GAAG,GAAG,iBAAS,8CAA8C,CAAA;AAErG;;;;;GAKG;AACU,QAAA,gCAAgC,GAAG,GAAG,iBAAS,0BAA0B,CAAA;AAEtF;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,0DAA0D,CAAA;AACvF,QAAA,wBAAwB,GAAG,MAAM,CAAA","sourcesContent":["export const FHIR_BASE = 'https://www.cdrossi.com/fhir'\nexport const EGES_SYSTEM_BASE = 'https://www.cdrossi.com/eges'\n\nexport const EGES_PACIENTE_SYSTEM = `${EGES_SYSTEM_BASE}/paciente`\nexport const EGES_DOCUMENTO_SYSTEM = `${EGES_SYSTEM_BASE}/documentos`\nexport const EGES_SUCURSAL_SYSTEM = `${EGES_SYSTEM_BASE}/sucursal`\nexport const EGES_MEDICO_SYSTEM = `${EGES_SYSTEM_BASE}/medico`\nexport const EGES_MEDICO_ASOCIACION_SYSTEM = `${EGES_SYSTEM_BASE}/medico-asociacion`\nexport const EGES_EQUIPO_SYSTEM = `${EGES_SYSTEM_BASE}/equipo`\nexport const EGES_TURNO_SYSTEM = `${EGES_SYSTEM_BASE}/turno`\nexport const EGES_PRACTICA_SYSTEM = `${EGES_SYSTEM_BASE}/practica`\nexport const EGES_PRESTACION_SYSTEM = `${EGES_SYSTEM_BASE}/prestacion`\nexport const EGES_CONDICION_RESPUESTA_SYSTEM = `${EGES_SYSTEM_BASE}/condicion-respuesta`\nexport const RENAPER_BASE = 'https://www.argentina.gob.ar/interior/renaper'\nexport const MATRICULA_NACIONAL_SYSTEM = `${RENAPER_BASE}/matricula-nacional`\nexport const MATRICULA_PROVINCIAL_SYSTEM = `${RENAPER_BASE}/matricula-provincial`\n\nexport const SCHEDULING_PARAMETERS_EXTENSION_URL = 'http://medplum.com/fhir/StructureDefinition/scheduling-parameters'\nexport const REQUIRES_PRACTITIONER_EXTENSION_URL = `${FHIR_BASE}/requires-practitioner`\nexport const SERVICE_TYPE_SYSTEM = `${FHIR_BASE}/service-type`\n\nexport const PRACTITIONER_ROLE_SYSTEM = `${FHIR_BASE}/CodeSystem/practitioner-role`\nexport const PRACTITIONER_ROLE_REFERRING_CODE = 'referring'\n\nconst MIGRATE_TASK_BASE = 'eges-migrate'\nexport const MIGRATE_TASK_SYSTEM = `${FHIR_BASE}/tasks`\nexport const MIGRATE_TASK_INPUT_SYSTEM = `${FHIR_BASE}/task-inputs`\nexport const MIGRATE_TASK_OUTPUT_SYSTEM = `${FHIR_BASE}/task-outputs`\nexport const MIGRATE_PRACTITIONER_TASK_CODE = `${MIGRATE_TASK_BASE}-practitioner`\nexport const MIGRATE_PATIENT_TASK_CODE = `${MIGRATE_TASK_BASE}-patient`\nexport const MIGRATE_DEVICE_TASK_CODE = `${MIGRATE_TASK_BASE}-device`\nexport const MIGRATE_SITE_TASK_CODE = `${MIGRATE_TASK_BASE}-site`\nexport const MIGRATE_SERVICE_TASK_CODE = `${MIGRATE_TASK_BASE}-service`\nexport const MIGRATE_APPOINTMENT_TASK_CODE = `${MIGRATE_TASK_BASE}-appointment`\nexport const REVIEW_APPOINTMENT_TASK_CODE = 'review-appointment'\nexport const SYNCHRONIZE_APPOINTMENT_TASK_CODE = 'synchronize-appointment'\n\n/**\n * Coding system for `Task.businessStatus` values used by the Rossi admin\n * review workflow. Distinct from `Task.status` (FHIR lifecycle), which is\n * driven by the booking pipeline. `businessStatus` captures staff-side\n * review state that is independent of whether the appointment has been\n * confirmed in EGES.\n */\nexport const TASK_BUSINESS_STATUS_SYSTEM = `${FHIR_BASE}/CodeSystem/task-business-status`\n\n/**\n * `Task.businessStatus.coding[].code` value set by the reception role when\n * marking a review as seen/checked, without confirming the underlying\n * appointment.\n */\nexport const TASK_BUSINESS_STATUS_REVIEWED_CODE = 'reviewed'\n\n/** `system|code` search token for `Task?business-status` filters on the reviewed state. */\nexport const TASK_BUSINESS_STATUS_REVIEWED_TOKEN =\n `${TASK_BUSINESS_STATUS_SYSTEM}|${TASK_BUSINESS_STATUS_REVIEWED_CODE}`\n\n/**\n * Task.code value identifying a \"send appointment confirmation email\" job. The\n * code is fully self-describing (not an `eges-migrate-*` migration code) — these\n * Tasks are produced by the appointments-portal $create flow rather than the\n * EGES migration pipeline.\n */\nexport const SEND_APPOINTMENT_CONFIRMATION_EMAIL_TASK_CODE = 'send-appointment-confirmation-email'\n\n/** Task.input code for the booking-session UUID (mirrors `ServiceRequest.requisition.value`). */\nexport const EMAIL_TASK_INPUT_SESSION_GROUP_ID = 'session-group-id'\n\n/** Task.input code for the recipient email address resolved from `Patient.telecom`. */\nexport const EMAIL_TASK_INPUT_RECIPIENT_EMAIL = 'recipient-email'\n\n/** Task.input code carrying `Patient/{id}` for the recipient's patient record. */\nexport const EMAIL_TASK_INPUT_PATIENT_REF = 'patient-ref'\n\n/** Task.input code for the optional IANA timezone used to format appointment times in the email. */\nexport const EMAIL_TASK_INPUT_TIMEZONE = 'timezone'\n\n/** Task.output code for the recipient email address that was actually used. */\nexport const EMAIL_TASK_OUTPUT_RECIPIENT = 'recipient'\n\n/** Task.output code for the count of appointments included in the email body. */\nexport const EMAIL_TASK_OUTPUT_APPOINTMENT_COUNT = 'appointment-count'\n\n/**\n * Task.output code for the rendered email subject line. Captured on the Task\n * in both success and failure paths so the rendered message can be inspected\n * locally (no SMTP/SES configured) and audited in prod (no need to hunt\n * through SES logs).\n */\nexport const EMAIL_TASK_OUTPUT_SUBJECT = 'subject'\n\n/** Task.output code for the rendered email HTML body. Companion to `subject`/`text`. */\nexport const EMAIL_TASK_OUTPUT_HTML = 'html'\n\n/** Task.output code for the rendered email plain-text body. Companion to `subject`/`html`. */\nexport const EMAIL_TASK_OUTPUT_TEXT = 'text'\n\n/**\n * Task.code for the user-invitation email. Rossi Admin invites a user\n * (`sendEmail:false` so Medplum sends nothing) and enqueues this Task; the\n * `send-user-invite-email` bot resolves the one-time set-password link from the\n * user's `UserSecurityRequest` and sends a branded invitation email.\n */\nexport const SEND_USER_INVITE_EMAIL_TASK_CODE = 'send-user-invite-email'\n\n/**\n * Task.input code carrying `ProjectMembership/{id}` for the invited member. The\n * bot resolves the recipient email, display name, and the `User` (for the\n * one-time `UserSecurityRequest`) from that membership server-side — it never\n * trusts a caller-supplied recipient, so a crafted Task cannot redirect an\n * invite secret to another address.\n */\nexport const INVITE_TASK_INPUT_MEMBERSHIP_REF = 'invite-membership-ref'\n\nexport const HL7_IMPORT_TASK_SYSTEM = 'http://example.org/CodeSystem/hl7-import-tasks'\nexport const HL7_IMPORT_APPOINTMENT_TASK_CODE = 'import-orm-o01-appointment'\nexport const HL7_IMPORT_TASK_INPUT_SYSTEM = 'http://example.org/CodeSystem/hl7-import-task-inputs'\nexport const HL7_IMPORT_TASK_OUTPUT_SYSTEM = 'http://example.org/CodeSystem/hl7-import-task-outputs'\n\n// ─── ServiceRequest ──────────────────────────────────────────────────────────\n\n/**\n * Identifier system used as `ServiceRequest.requisition.system` to correlate\n * multiple ServiceRequests (one per Appointment) authored in the same\n * appointments-portal wizard session. Maps to FHIR R4 `requisition` — \"A\n * shared identifier common to all service requests that were authorized more\n * or less simultaneously by a single author, representing the composite or\n * group identifier.\"\n */\nexport const SERVICE_REQUEST_GROUP_SYSTEM = `${FHIR_BASE}/service-request-group`\n\n/**\n * Coding system for HealthcareService action (variant) selections recorded\n * on `ServiceRequest.orderDetail[]`. The `code` is the PlanDefinition action\n * id from the contained protocol on the HealthcareService, and `display` is\n * the human-readable action label (e.g. \"Frente y perfil\").\n */\nexport const HS_ACTION_SYSTEM = `${FHIR_BASE}/CodeSystem/hs-action`\n\n/**\n * Coding system for HealthcareService addon selections recorded on\n * `ServiceRequest.orderDetail[]`. Same id/label shape as HS_ACTION_SYSTEM —\n * the distinct URI lets readers filter action vs. addons without ordering\n * assumptions on orderDetail.\n */\nexport const HS_ADDON_SYSTEM = `${FHIR_BASE}/CodeSystem/hs-addon`\n\n// ─── Medical order documents (portal requisitions) ──────────────────────────\n\n/**\n * Coding system used on `DocumentReference.type` for portal-uploaded medical\n * orders. Doubles as an identifier system so we can dedupe a `(session, order)`\n * pair across the sibling `Appointment/$create` calls the portal issues in\n * parallel for a multi-study booking.\n */\nexport const MEDICAL_ORDER_DOCUMENT_SYSTEM = `${FHIR_BASE}/CodeSystem/medical-order-document`\n\n/** `DocumentReference.type.coding[0].code` value paired with MEDICAL_ORDER_DOCUMENT_SYSTEM. */\nexport const MEDICAL_ORDER_DOCUMENT_CODE = 'medical-order'\n\n/**\n * Complex extension attached to DocumentReference. Sub-extensions carry the\n * structured OCR metadata (doctor, diagnosis, insurer, plan, patient data, …)\n * the appointments-portal parses from each scanned medical order.\n */\nexport const ORDER_METADATA_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/order-metadata`\n\n// ─── PlanDefinition type ─────────────────────────────────────────────────────\n\n/** Coding system for custom PlanDefinition types */\nexport const PD_TYPE_SYSTEM = `${FHIR_BASE}/CodeSystem/plan-definition-type`\n\n/** Type code that marks a PlanDefinition as a protocol-group (wrapping multiple concrete PDs) */\nexport const PD_TYPE_PROTOCOL_GROUP = 'protocol-group'\n\n// ─── HealthcareService model ──────────────────────────────────────────────────\n\n/** Identifier system for service codes on HealthcareService (mirrors the ServiceCodes CodeSystem URL) */\nexport const SERVICE_CODES_SYSTEM = `${FHIR_BASE}/CodeSystem/service-codes`\n\n/** Coding system for service categories on HealthcareService.category */\nexport const SERVICE_CATEGORY_SYSTEM = `${FHIR_BASE}/CodeSystem/service-category`\n\n/** Coding system for specialities on HealthcareService.specialty */\nexport const SPECIALITY_SYSTEM = `${FHIR_BASE}/CodeSystem/speciality`\n\n/** Extension URL for the mandatory PlanDefinition (clinical protocol) reference on HealthcareService */\nexport const HS_PROTOCOL_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-protocol`\n\n/** Extension URL for the optional ChargeItemDefinition (billing) reference on HealthcareService */\nexport const HS_BILLING_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-billing`\n\n/** Extension URL for the back-reference to the HealthcareService (study) for which this PlanDefinition is the protocol group */\nexport const PD_HEALTHCARE_SERVICE_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/pd-healthcare-service`\n\n/**\n * Extension URL for additional search aliases on HealthcareService.\n *\n * Stored as multiple same-URL extensions, each with a `valueString`.\n * These are indexed at weight 1.2 by the search indexer.\n * Using an extension instead of HealthcareService.alias[] because the local\n * FHIR profile does not permit the standard alias field.\n *\n * @example\n * { url: HS_SEARCH_ALIASES_EXTENSION_URL, valueString: \"placa de tórax\" }\n */\nexport const HS_SEARCH_ALIASES_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-search-aliases`\n\n/**\n * @example\n * {\n * url: HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL,\n * extension: [\n * { url: \"alias\", valueString: \"placa de tórax\" },\n * { url: \"protocol\", valueString: \"9a9056df-0e54-4c2a-a3ce-eb58405f1ec9\" },\n * { url: \"addon\", valueString: \"a7101b76-6f1a-4562-8689-edaee07d6b95\" },\n * { url: \"addon\", valueString: \"97b7c2ce-6f1a-4562-8689-f21a8673e009\" }\n * ]\n * }\n */\nexport const HS_SEARCH_PROTOCOL_ALIASES_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/hs-search-protocol-aliases`\n\n// ─── Practitioner ────────────────────────────────────────────────────────────\n\n/** Extension URL marking a Practitioner as a technician/operator (patient-facing surfaces must hide the name). */\nexport const PRACTITIONER_IS_TECHNICIAN_EXTENSION_URL = `${FHIR_BASE}/StructureDefinition/is-technician`\n\n// ─── Email audit trail ───────────────────────────────────────────────────────\n\n/**\n * Identifier system to dedupe Communication resources auditing sent confirmation\n * emails. The paired Provenance carries no identifier of its own (FHIR R4\n * Provenance has no `identifier` element); it is deduped by its `target`\n * reference to this Communication.\n */\nexport const COMMUNICATION_EMAIL_KEY_SYSTEM = `${FHIR_BASE}/communication-email-key`\n\n// ─── Organization (payer / insurance company) ─────────────────────────────────\n\n/** Identifier system for insurance company (payer) Organization resources */\nexport const INSURER_IDENTIFIER_SYSTEM = `${FHIR_BASE}/CodeSystem/insurers`\n\n/** HL7 organization-type code system */\nexport const ORG_TYPE_SYSTEM = 'http://terminology.hl7.org/CodeSystem/organization-type'\n\n/** organization-type code for payer/insurance */\nexport const ORG_TYPE_PAY_CODE = 'pay'\n\n/** organization-type code for healthcare provider (the main clinic) */\nexport const ORG_TYPE_PROV_CODE = 'prov'\n\n// ─── InsurancePlan ────────────────────────────────────────────────────────────\n\n/** Identifier system for InsurancePlan resources (specific plan products) */\nexport const INSURANCE_PLAN_IDENTIFIER_SYSTEM = `${FHIR_BASE}/CodeSystem/insurance-plans`\n\n// ─── Billing CodeSystem discovery tag ────────────────────────────────────────\n\n/**\n * Tag system applied to every billing-codes CodeSystem resource,\n * enabling dynamic discovery via `CodeSystem?_tag=<system>|<code>`.\n */\nexport const BILLING_CODES_TAG_SYSTEM = `${FHIR_BASE}/tags`\n\n/**\n * Tag code that marks a CodeSystem as a billing codes system.\n * Every billing CodeSystem must carry:\n * meta.tag = [{ system: BILLING_CODES_TAG_SYSTEM, code: BILLING_CODES_TAG_CODE }]\n */\nexport const BILLING_CODES_TAG_CODE = 'billing-codes'\n\n/**\n * Extension URL stored on a billing CodeSystem to record which billing\n * Organization (obra social) owns / uses this billing code system.\n *\n * Value type: Reference (Organization)\n *\n * Example:\n * extension: [{ url: BILLING_CODES_ORG_EXTENSION, valueReference: { reference: 'Organization/123' } }]\n */\nexport const BILLING_CODES_ORG_EXTENSION = `${FHIR_BASE}/extensions/billing-code-system-organization`\n\n/**\n * Identifier system used to tag every billing ChargeItemDefinition with the ID\n * of the PlanDefinition it belongs to, enabling reliable search via\n * `ChargeItemDefinition?identifier=<system>|<planDefinitionId>`.\n * (The FHIR R4 `instance` search parameter is not supported by Medplum.)\n */\nexport const BILLING_CID_PD_IDENTIFIER_SYSTEM = `${FHIR_BASE}/billing/plan-definition`\n\n/**\n * Usage-context type system used to scope a ChargeItemDefinition to a specific InsurancePlan.\n * useContext.code.system = BILLING_CID_CONTEXT_SYSTEM\n * useContext.code.code = BILLING_CID_CONTEXT_CODE\n * useContext.valueReference → InsurancePlan\n */\nexport const BILLING_CID_CONTEXT_SYSTEM = 'http://terminology.hl7.org/CodeSystem/usage-context-type'\nexport const BILLING_CID_CONTEXT_CODE = 'user'\n"]}
@@ -1,4 +1,35 @@
1
- import type { Duration, PlanDefinition } from '@medplum/fhirtypes';
1
+ import type { Duration, PlanDefinition, PlanDefinitionAction } from '@medplum/fhirtypes';
2
+ /**
3
+ * `action.id` of the per-variant group that overrides the order-set PD's
4
+ * default mandatory add-ons (the tipo-3 `getMandatoryAddonIds` path). It lives
5
+ * as a direct child of a protocol-group variant action, kept structurally
6
+ * separate from the variant's own add-on sub-actions (the tipo-2
7
+ * `resolveProtocolSelection` path) so the two never conflate. Its group node
8
+ * carries no `definitionCanonical`, so `resolveProtocolSelection`,
9
+ * `getProtocolActions` and friends skip it and never descend into it.
10
+ */
11
+ export declare const MANDATORY_ADDON_OVERRIDE_ACTION_ID = "mandatory-addons";
12
+ /**
13
+ * How a variant alters one order-set default mandatory add-on:
14
+ * - `'add'` forces the add-on mandatory for this variant even if the order-set
15
+ * PD marks it optional (or does not list it as mandatory).
16
+ * - `'remove'` drops an add-on that the order-set PD marks mandatory by default.
17
+ */
18
+ export type MandatoryAddonOverrideAction = 'add' | 'remove';
19
+ /**
20
+ * A single per-variant override of the order-set's default mandatory add-on set
21
+ * (the tipo-3 path). Referenced by the add-on's `ActivityDefinition` canonical
22
+ * (`${EGES_PRACTICA_SYSTEM}/{pra_id}`) — the same canonical the order-set PD
23
+ * uses — so add/remove resolve by exact canonical match against the defaults.
24
+ */
25
+ export interface MandatoryAddonOverride {
26
+ /** Add-on `ActivityDefinition` canonical, e.g. `${EGES_PRACTICA_SYSTEM}/{pra_id}`. */
27
+ readonly ref: string;
28
+ /** Whether the variant adds or removes this add-on relative to the PD default. */
29
+ readonly action: MandatoryAddonOverrideAction;
30
+ /** Optional human label, for the admin editor. */
31
+ readonly display?: string;
32
+ }
2
33
  /** Information about a single action inside a protocol-group PD. */
3
34
  export interface ProtocolActionInfo {
4
35
  readonly actionId: string;
@@ -26,6 +57,12 @@ export interface ProtocolActionInfo {
26
57
  readonly mandatory?: boolean;
27
58
  /** Optional sub-actions (addons) with `any` selection behavior. */
28
59
  readonly addons: readonly ProtocolActionInfo[];
60
+ /**
61
+ * Per-variant overrides of the order-set's default mandatory add-on set
62
+ * (tipo-3 path). Empty when the variant inherits the PD defaults unchanged.
63
+ * Only meaningful on top-level variant entries.
64
+ */
65
+ readonly mandatoryAddonOverrides: readonly MandatoryAddonOverride[];
29
66
  }
30
67
  /** Entry used to build a protocol-group PD action. */
31
68
  export interface ProtocolGroupActionEntry {
@@ -44,6 +81,12 @@ export interface ProtocolGroupActionEntry {
44
81
  readonly mandatory?: boolean;
45
82
  /** Optional sub-action entries (addons). */
46
83
  readonly addons?: readonly ProtocolGroupActionEntry[];
84
+ /**
85
+ * Per-variant overrides of the order-set's default mandatory add-on set
86
+ * (tipo-3 path). Only meaningful on top-level variant entries; ignored on
87
+ * addon entries.
88
+ */
89
+ readonly mandatoryAddonOverrides?: readonly MandatoryAddonOverride[];
47
90
  }
48
91
  /** @deprecated Use {@link ProtocolActionInfo} instead. */
49
92
  export type ProtocolVariantInfo = ProtocolActionInfo;
@@ -169,4 +212,24 @@ export declare function resolveProtocolSelection(pd: PlanDefinition, selection:
169
212
  * @returns the selection encoded in the PD, or the default selection
170
213
  */
171
214
  export declare function readProtocolSelection(pd: PlanDefinition): ProtocolSelection;
215
+ /**
216
+ * Reads the per-variant mandatory-addon overrides out of a variant action's
217
+ * `mandatory-addons` group. Returns `[]` when the variant declares none.
218
+ *
219
+ * @param variantAction - a protocol-group top-level variant action
220
+ * @returns the variant's mandatory-addon overrides (empty when none)
221
+ */
222
+ export declare function readMandatoryAddonOverrides(variantAction: PlanDefinitionAction): MandatoryAddonOverride[];
223
+ /**
224
+ * Resolves the effective mandatory add-on canonicals for a selected variant:
225
+ * the order-set PD defaults, plus the variant's `'add'` overrides, minus its
226
+ * `'remove'` overrides. Order-set defaults and overrides are matched by exact
227
+ * canonical string. Deduplicated; input order of the defaults is preserved,
228
+ * with any added canonicals appended.
229
+ *
230
+ * @param defaultRefs - canonicals of the order-set PD's default mandatory add-ons
231
+ * @param variantAction - the selected protocol-group variant action, or undefined
232
+ * @returns the resolved set of mandatory add-on canonicals
233
+ */
234
+ export declare function resolveVariantMandatoryAddons(defaultRefs: readonly string[], variantAction: PlanDefinitionAction | undefined): string[];
172
235
  //# sourceMappingURL=plan-definition-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plan-definition-group.d.ts","sourceRoot":"","sources":["../src/plan-definition-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAwB,MAAM,oBAAoB,CAAA;AAKxF,oEAAoE;AACpE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,SAAS,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ACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,oBAAoB,GAClC,sBAAsB,EAAE,CAc1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,aAAa,EAAE,oBAAoB,GAAG,SAAS,GAC9C,MAAM,EAAE,CAYV"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MANDATORY_ADDON_OVERRIDE_ACTION_ID = void 0;
3
4
  exports.isProtocolGroup = isProtocolGroup;
4
5
  exports.getProtocolActions = getProtocolActions;
5
6
  exports.getDefaultProtocol = getDefaultProtocol;
@@ -9,7 +10,28 @@ exports.buildProtocolGroup = buildProtocolGroup;
9
10
  exports.configureProtocolGroup = configureProtocolGroup;
10
11
  exports.resolveProtocolSelection = resolveProtocolSelection;
11
12
  exports.readProtocolSelection = readProtocolSelection;
13
+ exports.readMandatoryAddonOverrides = readMandatoryAddonOverrides;
14
+ exports.resolveVariantMandatoryAddons = resolveVariantMandatoryAddons;
12
15
  const constants_1 = require("./constants");
16
+ /**
17
+ * `action.id` of the per-variant group that overrides the order-set PD's
18
+ * default mandatory add-ons (the tipo-3 `getMandatoryAddonIds` path). It lives
19
+ * as a direct child of a protocol-group variant action, kept structurally
20
+ * separate from the variant's own add-on sub-actions (the tipo-2
21
+ * `resolveProtocolSelection` path) so the two never conflate. Its group node
22
+ * carries no `definitionCanonical`, so `resolveProtocolSelection`,
23
+ * `getProtocolActions` and friends skip it and never descend into it.
24
+ */
25
+ exports.MANDATORY_ADDON_OVERRIDE_ACTION_ID = 'mandatory-addons';
26
+ /**
27
+ * FHIR-standard ActionType code system. Each override sub-action carries a
28
+ * `type.coding` from this system: `create` = add the add-on to the variant's
29
+ * mandatory set, `remove` = drop a PD-default mandatory add-on. `requiredBehavior`
30
+ * is not used for this because FHIR's value set has no "exclude" member.
31
+ */
32
+ const ACTION_TYPE_SYSTEM = 'http://terminology.hl7.org/CodeSystem/action-type';
33
+ const ACTION_TYPE_ADD = 'create';
34
+ const ACTION_TYPE_REMOVE = 'remove';
13
35
  // ─── Detection ───────────────────────────────────────────────────────────────
14
36
  /**
15
37
  * Returns `true` if the PlanDefinition is a protocol-group (wrapping multiple concrete PDs).
@@ -89,8 +111,10 @@ function buildProtocolGroup(title, entries, existingId, hsReference) {
89
111
  const action = buildAction(e.isDefault ? 'default' : e.id, e.display, e.ref, e.code, e.duration, e.question, e.label);
90
112
  // Top-level actions use exactly-one selection behavior
91
113
  action.selectionBehavior = 'exactly-one';
92
- if (subActions.length > 0) {
93
- action.action = subActions;
114
+ const overrideGroup = buildMandatoryAddonOverrideGroup(e.mandatoryAddonOverrides);
115
+ const childActions = overrideGroup ? [...subActions, overrideGroup] : subActions;
116
+ if (childActions.length > 0) {
117
+ action.action = childActions;
94
118
  // When an action has sub-actions (addons), they use `any` grouping
95
119
  action.groupingBehavior = 'logical-group';
96
120
  }
@@ -151,8 +175,12 @@ function configureProtocolGroup(pd, selection) {
151
175
  const isSelected = a.id === selection.actionId;
152
176
  const subActions = ((_a = a.action) !== null && _a !== void 0 ? _a : []).map((sub) => {
153
177
  var _a;
178
+ // The mandatory-addons override group is server-side configuration,
179
+ // not a selectable addon — never stamp it as prechecked, even if a
180
+ // (buggy) caller passes its id among the addonIds.
181
+ const isOverrideGroup = sub.id === exports.MANDATORY_ADDON_OVERRIDE_ACTION_ID;
154
182
  const isMandatory = sub.requiredBehavior === 'must';
155
- const isOn = isSelected && (isMandatory || addonSet.has((_a = sub.id) !== null && _a !== void 0 ? _a : ''));
183
+ const isOn = isSelected && !isOverrideGroup && (isMandatory || addonSet.has((_a = sub.id) !== null && _a !== void 0 ? _a : ''));
156
184
  return {
157
185
  ...sub,
158
186
  precheckBehavior: isOn ? 'yes' : 'no'
@@ -224,7 +252,7 @@ function readProtocolSelection(pd) {
224
252
  if (prechecked === null || prechecked === void 0 ? void 0 : prechecked.id) {
225
253
  const addonIds = ((_b = prechecked.action) !== null && _b !== void 0 ? _b : [])
226
254
  .filter((sub) => {
227
- if (!sub.id) {
255
+ if (!sub.id || sub.id === exports.MANDATORY_ADDON_OVERRIDE_ACTION_ID) {
228
256
  return false;
229
257
  }
230
258
  if (sub.requiredBehavior === 'must') {
@@ -262,7 +290,7 @@ function precheckToBool(value) {
262
290
  function extractActionInfo(a, isDefault) {
263
291
  var _a, _b, _c, _d, _e, _f;
264
292
  const subActions = ((_a = a.action) !== null && _a !== void 0 ? _a : [])
265
- .filter((sub) => Boolean(sub.definitionCanonical))
293
+ .filter((sub) => Boolean(sub.definitionCanonical) && sub.id !== exports.MANDATORY_ADDON_OVERRIDE_ACTION_ID)
266
294
  .map((sub) => extractActionInfo(sub, false));
267
295
  return {
268
296
  actionId: (_b = a.id) !== null && _b !== void 0 ? _b : '',
@@ -275,7 +303,106 @@ function extractActionInfo(a, isDefault) {
275
303
  duration: a.timingDuration,
276
304
  prechecked: precheckToBool(a.precheckBehavior),
277
305
  mandatory: a.requiredBehavior === 'must' ? true : undefined,
278
- addons: subActions
306
+ addons: subActions,
307
+ mandatoryAddonOverrides: readMandatoryAddonOverrides(a)
308
+ };
309
+ }
310
+ /**
311
+ * Reads the per-variant mandatory-addon overrides out of a variant action's
312
+ * `mandatory-addons` group. Returns `[]` when the variant declares none.
313
+ *
314
+ * @param variantAction - a protocol-group top-level variant action
315
+ * @returns the variant's mandatory-addon overrides (empty when none)
316
+ */
317
+ function readMandatoryAddonOverrides(variantAction) {
318
+ var _a, _b;
319
+ const group = ((_a = variantAction.action) !== null && _a !== void 0 ? _a : []).find((sub) => sub.id === exports.MANDATORY_ADDON_OVERRIDE_ACTION_ID);
320
+ const result = [];
321
+ for (const sub of (_b = group === null || group === void 0 ? void 0 : group.action) !== null && _b !== void 0 ? _b : []) {
322
+ if (!sub.definitionCanonical) {
323
+ continue;
324
+ }
325
+ const action = overrideActionFromActionType(sub);
326
+ if (!action) {
327
+ continue;
328
+ }
329
+ result.push(sub.title !== undefined
330
+ ? { ref: sub.definitionCanonical, action, display: sub.title }
331
+ : { ref: sub.definitionCanonical, action });
332
+ }
333
+ return result;
334
+ }
335
+ /**
336
+ * Resolves the effective mandatory add-on canonicals for a selected variant:
337
+ * the order-set PD defaults, plus the variant's `'add'` overrides, minus its
338
+ * `'remove'` overrides. Order-set defaults and overrides are matched by exact
339
+ * canonical string. Deduplicated; input order of the defaults is preserved,
340
+ * with any added canonicals appended.
341
+ *
342
+ * @param defaultRefs - canonicals of the order-set PD's default mandatory add-ons
343
+ * @param variantAction - the selected protocol-group variant action, or undefined
344
+ * @returns the resolved set of mandatory add-on canonicals
345
+ */
346
+ function resolveVariantMandatoryAddons(defaultRefs, variantAction) {
347
+ const resolved = new Set(defaultRefs);
348
+ if (variantAction) {
349
+ for (const override of readMandatoryAddonOverrides(variantAction)) {
350
+ if (override.action === 'add') {
351
+ resolved.add(override.ref);
352
+ }
353
+ else {
354
+ resolved.delete(override.ref);
355
+ }
356
+ }
357
+ }
358
+ return Array.from(resolved);
359
+ }
360
+ /**
361
+ * Maps an override sub-action's `type.coding` (ActionType) back to add/remove.
362
+ *
363
+ * @param sub - an override group sub-action
364
+ * @returns `'add'` for `create`, `'remove'` for `remove`, else undefined
365
+ */
366
+ function overrideActionFromActionType(sub) {
367
+ var _a, _b, _c;
368
+ const code = (_c = ((_b = (_a = sub.type) === null || _a === void 0 ? void 0 : _a.coding) !== null && _b !== void 0 ? _b : []).find((c) => c.system === ACTION_TYPE_SYSTEM)) === null || _c === void 0 ? void 0 : _c.code;
369
+ if (code === ACTION_TYPE_ADD) {
370
+ return 'add';
371
+ }
372
+ if (code === ACTION_TYPE_REMOVE) {
373
+ return 'remove';
374
+ }
375
+ return undefined;
376
+ }
377
+ /**
378
+ * Builds the `mandatory-addons` override group child for a variant, or returns
379
+ * `undefined` when the variant declares no overrides. Each override becomes a
380
+ * sub-action referencing the add-on's canonical, with `requiredBehavior`
381
+ * `'must'` (add) or `'prohibited'` (remove).
382
+ *
383
+ * @param overrides - the variant's mandatory-addon overrides (may be undefined)
384
+ * @returns the override group action, or undefined when there are no overrides
385
+ */
386
+ function buildMandatoryAddonOverrideGroup(overrides) {
387
+ if (!overrides || overrides.length === 0) {
388
+ return undefined;
389
+ }
390
+ return {
391
+ id: exports.MANDATORY_ADDON_OVERRIDE_ACTION_ID,
392
+ title: 'Adicionales obligatorios (override por variante)',
393
+ selectionBehavior: 'any',
394
+ action: overrides.map((o) => {
395
+ const sub = {
396
+ definitionCanonical: o.ref,
397
+ type: {
398
+ coding: [{ system: ACTION_TYPE_SYSTEM, code: o.action === 'add' ? ACTION_TYPE_ADD : ACTION_TYPE_REMOVE }]
399
+ }
400
+ };
401
+ if (o.display) {
402
+ sub.title = o.display;
403
+ }
404
+ return sub;
405
+ })
279
406
  };
280
407
  }
281
408
  function buildAction(id, title, ref, code, duration, question, labelOverride, mandatory) {