From acaba43db8bef2bca4b33995ce067c3ad2a4fd72 Mon Sep 17 00:00:00 2001 From: kert Date: Fri, 13 Nov 2026 04:05:51 -0500 Subject: [PATCH] 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) --- src/pfs/dossier.py | 22 +++++++++++++++------- tests/pfs/test_dossier.py | 17 +++++++++++++---- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/pfs/dossier.py b/src/pfs/dossier.py index 7ea3938..3c91c82 100644 --- a/src/pfs/dossier.py +++ b/src/pfs/dossier.py @@ -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)}." ) diff --git a/tests/pfs/test_dossier.py b/tests/pfs/test_dossier.py index afe6b6e..85c9b79 100644 --- a/tests/pfs/test_dossier.py +++ b/tests/pfs/test_dossier.py @@ -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." )