fix(pfs): cms-summaries — pin the stance model, explicit pair phrases, quantifiers modify commenters, plain-refusal actions
This commit is contained in:
@@ -118,13 +118,15 @@ def _publish() -> None:
|
||||
typer.echo(f"replica → {publish_replica('aco')}")
|
||||
|
||||
|
||||
def _classifier() -> Any:
|
||||
def _classifier(*, pin: bool = False) -> Any:
|
||||
from llm import config as llm_config
|
||||
from llm.classify import closed_vocab_classifier
|
||||
from llm.pool import HostPool
|
||||
|
||||
cfg = llm_config.load()
|
||||
return closed_vocab_classifier(cfg, HostPool.from_config(cfg))
|
||||
return closed_vocab_classifier(
|
||||
cfg, HostPool.from_config(cfg), model=cfg.instruct_model if pin else None
|
||||
)
|
||||
|
||||
|
||||
def _asker() -> Any:
|
||||
@@ -1189,7 +1191,7 @@ def cms_summaries(
|
||||
rows = cms_summaries_rows(
|
||||
store,
|
||||
fam,
|
||||
classify=None if no_llm else _classifier(),
|
||||
classify=None if no_llm else _classifier(pin=True),
|
||||
model=model,
|
||||
log=RunLog(ledger_path("cms-summaries", fam.key)),
|
||||
limit=limit,
|
||||
|
||||
@@ -54,23 +54,31 @@ def _default_post(url: str, json: dict) -> dict:
|
||||
|
||||
|
||||
def closed_vocab_classifier(
|
||||
cfg: Any, pool: Any, *, post: Callable[..., dict] | None = None
|
||||
cfg: Any,
|
||||
pool: Any,
|
||||
*,
|
||||
post: Callable[..., dict] | None = None,
|
||||
model: str | None = None,
|
||||
) -> Classifier:
|
||||
"""Return ``classify(text, choices) -> slug | None`` bound to *pool*.
|
||||
|
||||
``pool.check`` runs once here, not per call (I5) — it's a host-liveness
|
||||
probe, not per-request work, and a code with hundreds of element lines
|
||||
used to re-probe the pool hundreds of times."""
|
||||
used to re-probe the pool hundreds of times.
|
||||
|
||||
*model* pins every call to that model on every host (a large-VRAM
|
||||
host no longer upgrades it), for callers whose recorded outputs name
|
||||
the model; the default picks per host (``pick_model``)."""
|
||||
send = post or _default_post
|
||||
pool.check(cfg.instruct_model)
|
||||
pool.check(model or cfg.instruct_model)
|
||||
|
||||
def classify(text: str, choices: Sequence[str]) -> str | None:
|
||||
with pool.acquire_generation() as host:
|
||||
model = pick_model(cfg, pool, host)
|
||||
chosen = model or pick_model(cfg, pool, host)
|
||||
data = send(
|
||||
f"{host}/api/chat",
|
||||
json={
|
||||
"model": model,
|
||||
"model": chosen,
|
||||
"messages": build_prompt(text, choices),
|
||||
"stream": False,
|
||||
"options": {"num_ctx": cfg.chat_num_ctx, "temperature": 0},
|
||||
|
||||
@@ -3,7 +3,7 @@ dossier task 7).
|
||||
|
||||
The Federal Register prints a rule's public-comment summaries as
|
||||
``Comment:`` / ``Response:`` paragraph pairs. Each pair that names a
|
||||
family code or one of the family's synonym phrases becomes one row
|
||||
family code or one of the family's curated pair phrases becomes one row
|
||||
carrying CMS's quantifier ("a majority of commenters"), the stance of
|
||||
the summarized comments and CMS's response action.
|
||||
|
||||
@@ -29,7 +29,9 @@ from pfs.rounds import _anchor_rows, rule_items
|
||||
from pfs.runlog import RunLog, input_hash, ledger_path, run_units
|
||||
|
||||
TASK = "cms-summaries"
|
||||
SUMMARY_PROMPT_VERSION = "v1"
|
||||
# v2: stances pinned to cfg.instruct_model (v1 entries came from a mix of
|
||||
# models and are never replayed; the ledger is append-only)
|
||||
SUMMARY_PROMPT_VERSION = "v2"
|
||||
SUMMARY_STANCES = ("support", "modify", "oppose", "mixed", "unclear")
|
||||
_PROMPT_PREFIX = "CMS's summary of public comments:"
|
||||
_PROMPT_CHARS = 1500
|
||||
@@ -41,10 +43,10 @@ _QUANTIFIERS = (
|
||||
"majority",
|
||||
re.compile(r"\bmajority of (?:the )?commenters\b|\bmost commenters\b", re.I),
|
||||
),
|
||||
("many", re.compile(r"\bmany\b|\bnumerous commenters\b", re.I)),
|
||||
("several", re.compile(r"\bseveral\b", re.I)),
|
||||
("some", re.compile(r"\bsome\b", re.I)),
|
||||
("few", re.compile(r"\b(?:a )?few commenters\b", re.I)),
|
||||
("many", re.compile(r"\b(?:many|numerous) (?:of the )?commenters\b", re.I)),
|
||||
("several", re.compile(r"\bseveral (?:of the )?commenters\b", re.I)),
|
||||
("some", re.compile(r"\bsome (?:of the )?commenters\b", re.I)),
|
||||
("few", re.compile(r"\b(?:a )?few (?:of the )?commenters\b", re.I)),
|
||||
("one", re.compile(r"\b(?:one|a|another) commenter\b", re.I)),
|
||||
)
|
||||
|
||||
@@ -66,7 +68,14 @@ _ACTIONS = (
|
||||
),
|
||||
(
|
||||
"not_finalized",
|
||||
re.compile(r"\bnot (?:to )?finaliz|\bare not adopting\b|\bdecline", re.I),
|
||||
re.compile(
|
||||
r"\bnot (?:to )?finaliz|\bare not adopting\b|\bdecline"
|
||||
# R45, from the live responses: a plain refusal
|
||||
r"|\bdo not have (?:the )?(?:legislative )?authority\b"
|
||||
r"|\bit would be inappropriate\b"
|
||||
r"|\bdo not believe\b[^.]{0,100}\bare warranted\b",
|
||||
re.I,
|
||||
),
|
||||
),
|
||||
("acknowledged", re.compile(r"\bthank|\bappreciat", re.I)),
|
||||
)
|
||||
@@ -115,7 +124,7 @@ def summaries(
|
||||
counts: dict[str, int] | None = None,
|
||||
) -> list[CmsSummaryRow]:
|
||||
"""One row per Comment:/Response: pair in a PFS rule (corrections
|
||||
left out) naming a family code or synonym phrase. With *classify*
|
||||
left out) naming a family code or one of its curated pair phrases. With *classify*
|
||||
(and its *model* name) the stances are asked through the ledger
|
||||
*log*; without it (``--no-llm``) the stances recorded for
|
||||
*replay_model* are replayed, and every other row is stance
|
||||
@@ -123,11 +132,13 @@ def summaries(
|
||||
counts of the model calls."""
|
||||
kinds = {
|
||||
it["item_key"]: it["kind"]
|
||||
for it in rule_items(store, _anchor_rows(store, family.codes, family.synonyms))
|
||||
for it in rule_items(
|
||||
store, _anchor_rows(store, family.codes, family.pair_phrases)
|
||||
)
|
||||
}
|
||||
spans = [
|
||||
s
|
||||
for s in fr_pair_spans(store, family.codes, family.synonyms)
|
||||
for s in fr_pair_spans(store, family.codes, family.pair_phrases)
|
||||
if s.item_key in kinds
|
||||
]
|
||||
units = {f"{s.item_key}:{s.comment_p_id}": s for s in spans}
|
||||
|
||||
@@ -51,6 +51,9 @@ class CuratedFamily:
|
||||
synonyms: tuple[str, ...]
|
||||
members: tuple[CuratedMember, ...]
|
||||
links: tuple[CuratedLink, ...]
|
||||
#: phrases that, besides a code, qualify a Comment:/Response: pair for
|
||||
#: the family (``pfs.cms_summaries``); empty = code-only
|
||||
pair_phrases: tuple[str, ...] = ()
|
||||
|
||||
@property
|
||||
def codes(self) -> tuple[str, ...]:
|
||||
@@ -145,7 +148,13 @@ def _parse(key: str, raw: Any) -> CuratedFamily:
|
||||
)
|
||||
)
|
||||
synonyms = tuple(str(s).strip().lower() for s in raw.get("synonyms") or ())
|
||||
return CuratedFamily(key, str(raw["name"]), synonyms, tuple(members), tuple(links))
|
||||
phrases = raw.get("pair_phrases") or []
|
||||
if not isinstance(phrases, list) or not all(isinstance(x, str) for x in phrases):
|
||||
raise ValueError(f"{key}: pair_phrases must be a list of strings")
|
||||
pair_phrases = tuple(x.strip().lower() for x in phrases if x.strip())
|
||||
return CuratedFamily(
|
||||
key, str(raw["name"]), synonyms, tuple(members), tuple(links), pair_phrases
|
||||
)
|
||||
|
||||
|
||||
def load_curated(path: Path | None = None) -> dict[str, CuratedFamily]:
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
HOME-VISITS:
|
||||
name: Home or Residence Services
|
||||
synonyms: [home visit, home visits, home or residence, residence visit, domiciliary, rest home visit, house call, house calls]
|
||||
# Phrases that qualify a Comment:/Response: pair besides a code (pfs.cms_summaries).
|
||||
# Visit-naming only; each was checked against every phrase-only row it admits.
|
||||
pair_phrases: [home or residence visit, home or residence services, home or residence e/m, residence visit, rest home visit, home visit codes, home visit e/m, house call, domiciliary care visit]
|
||||
members:
|
||||
- {code: '99341', role: base, cite: {item_key: PETM225D, p_id: 1672}}
|
||||
- {code: '99342', role: base, cite: {item_key: PETM225D, p_id: 1672}}
|
||||
|
||||
@@ -176,7 +176,7 @@ _RESPONSE_RE = re.compile(r"^Response:", re.I)
|
||||
class PairSpan:
|
||||
"""One ``Comment:``/``Response:`` pair (Ruling A12) of an FR rule item:
|
||||
the paragraph ids of its two ends, their texts, and the family codes
|
||||
the whole span names (empty when only a synonym phrase qualified it)."""
|
||||
the whole span names (empty when only a phrase qualified it)."""
|
||||
|
||||
item_key: str
|
||||
rule_year: int
|
||||
|
||||
@@ -1680,7 +1680,9 @@ class TestCmsSummaries:
|
||||
return self._rows()
|
||||
|
||||
monkeypatch.setattr(pfs_cli, "cms_summaries_rows", fake)
|
||||
monkeypatch.setattr(pfs_cli, "_classifier", lambda: "CLS")
|
||||
monkeypatch.setattr(
|
||||
pfs_cli, "_classifier", lambda **kw: "CLS" if kw == {"pin": True} else 1 / 0
|
||||
)
|
||||
monkeypatch.setattr(pfs_cli, "_model_name", lambda: "qwen-x")
|
||||
monkeypatch.setattr(
|
||||
pfs_cli, "ledger_path", lambda t, f: Path("/nonexistent") / f"{t}-{f}"
|
||||
@@ -1727,7 +1729,7 @@ class TestCmsSummaries:
|
||||
def test_no_llm_builds_no_classifier_and_replays(self, con, monkeypatch):
|
||||
seen = {}
|
||||
self._patch(monkeypatch, seen, counts={})
|
||||
monkeypatch.setattr(pfs_cli, "_classifier", lambda: 1 / 0)
|
||||
monkeypatch.setattr(pfs_cli, "_classifier", lambda **kw: 1 / 0)
|
||||
res = runner.invoke(
|
||||
app, ["pfs", "cms-summaries", "--family", "HOME-VISITS", "--no-llm"]
|
||||
)
|
||||
@@ -1738,3 +1740,25 @@ class TestCmsSummaries:
|
||||
def test_unknown_family(self, con):
|
||||
res = runner.invoke(app, ["pfs", "cms-summaries", "--family", "NOPE"])
|
||||
assert res.exit_code != 0 and "unknown curated family" in res.output
|
||||
|
||||
|
||||
class TestClassifierPin:
|
||||
@pytest.mark.parametrize("pin,expect", [(True, "qwen-test"), (False, None)])
|
||||
def test_classifier_pins_only_when_asked(self, monkeypatch, pin, expect):
|
||||
import llm.classify as lc
|
||||
import llm.pool as lp
|
||||
from llm import config as llm_config
|
||||
|
||||
class Cfg:
|
||||
instruct_model = "qwen-test"
|
||||
|
||||
got = {}
|
||||
monkeypatch.setattr(llm_config, "load", lambda: Cfg())
|
||||
monkeypatch.setattr(
|
||||
lp.HostPool, "from_config", classmethod(lambda c, cfg: "POOL")
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
lc, "closed_vocab_classifier", lambda cfg, pool, **kw: got.update(kw) or "C"
|
||||
)
|
||||
assert pfs_cli._classifier(pin=pin) == "C"
|
||||
assert got == {"model": expect}
|
||||
|
||||
@@ -129,3 +129,30 @@ class TestDefaultPost:
|
||||
assert url == "http://h/api/chat"
|
||||
assert kwargs["json"]["model"] == "qwen2.5:14b"
|
||||
resp.raise_for_status.assert_called_once()
|
||||
|
||||
|
||||
class TestPinnedModel:
|
||||
class _BigPool(_Pool):
|
||||
def vram(self, host):
|
||||
return 24.0
|
||||
|
||||
class _BigCfg(_Cfg):
|
||||
instruct_model_large = "qwen2.5:32b"
|
||||
|
||||
def _run(self, model):
|
||||
calls = []
|
||||
pool = self._BigPool()
|
||||
classify = closed_vocab_classifier(
|
||||
self._BigCfg(),
|
||||
pool,
|
||||
post=lambda url, json: calls.append(json) or {"message": {"content": "a"}},
|
||||
model=model,
|
||||
)
|
||||
classify("x", ["a"])
|
||||
return calls[0]["model"], pool.checked
|
||||
|
||||
def test_pin_wins_on_a_large_vram_host(self):
|
||||
assert self._run("qwen2.5:14b") == ("qwen2.5:14b", ["qwen2.5:14b"])
|
||||
|
||||
def test_default_still_upgrades_on_a_large_host(self):
|
||||
assert self._run(None)[0] == "qwen2.5:32b"
|
||||
|
||||
@@ -13,5 +13,9 @@
|
||||
"PETM225D:1684": "Response: Per the PE Summary of Recommendations provided by the RUC, CPT codes 99341, 99342, 99344, and 99347 would typically have procedures performed on the same date of service, which would already include some of the same supply items. For these CPT codes, the RUC stated that they had removed the PE inputs for supplies that would be duplicative with the procedure on the same day, such as gloves, alcohol wipes, a booklet, and a tongue depressor. Although the RUC did remove the duplicative supplies for CPT code 99347 from the direct PE inputs they recommended, we found that the RUC had not removed all of these duplicative supplies from CPT codes 99341, 99342, and 99344. Therefore, we proposed to remove these duplicative supplies from the direct PE inputs for CPT codes 99341, 99342, and 99344. We continue to believe these supplies are duplicative with a same-day procedure, and are, therefore, finalizing the direct PE inputs for CPT codes 99341, 99342, 99344, and 99347 as proposed.",
|
||||
"PETM225D:1685": "After consideration of the public comments, we are finalizing the work RVU values for the Home or Residence Services code family as proposed. We are also finalizing the direct PE inputs for these codes as proposed.",
|
||||
"54GTKR5G:2241": "Comment: Commenters disagreed with the RUC-recommended work values for these services, which we had accepted. The commenters disagreed with the RUC-recommended work RVUs and believed the services were undervalued. The commenters also believed that the home visit work RVUs should remain “relatively” the same with respect to office visit codes as they did prior to the five-year review and requested that CMS reject the RUC recommended work RVUs and follow their survey values. Based on these comments, we referred these codes to the multi-specialty validation panel for review.",
|
||||
"54GTKR5G:2242": "Response: As a result of the statistical analysis of the 2007 multi-specialty validation panel ratings, we have assigned 2.63 work RVUs to CPT code 99326; 3.46 work RVUs to CPT code 99327; 4.09 work RVUs to CPT code 99328; 1.07 work RVUs to CPT code 99334; 1.72 work RVUs to CPT code 99335; 2.46 work RVUs to CPT code 99336; 3.58 work RVUs to CPT code 99337; 2.53 work RVUs to CPT code 99343; 3.38 work RVUs to CPT code 99344; 4.09 work RVUs to CPT code 99345; 1.00 work RVUs to CPT code 99347; 1.56 work RVUs to CPT code 99348; 2.33 work RVUs to CPT code 99349; and 3.28 work RVUs to CPT code 99350."
|
||||
"54GTKR5G:2242": "Response: As a result of the statistical analysis of the 2007 multi-specialty validation panel ratings, we have assigned 2.63 work RVUs to CPT code 99326; 3.46 work RVUs to CPT code 99327; 4.09 work RVUs to CPT code 99328; 1.07 work RVUs to CPT code 99334; 1.72 work RVUs to CPT code 99335; 2.46 work RVUs to CPT code 99336; 3.58 work RVUs to CPT code 99337; 2.53 work RVUs to CPT code 99343; 3.38 work RVUs to CPT code 99344; 4.09 work RVUs to CPT code 99345; 1.00 work RVUs to CPT code 99347; 1.56 work RVUs to CPT code 99348; 2.33 work RVUs to CPT code 99349; and 3.28 work RVUs to CPT code 99350.",
|
||||
"XU44ZSI9:759": "Response: The statute defines an originating site facility as a physician's or practitioner's office, hospital, critical access hospital, rural health clinic, or FQHC. Additionally, the statute only permits telehealth services to be furnished at an originating site located in a rural health professional shortage area as defined in section 332(a)(1)(A) of the Public Health Service Act or within a county that is not included in a metropolitan statistical area. We do not have the legislative authority (except for SNFs as indicated previously) to expand the definition of an originating site facility or to allow telehealth services to be furnished in a hospital regardless of geographic location.",
|
||||
"YYAWUFQX:1736": "Response: It is unfortunate that these services were not included in the recent 5-Year Review and that the specialty did not propose them for review. We believe that it would be inappropriate to apply increases to these codes without a multi-specialty review of the work involved in these services. However, we would be willing to consider any RUC recommendations that might be forthcoming for revised work RVUs for the home visit and domiciliary care codes. Such a RUC review could be completed at the same time that the RUC is reviewing the nursing facility E/M services previously discussed in this section. As we indicated for the nursing facility E/M codes in the prior response, we would consider forthcoming RUC recommendations for the home care and domiciliary care E/M codes as part of the third 5-Year Review because of the similarity to the other E/M services considered in this review.",
|
||||
"DE2VH9PD:1347": "Response: Other than the scope of service element for EHR and other electronic technology, we do not believe additional changes to the scope of service elements for CCM are warranted at this time. We are requiring certified EHR technology for certain foundational or “core” elements, including structured recording of medications and medication allergies. As finalized in the scope of service in the CY 2014 PFS final rule with comment period we are also requiring medication reconciliation with review of adherence and potential interactions, and oversight of patient self-management of medications. We believe it would be overly burdensome, especially given the broad eligible beneficiary population and final RVU inputs, to include more specific requirements related to medication management, especially when greater specificity is likely not necessary to ensure adequate care. The CCM services are by definition non-face-to-face services; therefore we are not including a requirement for home or domiciliary visits or community based care (although there is a requirement related to coordinating home and community based care). Practitioners who engage in remote monitoring of patient physiological data of eligible beneficiaries may count the time they spend reviewing the reported data towards the monthly minimum time for billing the CCM code, but cannot include the entire time the beneficiary spends under monitoring or wearing a monitoring device. If we believe changes to the scope of service elements are warranted in the future, we will propose them through notice and comment rulemaking taking the comments we received to date into consideration.",
|
||||
"JCWARTJD:1214": "Comment: Some commenters requested that CMS broaden MOD1 and MOD2 eligibility across several settings and code sets. Commenters stated that the beneficiaries most in need of longitudinal care are also in settings such as nursing facilities, Rural Health Clinics (RHCs), Federally Qualified Health Centers (FQHCs), and Critical Access Hospitals (CAHs). Others asked for the use of MOD1 and MOD2 in conjunction with codes beyond E/M codes, such as collaborative care management services, the shared medical appointment codes proposed earlier in this section, and medical nutrition therapy."
|
||||
}
|
||||
@@ -34,12 +34,19 @@ _RAW = json.loads(
|
||||
# Live Federal Register paragraph text, keyed by paragraph id per rule item.
|
||||
CY2023 = {int(k.split(":")[1]): v for k, v in _RAW.items() if k.startswith("PETM")}
|
||||
CY2008 = {int(k.split(":")[1]): v for k, v in _RAW.items() if k.startswith("54GT")}
|
||||
TEXT = {**CY2023, **CY2008}
|
||||
# R44/R45 live paragraphs of other rules (XU44ZSI9 CY2006, YYAWUFQX CY2007,
|
||||
# DE2VH9PD CY2015, JCWARTJD CY2027)
|
||||
OTHER = {
|
||||
int(k.split(":")[1]): v
|
||||
for k, v in _RAW.items()
|
||||
if not k.startswith(("PETM", "54GT"))
|
||||
}
|
||||
TEXT = {**CY2023, **CY2008, **OTHER}
|
||||
|
||||
FAM = SimpleNamespace(
|
||||
key="HOME-VISITS",
|
||||
codes=("99341", "99342", "99350", "99326"),
|
||||
synonyms=("home or residence services",),
|
||||
pair_phrases=("home or residence services",),
|
||||
)
|
||||
|
||||
|
||||
@@ -58,6 +65,11 @@ def test_quantifier(p, q):
|
||||
("Comment: All of the commenters agreed.", "all"),
|
||||
("Comment: Most commenters agreed.", "majority"),
|
||||
("Comment: Many commenters agreed.", "many"),
|
||||
("Comment: Many of the commenters agreed.", "many"),
|
||||
# R44: a quantifier must modify "commenters"
|
||||
("Comment: We received many comments and several documents.", "unspecified"),
|
||||
("Comment: Some commenters asked for several settings.", "some"),
|
||||
("Comment: A few of the commenters agreed.", "few"),
|
||||
("Comment: Numerous commenters agreed.", "many"),
|
||||
("Comment: Several commenters agreed.", "several"),
|
||||
("Comment: Some commenters agreed.", "some"),
|
||||
@@ -72,6 +84,18 @@ def test_quantifier_words(text, q):
|
||||
assert quantifier_of(text) == q
|
||||
|
||||
|
||||
def test_cy2027_1214_some_commenters_not_several_settings():
|
||||
# live CY2027 text: "Some commenters ... across several settings"
|
||||
assert quantifier_of(TEXT[1214]) == "some"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("p", [759, 1736, 1347])
|
||||
def test_response_action_plain_refusals_in_live_text(p):
|
||||
# R45: live responses that plainly decline (no authority / inappropriate /
|
||||
# not warranted); every other unclear response stays unclear
|
||||
assert response_action_of(TEXT[p]) == "not_finalized"
|
||||
|
||||
|
||||
def test_a_few_is_not_one():
|
||||
assert quantifier_of("A few commenters said") == "few"
|
||||
|
||||
@@ -140,6 +164,7 @@ def test_fr_pair_spans_by_code_and_phrase():
|
||||
assert sp.comment_text == TEXT[1681] and sp.response_text == TEXT[1682]
|
||||
both = fr_pair_spans(s, ("99341",), ("Home or Residence Services",))
|
||||
assert [x.comment_p_id for x in both] == [1674, 1679, 1681, 1683]
|
||||
assert fr_pair_spans(s, ("99341",), ()) == by_code # no phrases: code only
|
||||
phrase_only = [x for x in both if x.comment_p_id == 1679][0]
|
||||
assert phrase_only.codes == ()
|
||||
assert fr_pair_spans(s, (), ()) == []
|
||||
|
||||
@@ -172,3 +172,25 @@ _OK = "cite: {item_key: K, p_id: 1}"
|
||||
def test_malformed_entries_named(tmp_path, body, needle):
|
||||
with pytest.raises(ValueError, match=needle):
|
||||
load_curated(_write(tmp_path, body))
|
||||
|
||||
|
||||
def test_pair_phrases_absent_present_and_normalised(tmp_path):
|
||||
absent = load_curated(_write(tmp_path, "F:\n name: F\n"))["F"]
|
||||
assert absent.pair_phrases == ()
|
||||
p = _write(tmp_path, "F:\n name: F\n pair_phrases: [' Home Visit ', '']\n")
|
||||
assert load_curated(p)["F"].pair_phrases == ("home visit",)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", ["home visit", "[1, 2]", "{a: b}"])
|
||||
def test_pair_phrases_wrong_type_rejected(tmp_path, value):
|
||||
p = _write(tmp_path, f"F:\n name: F\n pair_phrases: {value}\n")
|
||||
with pytest.raises(ValueError, match="F: pair_phrases must be a list of strings"):
|
||||
load_curated(p)
|
||||
|
||||
|
||||
def test_home_visits_pair_phrases_are_visit_naming():
|
||||
fam = load_curated()["HOME-VISITS"]
|
||||
assert (
|
||||
"home visits" not in fam.pair_phrases and "domiciliary" not in fam.pair_phrases
|
||||
)
|
||||
assert "house call" in fam.pair_phrases
|
||||
|
||||
Reference in New Issue
Block a user