Skip to content

nsumesh/Accrue

Repository files navigation

Accrue

Pick better trial sites, faster — grounded in real public data.

Accrue is a clinical-trial site feasibility and startup platform. It ingests four public datasets — ClinicalTrials.gov (trials, investigator sites, PI history, structured eligibility), CDC PLACES (disease prevalence by county and census tract), Census ACS (population, age/sex, and income for each site's catchment), and the Census Geocoder (facility coordinates → county/tract) — normalizes them into a Postgres/PostGIS database, and runs them through a deterministic analytical core that scores candidate sites, projects enrollment, and sequences regulatory startup. An AI layer turns those engine outputs into a written feasibility report, a plain-language protocol synopsis, and per-site outreach — with every figure traced back to the exact datum it came from, so no statistic is invented.

Live: accrue-ten.vercel.app


What it does

CROs and biotechs planning a trial select investigator sites, model enrollment, size up the competitive landscape, and track IRB/regulatory startup — today across disconnected tools and spreadsheets, where a badly chosen site set costs months of timeline and budget. Accrue consolidates that into four surfaces over one deterministic analytical core. A user starts from a condition, phase, and geography and moves through:

  • Landscape Explorer — search and filter existing trials by condition, phase, status, sponsor, and geographic radius, with a sortable table and a MapLibre/deck.gl map kept in sync. Open any trial for its eligibility, sponsors, and full site list; facet counts update live as filters change.
  • Site Feasibility Map — for a condition + region + radius, score and rank every candidate site by fusing four signals into a 0–1 score: local disease prevalence (CDC PLACES), catchment fit (Census ACS population narrowed by the trial's structured eligibility — age, sex, and so on), competition (count of other recruiting trials pulling from the same pool within the radius), and site/PI track record (prior trials, completion rate, therapeutic-area experience, and recency derived from ClinicalTrials.gov). A prevalence choropleth underlays score-colored site markers, and each ranked site opens a per-factor breakdown of how its score was built.
  • Enrollment Planner — expand the recruitment funnel (prevalence → eligible → screened → enrolled) and project months-to-target per site under adjustable screen-fail rate, consent rate, site count, and enrollment rate; compare scenarios side by side.
  • Startup Tracker — encode the IRB/site-activation sequence as dependency rules and produce an ordered task list with durations, projected dates, and a highlighted critical path that reflows downstream milestones when a task slips.

The AI layer narrates those engine outputs into three artifacts: a feasibility report (executive summary, narrative sections, ranked-site rationales, and risks), a plain-language protocol synopsis, and per-site outreach drafts. It never gets free rein — it's handed a grounded bundle of engine numbers, and every value it writes is a citation linking back to a Sources ledger. The engines themselves are pure, deterministic TypeScript covered by golden-number tests, and a deterministic offline generator backs the AI in tests and demos.

Who it's for

Feasibility and clinical-operations teams at CROs and biotechs — site-identification and study-startup leads, trial planners, and the business-development teams scoping a proposal — who need to answer, before committing budget: which investigator sites to activate for a given condition, phase, and region; how many sites and where to hit an enrollment target on schedule; whether the surrounding area is already saturated with competing trials; and how long IRB/site activation will take. Today those answers are assembled by hand from ClinicalTrials.gov searches, prevalence lookups, and spreadsheets; Accrue derives them from one grounded model.

Stack

  • App / deploy: Next.js 16 (App Router) on Vercel — route handlers + server actions are the API; Vercel Cron drives scheduled jobs.
  • Data: Supabase (Postgres + PostGIS) for dev & prod; Drizzle schema + query layer over the postgres (postgres.js) driver. ETL snapshots via DuckDB.
  • Map: MapLibre GL basemap + deck.gl GPU layers (choropleth + dense markers).
  • AI: Anthropic Claude via the Vercel AI SDK (@ai-sdk/anthropic), structured output validated with Zod.
  • Frontend: shadcn/ui + Tailwind, TanStack Query (server state), Zustand (UI/map state).
  • Auth / tenancy: Supabase Auth + Postgres Row-Level Security.
  • Testing: Vitest (unit/integration), Playwright (E2E), MSW (mock external APIs).

Local setup

Prerequisites: Node ≥ 20 and Docker (for the local Supabase stack).

npm install
cp .env.example .env.local        # then fill in values (see below)

# Local DB — needs Docker running:
npm run supabase:start            # boots Postgres+PostGIS, Auth (GoTrue), Studio
npm run db:migrate                # applies /drizzle/*.sql

# Seed reference data (optional, one therapeutic area + a few states):
npm run etl:trials -- --cond "NASH" --status RECRUITING
npm run etl:prevalence
npm run etl:catchment
npm run etl:xwalk

npm run dev                       # http://127.0.0.1:3000

Required env vars (see .env.example): DATABASE_URL (Supabase pooler), SUPABASE_URL + NEXT_PUBLIC_SUPABASE_URL (bare project URL), SUPABASE_ANON_KEY + NEXT_PUBLIC_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY, ANTHROPIC_API_KEY, CENSUS_API_KEY, and CRON_SECRET (production only). See docs/database.md for full DB setup and docs/deploy.md for production deployment.

Scripts

Script What it does
npm run dev / build / start Next.js dev / production build / serve
npm run typecheck tsc --noEmit
npm run lint ESLint
npm run test Vitest unit/integration tests
npm run test:db DB/RLS tenant-isolation tests
npm run e2e Playwright end-to-end tests
npm run db:migrate Apply SQL migrations in /drizzle
npm run db:studio Drizzle Studio
npm run etl:trials / etl:prevalence / etl:catchment / etl:xwalk ETL ingest jobs
npm run supabase:start / supabase:stop Local Supabase stack

About

Clinical-trial site feasibility & startup platform - scores and ranks investigator sites, projects enrollment, and sequences regulatory startup from public data (ClinicalTrials.gov, CDC PLACES, Census), with AI reports grounded in every cited number.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages