fix(pfs): CMS summary lines drop an empty quantifier clause and say "CMS's response is unclassified" when the action is undetermined (coordinator wording for lex)

This commit is contained in:
kert
2026-11-13 04:05:51 -05:00
parent 055166fee9
commit acaba43db8
2 changed files with 28 additions and 11 deletions

View File

@@ -491,14 +491,12 @@ _QUANTIFIER = {
"few": "a few commenters",
"one": "one commenter",
"all": "all commenters",
"unspecified": "no quantifier",
}
_ACTION_PHRASE = {
"finalize_as_proposed": "finalized as proposed",
"finalize_modified": "finalized with changes",
"not_finalized": "not finalized",
"acknowledged": "acknowledged the comments",
"unclear": "not determinable from its wording",
}
_STANCE_PHRASE = {
"support": "support",
@@ -551,12 +549,22 @@ def cms_summary_text(
"""CMS's own summary of the comments, in CMS's words (R94): the first
sentence of the Comment paragraph, CMS's quantifier and the response
action read by rule; the model's stance reading only as "model reading,
unreviewed"."""
unreviewed". A summary with no quantifier has no quantifier clause, and a
response whose action its wording does not settle reads "unclassified"."""
said = (
""
if quantifier in ("", "unspecified")
else f" CMS's quantifier: {_QUANTIFIER.get(quantifier, quantifier)}."
)
response = (
"CMS's response is unclassified."
if action in ("", "unclear")
else f"CMS's response: {_ACTION_PHRASE.get(action, action)}."
)
return (
f'In the CY{year} {kind} rule, CMS summarized: "{quote}" CMS\'s quantifier: '
f"{_QUANTIFIER.get(quantifier, quantifier)}. CMS's response: "
f"{_ACTION_PHRASE.get(action, action)}. Stance of CMS's summary (model "
f"reading, unreviewed): {_STANCE_PHRASE.get(stance, stance)}."
f'In the CY{year} {kind} rule, CMS summarized: "{quote}"{said} {response} '
f"Stance of CMS's summary (model reading, unreviewed): "
f"{_STANCE_PHRASE.get(stance, stance)}."
)

View File

@@ -108,11 +108,20 @@ def test_cms_summary_template():
"CMS's response: acknowledged the comments. Stance of CMS's summary "
"(model reading, unreviewed): support."
)
assert "no quantifier" in cms_summary_text(
"x", 2005, "final", "unspecified", "unclear", "mixed"
# no quantifier: the clause is left out; an undetermined action reads
# "unclassified" (coordinator wording, lex page)
assert cms_summary_text("x", 2005, "final", "unspecified", "unclear", "mixed") == (
'In the CY2005 final rule, CMS summarized: "x" CMS\'s response is '
"unclassified. Stance of CMS's summary (model reading, unreviewed): mixed."
)
assert "not determinable from its wording" in cms_summary_text(
"x", 2005, "final", "one", "unclear", "unclear"
assert cms_summary_text("x", 2005, "final", "one", "unclear", "unclear") == (
'In the CY2005 final rule, CMS summarized: "x" CMS\'s quantifier: one '
"commenter. CMS's response is unclassified. Stance of CMS's summary "
"(model reading, unreviewed): unclear."
)
assert cms_summary_text("x", 2005, "final", "", "not_finalized", "oppose") == (
'In the CY2005 final rule, CMS summarized: "x" CMS\'s response: not '
"finalized. Stance of CMS's summary (model reading, unreviewed): oppose."
)