Files
stack/src/lead/review/codes.py
kert bb747f272d
Some checks failed
CI / lint (push) Successful in 45s
CI / notebooks-smoke (push) Successful in 1m40s
CI / lint (pull_request) Successful in 28s
CI / test (push) Failing after 3m39s
CI / notebooks-smoke (pull_request) Successful in 1m35s
CI / test (pull_request) Failing after 3m22s
Infra CI / notebooks (push) Successful in 1m0s
Infra CI / zotero (push) Successful in 17s
Infra CI / docs (push) Successful in 20s
Infra CI / api (push) Successful in 1m11s
Infra CI / bcda (push) Successful in 1m31s
Infra CI / mc (push) Successful in 16s
Infra CI / llm (push) Successful in 52s
Infra CI / zotero (pull_request) Successful in 23s
Infra CI / docs (pull_request) Successful in 16s
Infra CI / notebooks (pull_request) Successful in 58s
Infra CI / api (pull_request) Successful in 17s
Infra CI / bcda (pull_request) Successful in 16s
Infra CI / llm (pull_request) Successful in 20s
Infra CI / mc (pull_request) Successful in 17s
feat(lead): load the public mirror and serve the explorer
Local files land in the DuckDB mirror with the source headers kept: group labels, stacked IRS names, headerless code maps, and the HCPCS action key. The read-only explorer and the review page are wired at lead.fhirworx.io. OEWS now includes 2025.
2026-11-02 00:22:35 -05:00

50 lines
1.3 KiB
Python

"""The five LEAD strands and the decision vocabulary the gate already uses."""
from __future__ import annotations
import re
PROJECTS = (
"lead-history",
"lead-limits",
"lead-scan",
"lead-precursors",
"lead-external",
)
DECISIONS = ("include", "exclude", "uncertain")
STAGES = ("title_abstract", "full_text")
PASSES = (1, 2)
# Same sizes prisma.calibrate.sized enforces. A test pins the two.
GATE = {"title_abstract": 200, "full_text": 50}
_CODE = re.compile(r"`([a-z0-9-]+)`")
def reason_codes(project: str) -> tuple[str, ...]:
"""Exclusion codes from that strand's codebook, in codebook order."""
from prisma.project import STARTERS
if project not in PROJECTS:
raise ValueError(project)
text = STARTERS[project][2]
return tuple(dict.fromkeys(_CODE.findall(text)))
def criteria(project: str) -> str:
"""The strand's inclusion criteria, as the anchor note would show them."""
from prisma.project import STARTERS
if project not in PROJECTS:
raise ValueError(project)
return STARTERS[project][0]
def reasons(project: str) -> str:
"""The strand's exclusion codebook."""
from prisma.project import STARTERS
if project not in PROJECTS:
raise ValueError(project)
return STARTERS[project][2]