Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order population expressions for HTML output #260

Merged
merged 6 commits into from
Jul 12, 2023
Merged

Conversation

elsaperelli
Copy link
Contributor

Summary

This is similar to Lauren's PR here where we sorted the statements into population statements, non-functions, and then function statements; however, now we also order the population statements in the following order:

  1. initial-population
  2. denominator
  3. denominator-exclusion
  4. denominator-exception
  5. numerator
  6. numerator-exclusion
  7. measure-population
  8. measure-population-exclusion
  9. measure-observation (alphabetically sorted if multiple)

...and then non-functions and function statements.

New behavior

Population expression statements are now sorted in the above order. This order is based on the following "egg":
image

Code changes

  • HTMLBuilder.ts - I just added the sorting logic for the population expressions directly to the sortStatements function. Rather than using the populationSet, we now use populationIdentifiers because it includes the code (which is always the same) and the criteria expression (which can be different) for each population. That way we can sort statements because on what code their statement name links to.
  • HTMLBuilder.test.ts - two new unit tests for sortStatements()- one for a proportion boolean measure (checks ordering of ipp, denom, numer) and one for a cv boolean measure (checks for ordering of ipp, measure population, measure population exclusion, measure observation function).

Testing guidance

  • npm run check
  • I tested this in two ways:
  1. I just ran calculation on as many measure bundles as I could find with the --debug flag and inspected the html output in the debug/html directory.
  2. If you want to test certain cases, you can write your own CQL, bundle it with Matt's ecqm-bundler, and then run calculation on that to ensure the ordering is correct.

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
86.01% (+0.06% 🔼)
2312/2688
🟡 Branches
73.02% (+0.05% 🔼)
2130/2917
🟢 Functions
89.12% (+0.02% 🔼)
426/478
🟢 Lines
86.35% (+0.07% 🔼)
2233/2586

Test suite run success

433 tests passing in 31 suites.

Report generated by 🧪jest coverage report action from 1a5c44d

Copy link
Contributor

@lmd59 lmd59 left a comment

Choose a reason for hiding this comment

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

Still doing testing, but something in my environment got a bit wonky, so leaving these code comments while I figure that one out!

README.md Show resolved Hide resolved
src/calculation/HTMLBuilder.ts Outdated Show resolved Hide resolved
src/calculation/HTMLBuilder.ts Outdated Show resolved Hide resolved
src/calculation/HTMLBuilder.ts Outdated Show resolved Hide resolved
src/calculation/HTMLBuilder.ts Outdated Show resolved Hide resolved
@elsaperelli elsaperelli requested a review from lmd59 July 11, 2023 18:09
@mgramigna mgramigna merged commit a369d3a into master Jul 12, 2023
5 checks passed
@mgramigna mgramigna deleted the sort-populations branch July 12, 2023 13:56
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.

3 participants