Skip to main content
WorkProjects

Tiny Solutions

Early Intervention case management

stable
View raw

Multi-tenant case management for NY Early Intervention agencies. A Rails 8.1 monolith that runs the intake, clinical, and billing pipeline for pediatric therapy agencies coordinating developmental services for children ages 0–3. Row-level tenant isolation, immutable audit trail, Packwerk-enforced domain boundaries, 158 migrations under version control.

What it is

Agencies receiving Early Intervention referrals from NY municipalities need to move a child from referral to evaluation to ongoing service delivery to insurance claim inside a single system that keeps a clean HIPAA audit trail. This app is that system.

The codebase is organized as concept-driven Rails — app/concepts/{ai, audit, billing, claim, client, compliance, evaluation, export, lock, note, role, search, sharing, tenant} — each with its own package.yml Packwerk boundary. Every tenant-scoped query is scoped by agency_id via acts_as_tenant. Every clinical write is versioned by PaperTrail with field-level diffs. A Next.js rewrite of the same domain is in progress in tiny-solution-next; this page covers the Rails system that is the authoritative implementation today.

By the numbers

MetricValue
Rails version8.1
Ruby version3.4
Database migrations158
Packwerk domain packs14
Multi-tenancyRow-level via acts_as_tenant
Audit trailPaperTrail 17.x (immutable, per-tenant)
EDI formatsX12 837P (claim) + 835 (remittance)
Accessibility barWCAG 2.1 AA (axe-core in system tests)
Test frameworkMinitest + Capybara + Cuprite
CISharded across parallel runners

Architecture

              Browser (Turbo + Stimulus + ViewComponent)
                              |
                       Rails 8.1 monolith
                              |
  app/concepts/
    ai/           AI-assisted clinical note quality (AWS Bedrock)
    audit/        PaperTrail wiring, audit read models
    billing/      Rate tables, fee schedules
    claim/        EDI 837P generation, 835 remittance reconciliation
    client/       Child, guardian, sibling, demographics
    compliance/   Consent, state-mandated forms, expirations
    evaluation/   Initial / ongoing evaluation workflows
    export/       Report generation (xlsx, PDF)
    lock/         Record locking, edit coordination
    note/         Session notes, AASM state machine
    role/         Custom roles, per-user permission overrides
    search/       OmniSearch: PostgreSQL full-text across tenants
    sharing/      Cross-agency data sharing contracts
    tenant/       Agency context, multi-agency switching
                              |
           Packwerk check (boundary enforcement in CI)
                              |
        PostgreSQL (Neon, us-east-1) — single data plane
                              |
       Solid Queue / Solid Cache / Solid Cable on Postgres
                     (no Redis dependency)

Each pack declares its boundary in package.yml. Cross-pack calls go through public APIs. packwerk check runs in CI. PaperTrail records immutable versions with field-level object_changes on every clinical mutation, scoped per-tenant, never deleted.

Key features

  • Kanban intake pipeline — referral staging with drag-through workflow from initial intake to active case.
  • Child records with ICD-10 codes — structured demographics, diagnoses, and sibling linking across families.
  • Auto-save on blur — clinical forms persist field-by-field, no explicit submit.
  • OmniSearch full-text — PostgreSQL tsvector indexes across child, guardian, and note records, scoped per tenant.
  • State-mandated form generation — Active Storage for consent documents with hexapdf AcroForm fill for NY DOH PDFs.
  • EDI 837P / 835 — X12 837P medical claim generation and 835 remittance parsing via stupidedi.
  • HIPAA-compliant audit trails — PaperTrail immutable versions satisfying 45 CFR 164.312(b), scoped per tenant.
  • AASM state machines — workflow models (e.g. DemographicEditRequest) with typed transitions.
  • Packwerk domain boundaries — 14 concept packs with explicit public APIs and dependency declarations, enforced in CI.
  • Pundit authorization — plain-Ruby policies per concept, no DSL.
  • Soft-deletediscard gem; no destructive deletes on clinical tables.
  • Strong migrations — dangerous migrations caught at dev time before they reach production.
  • Cross-agency sharing contracts — explicit sharing concept governs what data a referring agency can expose to a receiving one.
  • Record locking — dedicated lock/ pack coordinates concurrent edits on clinical records.
  • AI-assisted note quality — AWS Bedrock checks clinical notes for completeness before they advance in the state machine.
  • OCR pipelinertesseract + ruby-vips for extracting text from uploaded consent scans.

What makes it stand out

  • Concept-driven Rails. 14 Packwerk packs with declared public APIs — the monolith reads like a well-bounded modular system, not a Rails-ball-of-mud.
  • Row-level tenant isolation at the model layer. Every clinical table scopes by agency_id through acts_as_tenant; isolation is not a controller concern.
  • Single-Postgres data plane. Solid Queue, Solid Cache, and Solid Cable all run on the same Neon instance — jobs, cache, and WebSockets with zero Redis.
  • Audit-first by construction. PaperTrail records immutable, field-level diffs on every clinical mutation, scoped per tenant and never deleted — 45 CFR 164.312(b) satisfied structurally.
  • Accessibility enforced in tests. Capybara + Cuprite system tests assert WCAG 2.1 AA via axe-core; a11y regressions fail CI, not review.
  • EDI done properly. stupidedi for X12 837P claim generation and 835 remittance reconciliation — the billing pipeline talks the format insurers actually accept.
  • 158 migrations, all versioned. Schema history is the system-of- record for how the domain evolved; strong_migrations catches dangerous changes at dev time.

Stack

LayerTechnology
Web frameworkRails 8.1
LanguageRuby 3.4
DatabasePostgreSQL (Neon, us-east-1)
FrontendTurbo + Stimulus + ViewComponent 4.x
Multi-tenancyacts_as_tenant (row-level)
Audit trailpaper_trail 17.x
Authorizationpundit 2.5
State machinesaasm 5.5
Background jobsSolid Queue
CacheSolid Cache
WebSocketsSolid Cable
EDIstupidedi (837P / 835)
PDFhexapdf (AcroForm fill)
OCRrtesseract + ruby-vips
Soft deletediscard
Migration safetystrong_migrations
AIAWS Bedrock (clinical note quality)
DeployKamal
TestingMinitest + Capybara + Cuprite + axe-core