Circle V2 API Docs
    Preparing search index...
    listEpisodes: QueryProcedure<
        {
            input: { patientId: string };
            meta: object;
            output: {
                admission_date: string;
                discharge_date: string | null;
                external_id: string | null;
                facility_name: string | null;
                id: TreatmentEpisodeId;
                integration_id: string | null;
                integration_status: "error" | "active" | "inactive" | null;
                last_synced_documents: string | null;
                status: string | null;
            }[];
        },
    > = ...

    Every treatment episode for a patient (active and discharged), facility name joined, newest admission first. The shared read behind the manual "Sync episode" selector and any future per-patient episode view — visibility-scoped via canAccessPatient, not gated on the sync feature flag, so callers other than the sync menu can reuse it.