/calibrate /simulate /trajectory
Powered by TwinAI

LAT Lab API

Longitudinal Adherence Trajectory modeling and simulation. Pre-computed parameter calibration and Monte Carlo simulation for healthcare adherence modeling.

3
API Endpoints
<10ms
Avg Response
5
Free Calls
Create Free Account API Docs Open LAT Lab
Architecture

Pre-computed Grid

Exhaustive parameter grid across 5 screening intervals

Instant Calibration

Sub-10ms lookup for matching LAT parameters by target adherence

Monte Carlo Engine

Logistic growth + Hill decay simulation with seeded RNG

Trajectory Viz

Single-patient timelines with step-by-step adherence probabilities

API Endpoints
POST /api/calibrate

Find LAT parameter sets matching a target adherence rate from the pre-computed database. Returns ranked results with subpopulation breakdown and age-stratified stats.

ParameterTypeDescription
screening_interval requiredintegerYears between screenings: 1, 2, 3, 5, or 10
target_adherence requiredfloatTarget adherence rate (0.0 - 1.0)
tolerance optionalfloatSearch tolerance band (default: 0.01)
constraints optionalobjectmax_never_screener, min_always_screener
sort_by optionalstringadherence_distance | never_screener | always_screener
limit optionalintegerMax results (default: 20)
Request
curl -X POST http://localhost:3000/api/calibrate \
  -H "Content-Type: application/json" \
  -d '{
    "screening_interval": 3,
    "target_adherence": 0.65,
    "tolerance": 0.02,
    "limit": 5
  }'
Response
// 200 OK
{
  "count": 5,
  "computation_time_ms": 3,
  "results": [
    {
      "params": { "P_0": 0.12, "P_max": 0.85, "r_g": 0.3, "L": 0.15, "K": 8, "n": 2.5 },
      "adherence": { "mean": 0.649, "std": 0.021, "median": 0.652 },
      "subpopulations": {
        "never_screener": 12.3,
        "always_screener": 28.7,
        "early_adopter": 34.5,
        "intermittent": 24.5
      },
      "age_brackets": { ... }
    },
    ...
  ]
}

Try it

POST /api/simulate

Run a Monte Carlo LAT simulation with specified parameters. Returns population-level adherence statistics, subpopulation ratios, and age-stratified results.

ParameterTypeDescription
P_0 requiredfloatInitial adherence probability (0-1)
P_max requiredfloatMaximum adherence ceiling (0-1)
r_g requiredfloatGrowth rate (0-5)
L requiredfloatDecay floor probability (0-1)
K requiredfloatHalf-max time for Hill decay (0.1-50)
n requiredfloatHill coefficient / cooperativity (0.1-10)
screening_interval optionalintegerYears between screenings (default: 3)
population_size optionalintegerNumber of individuals (default: 1000, max: 10000)
Request
curl -X POST http://localhost:3000/api/simulate \
  -H "Content-Type: application/json" \
  -d '{
    "P_0": 0.12, "P_max": 0.85, "r_g": 0.3,
    "L": 0.15, "K": 8, "n": 2.5,
    "screening_interval": 3,
    "population_size": 1000
  }'
Response
// 200 OK
{
  "adherence": {
    "mean": 0.649, "std": 0.023, "median": 0.652,
    "ci_lower": 0.604, "ci_upper": 0.694
  },
  "subpopulations": { ... },
  "age_brackets": { ... },
  "computation_time_ms": 45
}
POST /api/trajectory

Generate a single patient trajectory for visualization. Returns step-by-step adherence probabilities, screening decisions, and a summary with adherence rate.

ParameterTypeDescription
P_0 ... n requiredfloatSame 6 LAT parameters as /api/simulate
screening_interval optionalintegerYears between screenings (default: 3)
seed optionalstringRNG seed for reproducible trajectories
Request
curl -X POST http://localhost:3000/api/trajectory \
  -H "Content-Type: application/json" \
  -d '{
    "P_0": 0.12, "P_max": 0.85, "r_g": 0.3,
    "L": 0.15, "K": 8, "n": 2.5,
    "screening_interval": 3, "seed": "patient_42"
  }'
Response
// 200 OK
{
  "steps": [
    { "age": 45, "probability": 0.12, "screened": false, "phase": "growth" },
    { "age": 48, "probability": 0.34, "screened": true, "phase": "growth" },
    ...
  ],
  "summary": {
    "adherence_rate": 0.6,
    "screenings": 6,
    "opportunities": 10
  }
}
Utility Endpoints
GET /api

API info and available endpoints.

GET /api/health

Health check. Returns { status: "ok" }.

Authentication

All API endpoints require an API key. Include it in every request:

Header
curl -X POST http://localhost:3000/api/calibrate \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Response headers include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.

Get Your API Key

Create a free account to get your API key. Manage keys, track usage, and upgrade your plan from your dashboard.

Create Free Account Sign In

5 free API calls per month. No credit card required.

Pricing
Free
$0
per month
5 API calls/month
Try it out
Get Started
Starter
$19
per month
100 API calls/month
For researchers
Pro
$99
per month
1,000 API calls/month
For teams & integrations
Enterprise
Custom
contact us
Unlimited API calls
Custom volume pricing
Contact Sales