@medplum/core 5.1.37 → 5.1.38

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.
@@ -1364,6 +1364,20 @@ export declare const DEFAULT_MAX_SEARCH_COUNT = 1000;
1364
1364
 
1365
1365
  export declare const DEFAULT_SEARCH_COUNT = 20;
1366
1366
 
1367
+ /**
1368
+ * Given a type `Reference<X>`, extracts `X`
1369
+ *
1370
+ * The input is constrained to references, so passing anything else is a compile error
1371
+ * rather than a silently unhelpful type. `null` and `undefined` are allowed and pass
1372
+ * through, so an optional reference field dereferences to an optional resource.
1373
+ *
1374
+ * The check is structural, though: this accepts anything assignable to `Reference`, an
1375
+ * interface whose fields are all optional. Object types that are not true references are
1376
+ * therefore accepted, and with no `resource` property to infer from, resolve to
1377
+ * `Resource`, the default type argument of `Reference`.
1378
+ */
1379
+ export declare type Dereference<T extends Reference | null | undefined> = T extends Reference<infer R> ? R : T;
1380
+
1367
1381
  /**
1368
1382
  * Derives an "identifier" search parameter from a reference search parameter.
1369
1383
  *
@@ -2707,6 +2721,14 @@ export declare function getResourceTypes(): ResourceType[];
2707
2721
  */
2708
2722
  export declare function getScheduleParameters(schedule: Schedule, service: WithId<HealthcareService>, url: string): Extension[];
2709
2723
 
2724
+ /**
2725
+ * Returns what a visit type must be given before it can be booked, from its
2726
+ * `HealthcareService.eligibility` codes.
2727
+ * @param service - The visit type being booked, if one has been chosen yet.
2728
+ * @returns The requirements it names, empty until a visit type is chosen or when it names none.
2729
+ */
2730
+ export declare function getSchedulingRequirements(service: HealthcareService | undefined): Set<SchedulingRequirement>;
2731
+
2710
2732
  /**
2711
2733
  * Resolves the timezone used by scheduling in server priority order: the Schedule's parameters for the
2712
2734
  * service, then the service's own parameters, then the actor's standard FHIR timezone extension.
@@ -3765,6 +3787,13 @@ export declare function isResourceTypeSchema(typeSchema: InternalTypeSchema): bo
3765
3787
 
3766
3788
  export declare function isResourceWithId<T extends Resource>(resource: unknown, resourceType?: T['resourceType']): resource is WithId<T>;
3767
3789
 
3790
+ /**
3791
+ * Returns whether a code names a scheduling requirement.
3792
+ * @param value - The `Coding.code` to test, which a resource need not carry.
3793
+ * @returns True when it is one of the requirements a booking honours.
3794
+ */
3795
+ export declare function isSchedulingRequirement(value: string | undefined): value is SchedulingRequirement;
3796
+
3768
3797
  export declare function isSliceDefinitionWithTypes(slice: SliceDefinition): slice is SliceDefinitionWithTypes;
3769
3798
 
3770
3799
  /**
@@ -8239,6 +8268,15 @@ export declare class ParserBuilder {
8239
8268
  expandProfile?: boolean;
8240
8269
  }
8241
8270
 
8271
+ /** The eligibility code marking a visit type that cannot be booked without diagnosis codes. */
8272
+ export declare const REQUIRES_DIAGNOSIS_CODE = "requires-diagnosis";
8273
+
8274
+ /** The eligibility code marking a visit type that cannot be booked without confirming medical necessity. */
8275
+ export declare const REQUIRES_MEDICAL_NECESSITY_CODE = "requires-medical-necessity";
8276
+
8277
+ /** The eligibility code marking a visit type that cannot be booked without procedure codes. */
8278
+ export declare const REQUIRES_PROCEDURE_CODE = "requires-procedure";
8279
+
8242
8280
  /**
8243
8281
  * Returns the ID portion of a reference.
8244
8282
  * @param input - A FHIR reference or resource.
@@ -8319,6 +8357,12 @@ export declare class ParserBuilder {
8319
8357
  */
8320
8358
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
8321
8359
 
8360
+ /** Code system for scheduling requirements, recorded on `HealthcareService.eligibility.code`. */
8361
+ export declare const SCHEDULING_ELIGIBILITY_SYSTEM = "https://medplum.com/fhir/CodeSystem/scheduling-eligibility";
8362
+
8363
+ /** Every eligibility code naming something a booking must carry. */
8364
+ export declare const SCHEDULING_REQUIREMENT_CODES: readonly ["requires-procedure", "requires-diagnosis", "requires-medical-necessity"];
8365
+
8322
8366
  /**
8323
8367
  * Converts a SchedulingParameters duration to minutes.
8324
8368
  *
@@ -8330,12 +8374,27 @@ export declare class ParserBuilder {
8330
8374
 
8331
8375
  export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8332
8376
 
8377
+ /** Extension on an Appointment recording that medical necessity was confirmed when it was booked. */
8378
+ export declare const SchedulingMedicalNecessityURI = "https://medplum.com/fhir/StructureDefinition/SchedulingMedicalNecessity";
8379
+
8333
8380
  export declare const SchedulingParametersURI = "https://medplum.com/fhir/StructureDefinition/SchedulingParameters";
8334
8381
 
8335
8382
  export declare const SchedulingPlanDefinitionURI = "https://medplum.com/fhir/StructureDefinition/SchedulingPlanDefinition";
8336
8383
 
8384
+ export declare type SchedulingRequirement = (typeof SCHEDULING_REQUIREMENT_CODES)[number];
8385
+
8337
8386
  export declare const SchedulingScheduleColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8338
8387
 
8388
+ /**
8389
+ * This extension is set on `Slot` resources created through scheduling APIs.
8390
+ * Its value is a positive integer recording the slotCapacity for the service
8391
+ * and schedule at the time the booking was created. Omitted when the
8392
+ * slotCapacity is `1`.
8393
+ *
8394
+ * @see https://www.medplum.com/docs/scheduling/defining-availability#overbooking
8395
+ */
8396
+ export declare const SchedulingSlotCapacityURI = "https://medplum.com/fhir/StructureDefinition/SchedulingSlotCapacity";
8397
+
8339
8398
  export declare interface SearchableToken {
8340
8399
  readonly system: string | undefined;
8341
8400
  readonly value: string | undefined;
@@ -1364,6 +1364,20 @@ export declare const DEFAULT_MAX_SEARCH_COUNT = 1000;
1364
1364
 
1365
1365
  export declare const DEFAULT_SEARCH_COUNT = 20;
1366
1366
 
1367
+ /**
1368
+ * Given a type `Reference<X>`, extracts `X`
1369
+ *
1370
+ * The input is constrained to references, so passing anything else is a compile error
1371
+ * rather than a silently unhelpful type. `null` and `undefined` are allowed and pass
1372
+ * through, so an optional reference field dereferences to an optional resource.
1373
+ *
1374
+ * The check is structural, though: this accepts anything assignable to `Reference`, an
1375
+ * interface whose fields are all optional. Object types that are not true references are
1376
+ * therefore accepted, and with no `resource` property to infer from, resolve to
1377
+ * `Resource`, the default type argument of `Reference`.
1378
+ */
1379
+ export declare type Dereference<T extends Reference | null | undefined> = T extends Reference<infer R> ? R : T;
1380
+
1367
1381
  /**
1368
1382
  * Derives an "identifier" search parameter from a reference search parameter.
1369
1383
  *
@@ -2707,6 +2721,14 @@ export declare function getResourceTypes(): ResourceType[];
2707
2721
  */
2708
2722
  export declare function getScheduleParameters(schedule: Schedule, service: WithId<HealthcareService>, url: string): Extension[];
2709
2723
 
2724
+ /**
2725
+ * Returns what a visit type must be given before it can be booked, from its
2726
+ * `HealthcareService.eligibility` codes.
2727
+ * @param service - The visit type being booked, if one has been chosen yet.
2728
+ * @returns The requirements it names, empty until a visit type is chosen or when it names none.
2729
+ */
2730
+ export declare function getSchedulingRequirements(service: HealthcareService | undefined): Set<SchedulingRequirement>;
2731
+
2710
2732
  /**
2711
2733
  * Resolves the timezone used by scheduling in server priority order: the Schedule's parameters for the
2712
2734
  * service, then the service's own parameters, then the actor's standard FHIR timezone extension.
@@ -3765,6 +3787,13 @@ export declare function isResourceTypeSchema(typeSchema: InternalTypeSchema): bo
3765
3787
 
3766
3788
  export declare function isResourceWithId<T extends Resource>(resource: unknown, resourceType?: T['resourceType']): resource is WithId<T>;
3767
3789
 
3790
+ /**
3791
+ * Returns whether a code names a scheduling requirement.
3792
+ * @param value - The `Coding.code` to test, which a resource need not carry.
3793
+ * @returns True when it is one of the requirements a booking honours.
3794
+ */
3795
+ export declare function isSchedulingRequirement(value: string | undefined): value is SchedulingRequirement;
3796
+
3768
3797
  export declare function isSliceDefinitionWithTypes(slice: SliceDefinition): slice is SliceDefinitionWithTypes;
3769
3798
 
3770
3799
  /**
@@ -8239,6 +8268,15 @@ export declare class ParserBuilder {
8239
8268
  expandProfile?: boolean;
8240
8269
  }
8241
8270
 
8271
+ /** The eligibility code marking a visit type that cannot be booked without diagnosis codes. */
8272
+ export declare const REQUIRES_DIAGNOSIS_CODE = "requires-diagnosis";
8273
+
8274
+ /** The eligibility code marking a visit type that cannot be booked without confirming medical necessity. */
8275
+ export declare const REQUIRES_MEDICAL_NECESSITY_CODE = "requires-medical-necessity";
8276
+
8277
+ /** The eligibility code marking a visit type that cannot be booked without procedure codes. */
8278
+ export declare const REQUIRES_PROCEDURE_CODE = "requires-procedure";
8279
+
8242
8280
  /**
8243
8281
  * Returns the ID portion of a reference.
8244
8282
  * @param input - A FHIR reference or resource.
@@ -8319,6 +8357,12 @@ export declare class ParserBuilder {
8319
8357
  */
8320
8358
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
8321
8359
 
8360
+ /** Code system for scheduling requirements, recorded on `HealthcareService.eligibility.code`. */
8361
+ export declare const SCHEDULING_ELIGIBILITY_SYSTEM = "https://medplum.com/fhir/CodeSystem/scheduling-eligibility";
8362
+
8363
+ /** Every eligibility code naming something a booking must carry. */
8364
+ export declare const SCHEDULING_REQUIREMENT_CODES: readonly ["requires-procedure", "requires-diagnosis", "requires-medical-necessity"];
8365
+
8322
8366
  /**
8323
8367
  * Converts a SchedulingParameters duration to minutes.
8324
8368
  *
@@ -8330,12 +8374,27 @@ export declare class ParserBuilder {
8330
8374
 
8331
8375
  export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8332
8376
 
8377
+ /** Extension on an Appointment recording that medical necessity was confirmed when it was booked. */
8378
+ export declare const SchedulingMedicalNecessityURI = "https://medplum.com/fhir/StructureDefinition/SchedulingMedicalNecessity";
8379
+
8333
8380
  export declare const SchedulingParametersURI = "https://medplum.com/fhir/StructureDefinition/SchedulingParameters";
8334
8381
 
8335
8382
  export declare const SchedulingPlanDefinitionURI = "https://medplum.com/fhir/StructureDefinition/SchedulingPlanDefinition";
8336
8383
 
8384
+ export declare type SchedulingRequirement = (typeof SCHEDULING_REQUIREMENT_CODES)[number];
8385
+
8337
8386
  export declare const SchedulingScheduleColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8338
8387
 
8388
+ /**
8389
+ * This extension is set on `Slot` resources created through scheduling APIs.
8390
+ * Its value is a positive integer recording the slotCapacity for the service
8391
+ * and schedule at the time the booking was created. Omitted when the
8392
+ * slotCapacity is `1`.
8393
+ *
8394
+ * @see https://www.medplum.com/docs/scheduling/defining-availability#overbooking
8395
+ */
8396
+ export declare const SchedulingSlotCapacityURI = "https://medplum.com/fhir/StructureDefinition/SchedulingSlotCapacity";
8397
+
8339
8398
  export declare interface SearchableToken {
8340
8399
  readonly system: string | undefined;
8341
8400
  readonly value: string | undefined;