Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KSense Assessment — DemoMed Healthcare API (TypeScript)

End-to-end TypeScript client for the fictional DemoMed Healthcare API:

  • Paginates through patients with retry & backoff (429/500/503)
  • Parses inconsistent fields (e.g., "150/", "TEMP_ERROR")
  • Scores Blood Pressure, Temperature, and Age per spec (uses the higher BP risk when sys/dia differ)
  • Builds alert sets: High-Risk, Fever, Data Quality Issues
  • Submits results to the assessment endpoint

Features

  • ⚙️ Robust HTTP: exponential backoff + jitter for transient failures
  • 📦 Pagination: fetches all pages (limit configurable)
  • 🧮 Scoring engine: pure functions, strict parsing & validation
  • 🧪 Deterministic: stable outputs, deduped alert IDs

Quick Start

npm i
export KSENSE_API_KEY="ak_...your key..."
npx ts-node assessment.ts

Scripts

  • npm run start — run via ts-node
  • npm run build — compile TypeScript
  • npm run submit — alias of start

Scoring Rules (summary)

  • Blood Pressure: Normal=1, Elevated=2, Stage1=3, Stage2=4; take higher stage if sys/dia differ; invalid/missing=0
  • Temperature: ≤99.5 → 0; 99.6–100.9 → 1; ≥101.0 → 2; invalid/missing → 0
  • Age: ≤65 → 1; >65 → 2; invalid/missing → 0
  • Total Risk = BP + Temp + Age

Alerts:

  • High-Risk: total ≥ 4
  • Fever: temp ≥ 99.6°F
  • Data Quality: any invalid/missing in BP/Temp/Age

Tech

TypeScript, node-fetch, ts-node.

Safety

Do not hardcode secrets. Use KSENSE_API_KEY env var.

.gitignore excludes .env, node_modules, dist, logs.

© 2025 Paul Miranda — MIT License.

About

TypeScript client for DemoMed API: scoring, retries, pagination, data quality detection, auto submit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages