Circle V2 API Docs
    Preparing search index...

    Variable auditRunsRepoConst

    auditRunsRepo: DbRepo<
        {
            countForPatient: (
                params: ListAuditRunsForPatientParams,
            ) => Promise<number>;
            countForSuperadmin: (
                params: ListSuperadminAuditRunsParams,
            ) => Promise<number>;
            countQuestionRunHistory: (
                params: Pick<
                    ListQuestionRunHistoryParams,
                    "patientId"
                    | "auditQuestionId",
                >,
            ) => Promise<number>;
            create: (
                params: {
                    auditTemplateId: AuditTemplateId;
                    caseId: CaseId;
                    createdBy: UserId;
                    ranAgainstChartsAt?: string | null;
                    runContext?: {
                        scopedCharts:
                            | { fileName: string
                            | null; id: PatientChartId }[]
                            | null;
                    };
                    sessionId?: SessionId;
                    treatmentEpisodeId?: TreatmentEpisodeId
                    | null;
                },
            ) => Promise<
                {
                    archived: boolean;
                    audit_template_id: string & { __brand: "AuditTemplateId" }
                    | null;
                    case_id: string & { __brand: "CaseId" } | null;
                    created_at: DbDate;
                    created_by: string & { __brand: "UserId" } | null;
                    hidden: boolean;
                    id: AuditRunId;
                    ran_against_charts_at: string | null;
                    run_context:
                        | {
                            scopedCharts: | { fileName: (...)
                            | (...); id: PatientChartId }[]
                            | null;
                        }
                        | null;
                    session_id: string & { __brand: "SessionId" }
                    | null;
                    status: string | null;
                    summary: string | null;
                    treatment_episode_id: string & { __brand: "TreatmentEpisodeId" } | null;
                    trigger: string | null;
                    triggered_at: string | null;
                },
            >;
            getById: (
                id: AuditRunId,
            ) => Promise<
                {
                    archived: boolean;
                    audit_template_id: string & { __brand: "AuditTemplateId" }
                    | null;
                    case_id: string & { __brand: "CaseId" } | null;
                    created_at: DbDate;
                    created_by: string & { __brand: "UserId" } | null;
                    entity_id: number & { __brand: "EntityId" } | null;
                    hidden: boolean;
                    id: AuditRunId;
                    patient_first_name: string | null;
                    patient_id: string & { __brand: "PatientId" } | null;
                    patient_last_name: string | null;
                    ran_against_charts_at: string | null;
                    run_context:
                        | {
                            scopedCharts: | { fileName: (...)
                            | (...); id: PatientChartId }[]
                            | null;
                        }
                        | null;
                    session_id: string & { __brand: "SessionId" }
                    | null;
                    status: string | null;
                    summary: string | null;
                    template_name: string | null;
                    treatment_episode_id: string & { __brand: "TreatmentEpisodeId" } | null;
                    trigger: string | null;
                    triggered_at: string | null;
                },
            >;
            getPatientId: (
                auditRunId: AuditRunId,
            ) => Promise<{ patient_id: string & { __brand: "PatientId" } | null }>;
            getPendingQuestionsByRunId: (
                runId: AuditRunId,
            ) => Promise<AuditQuestionId[]>;
            getSessionIdForPatient: (
                auditRunId: AuditRunId,
                patientId: PatientId,
            ) => Promise<
                { session_id: string & { __brand: "SessionId" } | null }
                | undefined,
            >;
            listForPatient: (
                params: ListAuditRunsForPatientParams,
            ) => Promise<
                {
                    audit_template_id: string & { __brand: "AuditTemplateId" }
                    | null;
                    created_at: DbDate;
                    id: AuditRunId;
                    scoped_chart_count: number | null;
                    template_name: string | null;
                    treatment_episode_id: string & { __brand: "TreatmentEpisodeId" } | null;
                }[],
            >;
            listForSuperadmin: (
                params: ListSuperadminAuditRunsParams,
            ) => Promise<
                {
                    answered_count: number
                    | null;
                    audit_template_id: string & { __brand: "AuditTemplateId" } | null;
                    case_id: string & { __brand: "CaseId" } | null;
                    created_at: DbDate;
                    entity_id: number & { __brand: "EntityId" } | null;
                    id: AuditRunId;
                    patient_first_name: string | null;
                    patient_id: string & { __brand: "PatientId" } | null;
                    patient_last_name: string | null;
                    pending_audit_question_ids: AuditQuestionId[] | null;
                    status: string | null;
                    template_name: string | null;
                    total_ai_questions: number | null;
                    treatment_episode_id: string & { __brand: "TreatmentEpisodeId" } | null;
                }[],
            >;
            listIdsByCaseId: (caseId: CaseId) => Promise<AuditRunId[]>;
            listIdsBySessionId: (sessionId: SessionId) => Promise<AuditRunId[]>;
            listLatestResponsesPerQuestion: (
                auditRunId: AuditRunId,
            ) => Promise<
                {
                    asked_question: string
                    | null;
                    audit_question_id: AuditQuestionId | null;
                    question_order: number | null;
                    question_type: "summary" | "pass_fail";
                    response: string | null;
                    status: string | null;
                    template_question: string | null;
                }[],
            >;
            listQuestionRunHistory: (
                params: ListQuestionRunHistoryParams,
            ) => Promise<
                {
                    audit_run_id: AuditRunId;
                    run_created_at: DbDate;
                    session_id: string & { __brand: "SessionId" }
                    | null;
                    status: string | null;
                    total_count: number;
                    trigger_name: string | null;
                }[],
            >;
            listRecentResponsesByPatientId: (
                params: {
                    createdAfter: string;
                    patientId: PatientId;
                    treatmentEpisodeId?: TreatmentEpisodeId;
                    type?: "chart_review" | "session_notes";
                },
            ) => Promise<
                {
                    audit_template_id: string & { __brand: "AuditTemplateId" }
                    | null;
                    created_at: DbDate;
                    id: AuditRunId;
                    scoped_chart_count: number | null;
                    template_name: string | null;
                    treatment_episode_id: string & { __brand: "TreatmentEpisodeId" } | null;
                }[],
            >;
            listResponseMetadataByRunIds: (
                runIds: AuditRunId[],
            ) => Promise<
                {
                    audit_run_id: string & { __brand: "AuditRunId" }
                    | null;
                    question_type: "summary" | "pass_fail" | null;
                    status: string | null;
                    user_action_status: string | null;
                }[],
            >;
            listResponsesByRunId: (
                runId: AuditRunId,
            ) => Promise<
                {
                    audit_question_id: AuditQuestionId
                    | null;
                    audit_run_id: string & { __brand: "AuditRunId" } | null;
                    context_sources: unknown[] | null;
                    created_at: DbDate;
                    icd_code: unknown[] | null;
                    id: AuditResponseId;
                    latest_trail_comment: string | null;
                    latest_trail_created_at: DbDate | null;
                    latest_trail_marked_as:
                        | "pass"
                        | "fail"
                        | "needs_review"
                        | "not_applicable"
                        | "summary_entered"
                        | "missing"
                        | "late"
                        | "not_due_yet"
                        | null;
                    latest_trail_user_email: string
                    | null;
                    latest_trail_user_first_name: string | null;
                    latest_trail_user_last_name: string | null;
                    manual: boolean;
                    question: string | null;
                    question_order: number | null;
                    question_type: "summary" | "pass_fail" | null;
                    question_ui: string | null;
                    reason: string[] | null;
                    recommendation: string | null;
                    response: string | null;
                    sources: unknown[] | null;
                    status: string | null;
                    user_action_status: string | null;
                }[],
            >;
            listResponseStatusesBySessionId: (
                sessionId: SessionId,
            ) => Promise<(string | null)[]>;
            markStaleAsFailed: (
                params: MarkStaleAsFailedParams,
            ) => Promise<{ id: AuditRunId }[]>;
            softDeleteAuditRunsByIds: (
                params: SoftDeleteAuditRunsByIdsParams,
            ) => Promise<{ archivedIds: AuditRunId[] }>;
            upsertByTrigger: (
                params: {
                    auditTemplateId: AuditTemplateId;
                    caseId: CaseId;
                    createdBy: UserId | null;
                    ranAgainstChartsAt?: string | null;
                    runContext?: {
                        scopedCharts:
                            | { fileName: string
                            | null; id: PatientChartId }[]
                            | null;
                    };
                    treatmentEpisodeId?: TreatmentEpisodeId
                    | null;
                    trigger: ChartReviewTriggerId;
                    triggeredAt: string;
                },
            ) => Promise<
                {
                    archived: boolean;
                    audit_template_id: string & { __brand: "AuditTemplateId" }
                    | null;
                    case_id: string & { __brand: "CaseId" } | null;
                    created_at: DbDate;
                    created_by: string & { __brand: "UserId" } | null;
                    hidden: boolean;
                    id: AuditRunId;
                    ran_against_charts_at: string | null;
                    run_context:
                        | {
                            scopedCharts: | { fileName: (...)
                            | (...); id: PatientChartId }[]
                            | null;
                        }
                        | null;
                    session_id: string & { __brand: "SessionId" }
                    | null;
                    status: string | null;
                    summary: string | null;
                    treatment_episode_id: string & { __brand: "TreatmentEpisodeId" } | null;
                    trigger: string | null;
                    triggered_at: string | null;
                },
            >;
        },
    > = ...