Circle V2 API Docs
    Preparing search index...

    Variable rulesRepoConst

    rulesRepo: DbRepo<
        {
            createRule: (
                params: CreateRuleParams,
            ) => Promise<
                {
                    rule: {
                        created_at: DbDate;
                        created_by: UserId
                        | null;
                        deleted: boolean;
                        deleted_reason: string | null;
                        enabled: boolean;
                        entity_id: number & { __brand: "EntityId" };
                        id: RuleId;
                        origin: "human" | "import";
                        origin_ref: string | null;
                        rulebook_id: string & { __brand: "RulebookId" };
                        updated_at: DbDate;
                    };
                    version: {
                        concept_id: DictionaryConceptId
                        | null;
                        created_at: DbDate;
                        created_by: UserId | null;
                        entity_id: number & { __brand: "EntityId" };
                        grade_open_periods: boolean;
                        id: RuleVersionId;
                        is_current: boolean;
                        kind: "existence" | "signature";
                        quantifier: "every" | "all";
                        rule_id: string & { __brand: "RuleId" };
                        spec:
                            | {
                                evidence: { facts: ((...) | (...) | (...) | (...))[] };
                                expectation:
                                    | {
                                        authored: "typed";
                                        comparator: (...)
                                        | (...)
                                        | (...);
                                        count: number;
                                    }
                                    | { authored: "prose"; claim: string; instructions?: (...)
                                    | (...) };
                                kind: "existence";
                                version: 1;
                            }
                            | {
                                evidence: { facts: ((...) | (...) | (...) | (...))[] };
                                kind: "signature";
                                signatures: {
                                    credentialConceptId?: (...) | (...);
                                    role: (...) | (...) | (...) | (...);
                                }[];
                                version: 1;
                            };
                        trigger_concept_id: DictionaryConceptId
                        | null;
                        trigger_offset_seconds: number;
                        trigger_type:
                            | "admission"
                            | "discharge"
                            | "projected_discharge"
                            | "utilization_end"
                            | "program_start"
                            | "document"
                            | "level_of_care_change";
                        version: number;
                        window: | {
                            after: | { from: "admission" }
                            | { from: "discharge" }
                            | { from: "projected_discharge" }
                            | { from: "program_start" }
                            | { from: "level_of_care_change" }
                            | { from: "level_of_care_start" }
                            | { from: "utilization_end" }
                            | { conceptId: DictionaryConceptId; from: "document" }
                            | { from: "session" };
                            kind: "deadline";
                            withinHours: number;
                        }
                        | { kind: "whole_episode" }
                        | {
                            every:
                                | { periods: number; unit: "day" }
                                | {
                                    periods: number;
                                    subset: (...) | (...) | (...);
                                    unit: "week";
                                    weekStartsOn: (...) | (...);
                                }
                                | { periods: number; unit: "month" };
                            kind: "calendar";
                            since?:
                                | { from: "admission" }
                                | { from: "discharge" }
                                | { from: "projected_discharge" }
                                | { from: "program_start" }
                                | { from: "level_of_care_change" }
                                | { from: "level_of_care_start" }
                                | { from: "utilization_end" }
                                | { conceptId: DictionaryConceptId; from: "document" }
                                | { from: "session" };
                        }
                        | {
                            anchor: | { from: "admission" }
                            | { from: "discharge" }
                            | { from: "projected_discharge" }
                            | { from: "program_start" }
                            | { from: "level_of_care_change" }
                            | { from: "level_of_care_start" }
                            | { from: "utilization_end" }
                            | { conceptId: DictionaryConceptId; from: "document" }
                            | { from: "session" };
                            days: number;
                            kind: "recurring_from_anchor";
                        }
                        | { days: number; kind: "rolling" };
                        window_kind: string | null;
                    };
                },
            >;
            createVersion: (
                params: CreateVersionParams,
            ) => Promise<
                {
                    rule: {
                        created_at: DbDate;
                        created_by: UserId
                        | null;
                        deleted: boolean;
                        deleted_reason: string | null;
                        enabled: boolean;
                        entity_id: number & { __brand: "EntityId" };
                        id: RuleId;
                        origin: "human" | "import";
                        origin_ref: string | null;
                        rulebook_id: string & { __brand: "RulebookId" };
                        updated_at: DbDate;
                    };
                    version: {
                        concept_id: DictionaryConceptId
                        | null;
                        created_at: DbDate;
                        created_by: UserId | null;
                        entity_id: number & { __brand: "EntityId" };
                        grade_open_periods: boolean;
                        id: RuleVersionId;
                        is_current: boolean;
                        kind: "existence" | "signature";
                        quantifier: "every" | "all";
                        rule_id: string & { __brand: "RuleId" };
                        spec:
                            | {
                                evidence: { facts: ((...) | (...) | (...) | (...))[] };
                                expectation:
                                    | {
                                        authored: "typed";
                                        comparator: (...)
                                        | (...)
                                        | (...);
                                        count: number;
                                    }
                                    | { authored: "prose"; claim: string; instructions?: (...)
                                    | (...) };
                                kind: "existence";
                                version: 1;
                            }
                            | {
                                evidence: { facts: ((...) | (...) | (...) | (...))[] };
                                kind: "signature";
                                signatures: {
                                    credentialConceptId?: (...) | (...);
                                    role: (...) | (...) | (...) | (...);
                                }[];
                                version: 1;
                            };
                        trigger_concept_id: DictionaryConceptId
                        | null;
                        trigger_offset_seconds: number;
                        trigger_type:
                            | "admission"
                            | "discharge"
                            | "projected_discharge"
                            | "utilization_end"
                            | "program_start"
                            | "document"
                            | "level_of_care_change";
                        version: number;
                        window: | {
                            after: | { from: "admission" }
                            | { from: "discharge" }
                            | { from: "projected_discharge" }
                            | { from: "program_start" }
                            | { from: "level_of_care_change" }
                            | { from: "level_of_care_start" }
                            | { from: "utilization_end" }
                            | { conceptId: DictionaryConceptId; from: "document" }
                            | { from: "session" };
                            kind: "deadline";
                            withinHours: number;
                        }
                        | { kind: "whole_episode" }
                        | {
                            every:
                                | { periods: number; unit: "day" }
                                | {
                                    periods: number;
                                    subset: (...) | (...) | (...);
                                    unit: "week";
                                    weekStartsOn: (...) | (...);
                                }
                                | { periods: number; unit: "month" };
                            kind: "calendar";
                            since?:
                                | { from: "admission" }
                                | { from: "discharge" }
                                | { from: "projected_discharge" }
                                | { from: "program_start" }
                                | { from: "level_of_care_change" }
                                | { from: "level_of_care_start" }
                                | { from: "utilization_end" }
                                | { conceptId: DictionaryConceptId; from: "document" }
                                | { from: "session" };
                        }
                        | {
                            anchor: | { from: "admission" }
                            | { from: "discharge" }
                            | { from: "projected_discharge" }
                            | { from: "program_start" }
                            | { from: "level_of_care_change" }
                            | { from: "level_of_care_start" }
                            | { from: "utilization_end" }
                            | { conceptId: DictionaryConceptId; from: "document" }
                            | { from: "session" };
                            days: number;
                            kind: "recurring_from_anchor";
                        }
                        | { days: number; kind: "rolling" };
                        window_kind: string | null;
                    };
                },
            >;
            getRuleWithCurrentVersion: (
                params: { entityId: EntityId; ruleId: RuleId },
            ) => Promise<
                {
                    rule: {
                        created_at: DbDate;
                        created_by: UserId
                        | null;
                        deleted: boolean;
                        deleted_reason: string | null;
                        enabled: boolean;
                        entity_id: number & { __brand: "EntityId" };
                        id: RuleId;
                        origin: "human" | "import";
                        origin_ref: string | null;
                        rulebook_id: string & { __brand: "RulebookId" };
                        updated_at: DbDate;
                    };
                    version: {
                        concept_id: DictionaryConceptId
                        | null;
                        created_at: DbDate;
                        created_by: UserId | null;
                        entity_id: number & { __brand: "EntityId" };
                        grade_open_periods: boolean;
                        id: RuleVersionId;
                        is_current: boolean;
                        kind: "existence" | "signature";
                        quantifier: "every" | "all";
                        rule_id: string & { __brand: "RuleId" };
                        spec:
                            | {
                                evidence: { facts: ((...) | (...) | (...) | (...))[] };
                                expectation:
                                    | {
                                        authored: "typed";
                                        comparator: (...)
                                        | (...)
                                        | (...);
                                        count: number;
                                    }
                                    | { authored: "prose"; claim: string; instructions?: (...)
                                    | (...) };
                                kind: "existence";
                                version: 1;
                            }
                            | {
                                evidence: { facts: ((...) | (...) | (...) | (...))[] };
                                kind: "signature";
                                signatures: {
                                    credentialConceptId?: (...) | (...);
                                    role: (...) | (...) | (...) | (...);
                                }[];
                                version: 1;
                            };
                        trigger_concept_id: DictionaryConceptId
                        | null;
                        trigger_offset_seconds: number;
                        trigger_type:
                            | "admission"
                            | "discharge"
                            | "projected_discharge"
                            | "utilization_end"
                            | "program_start"
                            | "document"
                            | "level_of_care_change";
                        version: number;
                        window: | {
                            after: | { from: "admission" }
                            | { from: "discharge" }
                            | { from: "projected_discharge" }
                            | { from: "program_start" }
                            | { from: "level_of_care_change" }
                            | { from: "level_of_care_start" }
                            | { from: "utilization_end" }
                            | { conceptId: DictionaryConceptId; from: "document" }
                            | { from: "session" };
                            kind: "deadline";
                            withinHours: number;
                        }
                        | { kind: "whole_episode" }
                        | {
                            every:
                                | { periods: number; unit: "day" }
                                | {
                                    periods: number;
                                    subset: (...) | (...) | (...);
                                    unit: "week";
                                    weekStartsOn: (...) | (...);
                                }
                                | { periods: number; unit: "month" };
                            kind: "calendar";
                            since?:
                                | { from: "admission" }
                                | { from: "discharge" }
                                | { from: "projected_discharge" }
                                | { from: "program_start" }
                                | { from: "level_of_care_change" }
                                | { from: "level_of_care_start" }
                                | { from: "utilization_end" }
                                | { conceptId: DictionaryConceptId; from: "document" }
                                | { from: "session" };
                        }
                        | {
                            anchor: | { from: "admission" }
                            | { from: "discharge" }
                            | { from: "projected_discharge" }
                            | { from: "program_start" }
                            | { from: "level_of_care_change" }
                            | { from: "level_of_care_start" }
                            | { from: "utilization_end" }
                            | { conceptId: DictionaryConceptId; from: "document" }
                            | { from: "session" };
                            days: number;
                            kind: "recurring_from_anchor";
                        }
                        | { days: number; kind: "rolling" };
                        window_kind: string | null;
                    };
                },
            >;
            listRules: (
                params: { enabled?: boolean; entityId: EntityId },
            ) => Promise<
                {
                    rule: {
                        created_at: DbDate;
                        created_by: UserId
                        | null;
                        deleted: boolean;
                        deleted_reason: string | null;
                        enabled: boolean;
                        entity_id: number & { __brand: "EntityId" };
                        id: RuleId;
                        origin: "human" | "import";
                        origin_ref: string | null;
                        rulebook_id: string & { __brand: "RulebookId" };
                        updated_at: DbDate;
                    };
                    version: {
                        concept_id: DictionaryConceptId
                        | null;
                        created_at: DbDate;
                        created_by: UserId | null;
                        entity_id: number & { __brand: "EntityId" };
                        grade_open_periods: boolean;
                        id: RuleVersionId;
                        is_current: boolean;
                        kind: "existence" | "signature";
                        quantifier: "every" | "all";
                        rule_id: string & { __brand: "RuleId" };
                        spec:
                            | {
                                evidence: { facts: (...)[] };
                                expectation:
                                    | { authored: ...; comparator: ...; count: ... }
                                    | { authored: ...; claim: ...; instructions?: ... };
                                kind: "existence";
                                version: 1;
                            }
                            | {
                                evidence: { facts: (...)[] };
                                kind: "signature";
                                signatures: { credentialConceptId?: ...; role: ... }[];
                                version: 1;
                            };
                        trigger_concept_id: DictionaryConceptId
                        | null;
                        trigger_offset_seconds: number;
                        trigger_type:
                            | "admission"
                            | "discharge"
                            | "projected_discharge"
                            | "utilization_end"
                            | "program_start"
                            | "document"
                            | "level_of_care_change";
                        version: number;
                        window: | {
                            after: | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { conceptId: ...; from: ... }
                            | { from: ... };
                            kind: "deadline";
                            withinHours: number;
                        }
                        | { kind: "whole_episode" }
                        | {
                            every:
                                | { periods: ...; unit: ... }
                                | { periods: ...; subset: ...; unit: ...; weekStartsOn: ... }
                                | { periods: ...; unit: ... };
                            kind: "calendar";
                            since?:
                                | { from: ... }
                                | { from: ... }
                                | { from: ... }
                                | { from: ... }
                                | { from: ... }
                                | { from: ... }
                                | { from: ... }
                                | { conceptId: ...; from: ... }
                                | { from: ... };
                        }
                        | {
                            anchor: | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { from: ... }
                            | { conceptId: ...; from: ... }
                            | { from: ... };
                            days: number;
                            kind: "recurring_from_anchor";
                        }
                        | { days: number; kind: "rolling" };
                        window_kind: string | null;
                    };
                }[],
            >;
            setEnabled: (
                params: { enabled: boolean; entityId: EntityId; ruleId: RuleId },
            ) => Promise<
                {
                    created_at: DbDate;
                    created_by: UserId
                    | null;
                    deleted: boolean;
                    deleted_reason: string | null;
                    enabled: boolean;
                    entity_id: number & { __brand: "EntityId" };
                    id: RuleId;
                    origin: "human" | "import";
                    origin_ref: string | null;
                    rulebook_id: string & { __brand: "RulebookId" };
                    updated_at: DbDate;
                },
            >;
            softDelete: (
                params: { entityId: EntityId; reason: string; ruleId: RuleId },
            ) => Promise<
                {
                    created_at: DbDate;
                    created_by: UserId
                    | null;
                    deleted: boolean;
                    deleted_reason: string | null;
                    enabled: boolean;
                    entity_id: number & { __brand: "EntityId" };
                    id: RuleId;
                    origin: "human" | "import";
                    origin_ref: string | null;
                    rulebook_id: string & { __brand: "RulebookId" };
                    updated_at: DbDate;
                },
            >;
        },
    > = ...