Closed sarahmcdougall closed 11 months ago
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 86.33% (-0.25% 🔻) |
2362/2736 |
🟡 | Branches | 73.64% (-0.19% 🔻) |
2190/2974 |
🟢 | Functions | 88.89% (-0.16% 🔻) |
424/477 |
🟢 | Lines | 86.67% (-0.27% 🔻) |
2282/2633 |
447 tests passing in 31 suites.
Report generated by 🧪jest coverage report action from bead5ad9aa02267d0fceaa6cbaaa5c0bbc276bc4
Summary of changes made in newest commits:
AttributeFilter
, which has alias
as a required field. I did notice a few filters during testing that do not have alias
populated but it seems that this is the case when the type is ‘unknown’ and ‘withError’ is populated.parseSources
was updated to consolidate the logic between sources and relationships since we are essentially treating them the same. The function now parses sources and relationships in the same loop.parseElementType
.Changes to the output:
We no longer receive the “Procedure.period” error (or similar errors depending on the measure under test). This is due to the additional query alias handling that was added to GapsReportBuilder. The correct filter does not get added to the data requirements because we never actually parse the relationship
during the query filter parsing. Is this still in scope of this task? It looks like the relationships do get parsed in RetrievesFinder
but the suchThat
expressions do not get parsed in the query parser. I believe that significant re-working of the parseQueryInfo
function will be required to dig down into the relationship clauses.
Summary
For measures authored using QI-Core, the
sources
array is unpopulated due to unhandled scenarios related to parsing query sources. UpdatesparseSources
to drill into expressions on a given query that are not immediate retrieves.New behavior
The
sources
arrays on the query info should now be populated appropriately. The approach to source parsing is as follows:resultTypeSpecifier
. For the QI-Core-authored measures, thesource
is of the following format (for an example of an Encounter datatype and “Union” type):Since there is no
datatype
on the expression, the “elementType” is parsed to retrieve the associated datatype.A potential side effect of the current query filter parsing implementation is that incorrect attribute paths are assigned to resource types during data requirements calculation. Note that this issue is not directly addressed in this pull request, as there are other issues involved, such as the “query stacking” approach that is implemented and how it handles the “Union” type that is seen in the ELM of QI-Core measures.
More information about the ELM structure is available at https://cql.hl7.org/04-logicalspecification.html.
Code changes
QueryFilterParser
parseSources
function to now extract sources from theresultTypeSpecifier
if present (in the case that the type is not a Retrieve)parseElementType
to parse theelementType
on the expression (this is an alternative to parsing thedatatype
) ELMTypesresultTypeSpecifier
as an option field on an ELM expressionTesting guidance
It is important to test against both QI-Core and non-QI-Core measures. Some potential steps that can be taken for testing:
npm run test
,npm run test:integration
, etc. to ensure that no side effects were introduced. Pay specific attention to the query filter parsing unit testsdebug
option enabled.debug/gaps.json
, pay specific attention to thequeryInfo
output on the retrieves. Previously thesources
array would be empty for some of the QI-Core measures (CMS161 is an example). Check that this is no longer the case, and that thesources
array is appropriately populated by looking back at the ELM output for the measure being tested.gaps.json
output has not changed for non-QI-Core measures, except in the case that therelationships
array sources are not encompassed in the sources. The data requirements output is not expected to change. This can be done by generating the output on this branch and on the main branch, and using the ‘Select for Compare’ feature in VSCode.Open questions to check for when testing
relationships
expressions alongside the source expressions? According to the logical specification, the relationship clauses “allow related sources to restrict the elements included from another source in a query scope…The elements of the related source are not included in the query scope.”resultTypeSpecifier
? The cql-execution library contains types forTypeSpecifier
s, but little (if any) handling is done in fqm-execution for parsing theTypeSpecifier
s.However, the original query info does not contain the Procedure and instead contains an Encounter:
When we set
queryInfo.sources = innerQueryInfo.sources
, we lose this Procedure source.