Skip to content

feat: tag topics and lessons to CCSS focus standards; load grades 7-8 - #40

Merged
jcasimir merged 3 commits into
mainfrom
feat/focus-standard-tagging
Sep 13, 2026
Merged

feat: tag topics and lessons to CCSS focus standards; load grades 7-8#40
jcasimir merged 3 commits into
mainfrom
feat/focus-standard-tagging

Conversation

@jcasimir

Copy link
Copy Markdown
Member

What

This is prerequisite one of Unit 10 in the Interstandard standards-translator plan (CommonMath's lessons need CCSS tags before they can be retargeted to state codes). It closes the "Standards parsing (quick win)" todo in plans/todos.md.

  • Engageny::FocusStandardTagger (lib/engageny/focus_standard_tagger.rb) parses the ny-list-focusstandards markup out of a Topic's overview_html — EngageNY lists Focus Standards once per topic overview, not per lesson, using the same Aspose list-style class convention as ny-h1 headings (see Engageny::Importer#extract_topic_title). Codes are normalized to the dotted form standards.code uses (an embedded cluster letter like the A in 5.NBT.A.1 is stripped, since our imported Standard rows never carry one — confirmed against the existing grade 4-6 data). It creates polymorphic StandardTagging rows on the Topic and, with the same set of standards, on every Lesson beneath it (union of the topic's tags). It's idempotent: existing taggings are left alone.
  • Codes that don't resolve to a Standard row (grade 7-8 codes that weren't imported yet, or bare cluster references like 5.NBT.A that were never imported at all) are reported, not silently dropped.
  • lib/tasks/standards.rake adds standards:tag_focus, which runs the tagger over every Topic with overview HTML and prints topic/lesson tagging counts plus an unresolved-code frequency report (also written to tmp/standards_tag_focus_unresolved.txt).
  • scripts/fetch_ccss_standards.rb now pulls CCSS grades 4-8 (was 4-6) from the same SirFizX/standards-data source. Regenerated data/ccss-math-grades-4-8.json (180 standards, up from 110) and pointed ccss:import at it. This is what makes grade 7-8 focus-standard codes resolve once topics for those grades are imported.
  • Enabled rails/test_unit/railtie (it was commented out) and added test/test_helper.rb — the repo had no test infrastructure at all despite bin/rails test being documented in CLAUDE.md. Pinned .ruby-version via a mise.toml.

Where the focus-standard markup actually lives

The real EngageNY HTML (data/engageny/grade-*-html/) is gitignored and not present in this checkout — it only exists in the production database and possibly a local dev checkout. So I could not run the tagger against real data or confirm the exact DOM shape (e.g. whether ny-list-focusstandards decorates <p> tags per line, as ny-h1 does for headings, or real <ul>/<li> markup) beyond what lib/engageny/*.rb implies. I built the tagger and its tests (test/lib/engageny/focus_standard_tagger_test.rb, test/tasks/standards_tag_focus_test.rb) against hand-made fixtures under test/fixtures/files/ that mirror the class-on-paragraph convention documented in the importer, and used a CSS-class selector (.ny-list-focusstandards) rather than a specific tag so it matches regardless of which element carries the class.

Before this ships to lessons that actually have this markup, run bin/rails standards:tag_focus against a copy of the production data and check the printed counts and unresolved list — if the real markup differs from what I assumed (e.g. codes formatted differently, or not text-only), the extraction regex or CSS selector may need a quick follow-up adjustment. I'd treat that as a fast, low-risk fix rather than a blocker on merging this scaffolding.

How to run

bin/rails standards:tag_focus

Grades 7-8 standards import (needed before those topics' codes resolve):

bin/rails ccss:import

Post-Deploy Monitoring & Validation

  • Run bin/rails standards:tag_focus after deploy and check the printed counts (topics tagged, lessons tagged) and the unresolved-code report.
  • No schema change — standard_taggings and standards already existed and are polymorphic/ready for this.

Test plan

  • bin/rails test (new tests only — 10 runs, 41 assertions, 0 failures)
  • bin/rubocop on changed files — no offenses
  • bundle exec brakeman -q — no warnings (repo's bin/brakeman --ensure-latest fails on version drift unrelated to this change, per known repo issue)
  • Run standards:tag_focus against real production data once available and confirm the markup assumptions above

🤖 Generated with Claude Code

https://claude.ai/code/session_011EqZeVdG5q6KDS1Q8sbcxu

jcasimir and others added 3 commits September 13, 2026 15:27
The repo had no test infrastructure at all: rails/test_unit/railtie
was commented out and test/test_helper.rb didn't exist, even though
CLAUDE.md documents `bin/rails test` as the dev workflow. Enable the
railtie, add the standard test_helper, and pin the .ruby-version via
mise.toml so `mise use ruby@3.4.4` works out of the box.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011EqZeVdG5q6KDS1Q8sbcxu
Extend fetch_ccss_standards.rb to pull grades 4-8 (was 4-6) from the
same SirFizX/standards-data source, regenerate the committed JSON as
data/ccss-math-grades-4-8.json (180 standards total, up from 110), and
point ccss:import at the new file. This unblocks focus-standard
tagging for grade 7-8 lesson HTML, whose CCSS codes previously had no
matching Standard row.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011EqZeVdG5q6KDS1Q8sbcxu
Add Engageny::FocusStandardTagger, which parses the ny-list-focusstandards
markup EngageNY topic overviews carry (the same Aspose list-style class
convention as ny-h1 headings, per Engageny::Importer) into CCSS codes,
normalizes them to the dotted form standards.code uses (stripping any
embedded cluster letter — our imported Standard rows never carry one),
and creates polymorphic StandardTagging rows.

Focus Standards are listed once per Topic overview in the source
curriculum, not per Lesson, so the Topic is the taggable and every
Lesson beneath it inherits the union of its Topic's standards.
Tagging is idempotent (existing rows are never recreated), and codes
with no matching Standard row (grade 7-8 codes not yet imported,
cluster-only references like 5.NBT.A) are reported rather than
dropped.

Add standards:tag_focus, a rake task that runs the tagger over every
Topic with overview HTML and prints topic/lesson tagging counts plus
an unresolved-code frequency report (also written to
tmp/standards_tag_focus_unresolved.txt).

The real EngageNY topic-overview HTML lives only in the production
database (data/engageny/grade-*-html/ is gitignored and empty in this
checkout), so tests build fixtures under test/fixtures/files/ that
mirror the ny-list-focusstandards markup as described in the importer.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011EqZeVdG5q6KDS1Q8sbcxu
@jcasimir
jcasimir force-pushed the feat/focus-standard-tagging branch from 7a8b3c5 to eac57ab Compare September 13, 2026 21:27
@jcasimir
jcasimir merged commit 16496ff into main Sep 13, 2026
3 checks passed
@jcasimir
jcasimir deleted the feat/focus-standard-tagging branch September 13, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant