fulcra-lab-results
Skill10 starsChanged 3 months agoMITView on GitHub
Parse a lab-report PDF (LabCorp, Quest, hospital labs — any provider) into one canonical Fulcra data track per marker (LDL-C, HbA1c, TSH, ferritin, …). You read the PDF; the fulcra-labs engine normalizes units, validates, and ingests. Verify-before-ingest: nothing is written without passing validation or explicit operator confirmation. Use when the operator says 'parse my labs', 'import my LabCorp/Quest results', or hands over a lab-report PDF.
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- coordinator-disciplineSkill
- fulcra-agent-atcSkill
- fulcra-agent-automationSkill
- fulcra-agent-cloud-coordinatorSkill
- fulcra-agent-continuitySkill
- fulcra-agent-directivesSkill
- fulcra-agent-durable-stateSkill
- fulcra-agent-forgeSkill
- fulcra-agent-healthSkill
- fulcra-agent-operatorSkill
- fulcra-agent-presenceSkill
- fulcra-agent-reconcileSkill
- fulcra-agent-reviewSkill
- fulcra-agent-rolesSkill
- fulcra-agent-tasksSkill
- fulcra-content-reviewSkill
- fulcra-fdeSkill
- sealed-secretsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 58
Read the PDF and produce the extraction schema (below).
- Very specific: line 63
Exactly as printed: No unit conversion, no rounding, no inferring a missing unit.
- Very specific: line 66
Collection date, not report date: When both appear, collected_at is the *specimen collection* date/time (often "Collected:" / "Date …
- Very specific: line 70
Write each pass to its own JSON file (e.g.
- Distinctive: line 86
Always dry-run first — it validates and prints a verdict per row without writing anything:
- Very specific: line 129
Medical data stays local: Only the numeric values the operator confirms go to Fulcra.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
fulcra-lab-results — lab-report PDFs into per-marker Fulcra tracks
Turn a lab-report PDF into structured, queryable history in the operator's own Fulcra account: one canonical data track per marker (Total Cholesterol, LDL-C, HbA1c, TSH, ferritin, …), regardless of which lab produced the report. Over time, every LDL-C result — LabCorp in March, Quest in September, a hospital draw in between — lands on the same track, so it reads as one time series.
The split: model extracts, code verifies
This is the load-bearing idea. You (the model) do exactly one thing the code can't: read the PDF and
transcribe what's printed. Everything else — resolving "CHOL" to total-cholesterol, converting
5.5 mmol/L to 99.1 mg/dL, sanity-checking the value, computing the idempotent id, writing to Fulcra
— is done by the deterministic fulcra-labs engine. Do NOT convert units, round, infer a missing unit,
or "fix" a value yourself. Transcribe exactly what's on the page; let the engine do the rest.
This pipeline is verify-before-ingest — the deliberate opposite of the media plugins' over-capture.
Lab data is medical PII, so a wrong value is worse than a missing one. Nothing reaches Fulcra unless it
passes validation (ok) or the operator explicitly confirms a flagged row.
Invocation. The engine is the fulcra-labs console script. From the fulcra-tools repo run it with
uv run fulcra-labs <command>; once installed as a tool, just fulcra-labs <command>. All commands take
--json for a machine envelope. Run fulcra-labs markers to see the registry.
Where to start
Stateless — no probes. Each PDF is a fresh, operator-gated transaction; there is no cross-session
journey to resume into. The intermediate files (pass_a.json, pass_b.json, agreed.json) are ephemeral
local scratch, and re-running any step on the same file is a server-side no-op (deterministic source ids),
so an interrupted run simply restarts from Intake with the same PDF. The only prerequisites — an authed
fulcra account and the fulcra-labs engine — are covered under Invocation above.
The flow
1. Intake
The operator provides one or more PDF paths (or points at a folder). Save any chat-attached PDF to a local path first. Confirm the file(s) you'll work on.
Coming later — portal fetch. A future browser-agent step will pull the PDF straight from the LabCorp / Quest patient portal. For now the operator downloads the PDF themselves and hands you the path. Don't attempt to log into a lab portal.
2. Extract the PDF — TWICE, independently
Read the PDF and produce the extraction schema (below). Then read it again from scratch — a second, independent pass; do not copy the first pass's numbers. Two independent transcriptions that agree are the model-side guard that pairs with the code-side validation.
Transcription rules (both passes):
- Exactly as printed. No unit conversion, no rounding, no inferring a missing unit. If the unit
column is blank,
unit_rawisnull— never guess it. - One row per analyte.
- Collection date, not report date. When both appear,
collected_atis the specimen collection date/time (often "Collected:" / "Date collected"). Capture the report date separately asreport_date. - Capture the reference range and any H/L/A flag verbatim if present (
reference_range_raw,flag_raw).
Write each pass to its own JSON file (e.g. pass_a.json, pass_b.json). Schema and detailed rules:
references/extraction-schema.md.
3. Cross-check the two passes
uv run fulcra-labs check pass_a.json pass_b.json --out agreed.json --jsonRows that agree on (marker, value, unit) go into agreed.json (an ingest-ready extraction).
Disagreements are listed. For each disagreement, re-read the PDF a third time for just that row and
resolve it; if it's still ambiguous, show the operator the exact text and ask. Add any resolved rows into
agreed.json. Do not ingest a row the two passes disagreed on until it's resolved.
4. Validate (dry run), confirm, then ingest
Always dry-run first — it validates and prints a verdict per row without writing anything:
uv run fulcra-labs ingest agreed.json --source-doc report.pdf --dry-run --jsonEach row gets a verdict:
ok— resolved, unit accepted, value plausible → auto-ingestable.review— needs an operator call: unresolved/ambiguous marker, missing or unknown unit, implausible value (a classic unit-mixup catch), or an in-batch duplicate. Reasons are attached.reject— malformed: non-numeric value, no/parse-failed collection date, future or pre-1990 date. Never ingestable.
Show the operator the verdict table. Walk through every review and reject row with its reason.
Then get explicit confirmation before the real write. Only after they confirm:
uv run fulcra-labs ingest agreed.json --source-doc report.pdfTo push a specific reviewed row through (e.g. an implausible-but-real value the operator vouches for),
pass its marker key: --yes-reviewed ldl-c,ferritin. Never blanket-confirm review rows on the operator's
behalf.
The engine resolves-or-creates each marker's track on first use (idempotently), then writes each ok
row. Re-running is safe: the deterministic source id makes a re-ingest a server-side no-op.
5. Report back
Summarize: markers ingested, tracks newly created vs adopted, the review/reject queue (with reasons and
what you did about each), and any in-run dedupe skips. Point the operator at
Context Web to browse the tracks. Use fulcra-labs status to show
per-track observation counts.
Safety rules
- Never guess a unit. A blank unit is
null; the engine holds it for review. Guessing a unit is the single most dangerous error this pipeline can make. - Never convert or round in extraction. Transcribe as printed; the engine converts.
- Never ingest a
revieworrejectrow without explicit operator confirmation (and even then onlyreviewrows, via--yes-reviewed).rejectrows never ingest. - Medical data stays local. Only the numeric values the operator confirms go to Fulcra. Source PDFs
are archived to
~/.config/fulcra-labs/documents/on this machine only — never uploaded. - Don't soft-delete tracks. Fulcra has no per-event delete; cleanup is an operator decision.
- Collection date is the event time, not the report date.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

