Circle V2 API Docs
    Preparing search index...

    Verbatim-ish copy of the v1 chart-review Supabase repos. See ./README.md for the porting policy and what was trimmed for v2 compatibility.

    Each repo extends DbRepo and is constructed with a SupabaseClient<Database>, which can be obtained from @repo/db/supabase:

    import { createSupabaseAdminClient } from "@repo/db/supabase"; import { AuditRunsRepo } from "@repo/legacy/chart-review";

    const supabase = createSupabaseAdminClient(); const repo = new AuditRunsRepo({ supabase });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    supabase: SupabaseClient<Database>

    Methods

    • Parameters

      • runIds: number[]

      Returns Promise<Safe<void>>

    • Find the most recent completed audit run for a given case + template. Returns null when no completed run exists.

      Parameters

      • caseId: number
      • templateId: number

      Returns Promise<
          | {
              archived: boolean;
              audit_template_id: number
              | null;
              case_id: number | null;
              created_at: string;
              created_by: string | null;
              deferred_enqueue: Json;
              hidden: boolean;
              id: number;
              ran_against_charts_at: string | null;
              run_context: Json;
              session_id: number | null;
              status: string | null;
              summary: string | null;
              treatment_episode_id: string | null;
              trigger: string | null;
              triggered_at: string | null;
          }
          | null,
      >

    • Parameters

      • params: {
            auditRunId?: number;
            caseId: number;
            createdBy?: string;
            ranAgainstChartsAt?: string | null;
            runContext?: {
                documentWait?: {
                    outcome: "extracted" | "missing_documents" | "timed_out" | "run_now";
                    parkedAt: string;
                    releasedAt: string;
                    unreadChartIds: PatientChartId[];
                };
                scopedCharts: { fileName: string | null; id: PatientChartId }[]
                | null;
            };
            templateId: number;
        }

      Returns Promise<
          {
              archived: boolean;
              audit_template_id: number
              | null;
              case_id: number | null;
              created_at: string;
              created_by: string | null;
              deferred_enqueue: Json;
              hidden: boolean;
              id: number;
              ran_against_charts_at: string | null;
              run_context: Json;
              session_id: number | null;
              status: string | null;
              summary: string | null;
              treatment_episode_id: string | null;
              trigger: string | null;
              triggered_at: string | null;
          },
      >

    • Parameters

      • runId: number
      • summary: string | null

      Returns Promise<
          {
              archived: boolean;
              audit_template_id: number
              | null;
              case_id: number | null;
              created_at: string;
              created_by: string | null;
              deferred_enqueue: Json;
              hidden: boolean;
              id: number;
              ran_against_charts_at: string | null;
              run_context: Json;
              session_id: number | null;
              status: string | null;
              summary: string | null;
              treatment_episode_id: string | null;
              trigger: string | null;
              triggered_at: string | null;
          },
      >

    • Guarded like the completion claim: a finished run is not a failing slice's to reopen.

      Parameters

      • runId: number

      Returns Promise<void>

    • Parameters

      • params: {
            caseId: number;
            createdBy?: string;
            ranAgainstChartsAt?: string | null;
            runContext?: {
                documentWait?: {
                    outcome: "extracted" | "missing_documents" | "timed_out" | "run_now";
                    parkedAt: string;
                    releasedAt: string;
                    unreadChartIds: PatientChartId[];
                };
                scopedCharts: { fileName: string | null; id: PatientChartId }[]
                | null;
            };
            templateId: number;
        }

      Returns Promise<
          {
              archived: boolean;
              audit_template_id: number
              | null;
              case_id: number | null;
              created_at: string;
              created_by: string | null;
              deferred_enqueue: Json;
              hidden: boolean;
              id: number;
              ran_against_charts_at: string | null;
              run_context: Json;
              session_id: number | null;
              status: string | null;
              summary: string | null;
              treatment_episode_id: string | null;
              trigger: string | null;
              triggered_at: string | null;
          },
      >

    • Parameters

      • auditRunIds: number[]
      • targetCaseId: number

      Returns Promise<number[]>

    • Parameters

      • options: { supabase: SupabaseClient<Database> }

      Returns this