Circle V2 API Docs
    Preparing search index...

    Module @repo/services

    @repo/services

    Domain service classes for business logic orchestration. Services extend BaseService from @repo/base-service, so their perform() methods return Safe<T> results. The package currently includes services for chart review and other domain operations.

    Use a service when logic should be decoupled from tRPC (or other transports): the same orchestration can be called from a router, a script, a job, or tests without importing @repo/trpc.

    Services are a good fit when you want to:

    • Compose repos and other services (e.g. load rows, group them, score them) in one place instead of growing procedure handlers.
    • Reuse behavior across entrypoints without copy-pasting.
    • Test in isolation by mocking @repo/db (or peers) and calling perform() or the functionify export, without spinning up tRPC.

    tRPC procedures should stay thin: validate input, call the service, map Safe errors to TRPCError (or similar), and return result.data.

    %%{init:{"theme":"dark"}}%% graph TD services["@repo/services"] base_service["@repo/base-service"] safe["@repo/safe"] db["@repo/db"] typescript_config["@repo/typescript-config"] vitest_config["@repo/vitest-config"] services --> base_service services --> safe services --> db services -.-> typescript_config services -.-> vitest_config
    %%{init:{"theme":"default"}}%% graph TD services["@repo/services"] base_service["@repo/base-service"] safe["@repo/safe"] db["@repo/db"] typescript_config["@repo/typescript-config"] vitest_config["@repo/vitest-config"] services --> base_service services --> safe services --> db services -.-> typescript_config services -.-> vitest_config
    graph TD
      services["@repo/services"]
      base_service["@repo/base-service"]
      safe["@repo/safe"]
      db["@repo/db"]
      typescript_config["@repo/typescript-config"]
      vitest_config["@repo/vitest-config"]
      services --> base_service
      services --> safe
      services --> db
      services -.-> typescript_config
      services -.-> vitest_config
    import { listRecentPatientReviewRunsService } from "@repo/services/chart-review/listRecentPatientReviewRuns.service";
    import { runChartReviewService } from "@repo/services/chart-review/runChartReview.service";

    const recent = await listRecentPatientReviewRunsService({ patientId: "123" });
    if (recent.error) {
    // handle error
    }

    const chartReview = await runChartReviewService({ patientId: "123", templateId: 1 });
    if (chartReview.error) {
    // handle error
    }
    Script Description
    test Run Vitest with coverage
    test:watch Run Vitest in watch mode
    check-types Typecheck with tsc --noEmit

    Modules

    chart-review/auditRunScoring
    chart-review/auditRunScoring.service
    chart-review/auditRunScoring.service.test
    chart-review/listPatientAuditRuns
    chart-review/listPatientAuditRuns.service
    chart-review/listPatientAuditRuns.service.test
    chart-review/listRecentPatientReviewRuns
    chart-review/listRecentPatientReviewRuns.service
    chart-review/listRecentPatientReviewRuns.service.test
    chart-review/runChartReview
    chart-review/runChartReview.service
    chart-review/runChartReview.service.test
    facilities/updateFacilityWithIntegration
    inviteUser