Skip to content

#4291 rules parser updates - #4365

Open
cielbellerose wants to merge 10 commits into
feature/rules-dashboardfrom
#4291-rules-parser-updates
Open

#4291 rules parser updates#4365
cielbellerose wants to merge 10 commits into
feature/rules-dashboardfrom
#4291-rules-parser-updates

Conversation

@cielbellerose

@cielbellerose cielbellerose commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Changes

  • subrules are now caught with format "(a)" and "a)" instead of just "a."

  • combined duplicate logic for FHE/FSAE

  • User input first page -> Removed TOC exclusion, the formatting was just too hard to perfect, and I didn't want the chance of excluding any rules. Users now have the option to specify a first page to skip over the beginning pdf sections

  • Removed automatic header/footer exclusion, the logic was too specific/unreliable and risked removing real rule content

Test Cases

Added parsing test coverage!

  • Excluding page number footer tests ('Page 7 of 143' for FSAE, '7' individual numbers for FHE)
  • normalizeContent???
  • findParentRuleCode testing ('EV.5.2.2' -> 'EV.5.2')
  • handleDuplicateCodes adds suffix correctly
  • extractSubRules for a, b, c rules captured only when on new line
  • FSAE and FHE test coverage with real pdf examples

Screenshots

Screenshot 2026-08-10 at 5 55 30 PM Screenshot 2026-08-10 at 5 55 46 PM Screenshot 2026-08-10 at 5 56 44 PM

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4291

@cielbellerose cielbellerose linked an issue Aug 4, 2026 that may be closed by this pull request
@cielbellerose
cielbellerose changed the base branch from develop to feature/rules-dashboard August 4, 2026 19:37
@cielbellerose cielbellerose self-assigned this Aug 5, 2026
@cielbellerose
cielbellerose marked this pull request as ready for review August 11, 2026 02:08
export const extractSubRules = (ruleCode: string, content: string): ParsedRule[] => {
// "a." and "(a)" styles mark a subrule at a line start or after a colon
// "a)" style marks a subrule if following any whitespace
const letterPattern = /(?:(?<=^|:\s)([a-z])\.|(?<=^|:\s)\(([a-z])\)|(?<=^|\s)([a-z])\))\s+/gm;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three formats aren't treated equally: a) is allowed to start a subrule after any whitespace, anywhere mid-sentence, but (a) is only recognized at line-start or right after ": ". So "then either: a) foo or b) bar" splits correctly, but the equally common "then either (a) foo or (b) bar" does not, because (a) here is preceded by "either ", not ": " or a line start.

Is this how you want it should work?

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.

[RulesDashboard] - Update FHE Parser

2 participants