Skip to content

Commit

Permalink
with node16 and run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dczulada committed Oct 1, 2024
1 parent 882ba88 commit 6fec277
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 81 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ on: [pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm run check
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm run check
19 changes: 9 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ on: [push]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 5
env:
REPO: https://github.com/projecttacoma/fqm-execution-service
REMOTE_EXCLUDES_URL: https://raw.githubusercontent.com/projecttacoma/fqm-execution-service/master/.github/gitleaks.toml
GITLEAKS_VERSION: v4.3.0
steps:
- name: Execute Gitleaks
run: |
#wget ${REMOTE_EXCLUDES_URL} -O gitleaks.toml
curl -H 'Authorization: token ${{ secrets.ACCESS_TOKEN_GITLEAKS }}' ${REMOTE_EXCLUDES_URL} -o gitleaks.toml
wget https://github.com/zricethezav/gitleaks/releases/download/${GITLEAKS_VERSION}/gitleaks-linux-amd64 -O gitleaks
chmod +x gitleaks
echo ${GITHUB_SHA}
echo "gitleaks --repo=${REPO} -v --pretty --redact --commit=${GITHUB_SHA} --config=gitleaks.toml"
./gitleaks --repo=${REPO} -v --pretty --redact --commit=${GITHUB_SHA} --config=gitleaks.toml --access-token=${{ secrets.ACCESS_TOKEN_GITLEAKS }}
- name: Execute Gitleaks
run: |
#wget ${REMOTE_EXCLUDES_URL} -O gitleaks.toml
curl -H 'Authorization: token ${{ secrets.ACCESS_TOKEN_GITLEAKS }}' ${REMOTE_EXCLUDES_URL} -o gitleaks.toml
wget https://github.com/zricethezav/gitleaks/releases/download/${GITLEAKS_VERSION}/gitleaks-linux-amd64 -O gitleaks
chmod +x gitleaks
echo ${GITHUB_SHA}
echo "gitleaks --repo=${REPO} -v --pretty --redact --commit=${GITHUB_SHA} --config=gitleaks.toml"
./gitleaks --repo=${REPO} -v --pretty --redact --commit=${GITHUB_SHA} --config=gitleaks.toml --access-token=${{ secrets.ACCESS_TOKEN_GITLEAKS }}
112 changes: 56 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,103 +8,103 @@ Web service wrapper for [fqm-execution](https://github.com/projecttacoma/fqm-exe
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /calculate` | [RequestBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L5) | [ExecutionResult\[\]](https://github.com/projecttacoma/fqm-execution/blob/794b86ca80c3e0e9dd970c1e049724bf7c67e353/src/types/Calculator.ts#L54) |
| `POST /calculateRaw` | [RequestBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L5) | [cql.Results](https://github.com/projecttacoma/fqm-execution/blob/master/src/types/CQLTypes.ts#L14) |
| `POST /calculateMeasureReports` | [RequestBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L5) | [fhir4.MeasureReport\[\]](https://www.hl7.org/fhir/measurereport.html) |
| `POST /Measure/$care-gaps` | [RequestBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L5) | [fhir4.Bundle](https://www.hl7.org/fhir/bundle.html) |
| `POST /Measure/$data-requirements` | [DataRequirementsBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L13) | [fhir4.Library](https://www.hl7.org/fhir/library.html) |
| `POST /calculateMeasureReports` | [RequestBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L5) | [fhir4.MeasureReport\[\]](https://www.hl7.org/fhir/measurereport.html) |
| `POST /Measure/$care-gaps` | [RequestBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L5) | [fhir4.Bundle](https://www.hl7.org/fhir/bundle.html) |
| `POST /Measure/$data-requirements` | [DataRequirementsBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L13) | [fhir4.Library](https://www.hl7.org/fhir/library.html) |

<!-- Note: linked line numbers may be inaccurate as code is updated -->

### Request Inputs

The input to each of the endpoints listed above is expected to be a JSON object, which conforms to the type format specified in [RequestBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L5), or in [DataRequirementsBody](https://github.com/projecttacoma/fqm-execution-service/blob/master/src/types/server-types.ts#L13). This object contains 3 properties:

- `measure`: a FHIR `Bundle` resource containing the `Measure` object, `Library` objects for every CQL/ELM library used in the measure,
as well as `ValueSet` objects with code expansions included.
- `measure`: a FHIR `Bundle` resource containing the `Measure` object, `Library` objects for every CQL/ELM library used in the measure,
as well as `ValueSet` objects with code expansions included.

- NOTE: `ValueSet` objects are not needed for `/Measure/$data-requirements`.
- NOTE: `ValueSet` objects are not needed for `/Measure/$data-requirements`.

- `patients`: an array of FHIR `Bundle` resources, each of which contains the `Patient` object and any required clinical resources (`Condition`, `Medication`, etc.)
for measure calculation. This must be an array, even if only one patient is provided.
- `patients`: an array of FHIR `Bundle` resources, each of which contains the `Patient` object and any required clinical resources (`Condition`, `Medication`, etc.)
for measure calculation. This must be an array, even if only one patient is provided.

- NOTE: `/Measure/$care-gaps` only accepts 1 patient in this array currently.
- NOTE: `/Measure/$data-requirements` does not accept `Patient` resources.
- NOTE: `/Measure/$care-gaps` only accepts 1 patient in this array currently.
- NOTE: `/Measure/$data-requirements` does not accept `Patient` resources.

- `options`: an optional object containing Calculation Options, each of which is listed below, with its default.
- `options`: an optional object containing Calculation Options, each of which is listed below, with its default.

- NOTE: `/Measure/$data-requirements` does not accept an `options` resource.
- NOTE: `/Measure/$data-requirements` does not accept an `options` resource.

#### Calculation Options

The options that we support for calculation are as follows:
| option | type | optional? | description |
| :--------------------- | :-----: | :-------: | :-------------------------------------------------------------------------- |
| includeClauseResults | boolean | yes | Option to include clause results. Defaults to false. |
| includePrettyResults | boolean | yes | Option to include pretty results on statement results. Defaults to false. |
| includeHighlighting | boolean | yes | Include highlighting in MeasureReport narrative. Defaults to false. |
| measurementPeriodStart | string | yes | Start of measurement period. Defaults to the period provided in the `Measure` resource|
| measurementPeriodEnd | string | yes | End of measurement period. Defaults to the period provided in the `Measure` resource |
| calculateSDEs | boolean | yes | Include Supplemental Data Elementss in calculation. Defaults to false. |
| calculateHTML | boolean | yes | Include HTML structure for highlighting. Defaults to false. |
| reportType | string | yes | Type of MeasureReport to generate: "summary" or "individual". Defaults to "individual".|
| option | type | optional? | description |
| :--------------------- | :-----: | :-------: | :-------------------------------------------------------------------------- |
| includeClauseResults | boolean | yes | Option to include clause results. Defaults to false. |
| includePrettyResults | boolean | yes | Option to include pretty results on statement results. Defaults to false. |
| includeHighlighting | boolean | yes | Include highlighting in MeasureReport narrative. Defaults to false. |
| measurementPeriodStart | string | yes | Start of measurement period. Defaults to the period provided in the `Measure` resource|
| measurementPeriodEnd | string | yes | End of measurement period. Defaults to the period provided in the `Measure` resource |
| calculateSDEs | boolean | yes | Include Supplemental Data Elementss in calculation. Defaults to false. |
| calculateHTML | boolean | yes | Include HTML structure for highlighting. Defaults to false. |
| reportType | string | yes | Type of MeasureReport to generate: "summary" or "individual". Defaults to "individual".|

These types will be passed through to the calculation service, and will be used in the execution of the measure.

### Request Outputs

Each request output has a different output format, based on the data being conveyed:

- `/calculate`: an array of `ExecutionResult` objects. Each `ExecutionResult` object contains:
- `/calculate`: an array of `ExecutionResult` objects. Each `ExecutionResult` object contains:

- `patient`: the ID of the patient this object is associated with
- `patient`: the ID of the patient this object is associated with

- `detailedResults`, a map of `group`s to an object which contains population-, statement-, and clause-level results for that group, as well as the html
- `detailedResults`, a map of `group`s to an object which contains population-, statement-, and clause-level results for that group, as well as the html

for that group (if requested by the provided options)
for that group (if requested by the provided options)

- `evaluatedResource`: an array of the FHIR resources used in the calculation of the measure for this patient
- `evaluatedResource`: an array of the FHIR resources used in the calculation of the measure for this patient

- `supplementalData`: if requested by the provided options, an array containing the raw and HTML structure results for each
supplemental data element in the measure, calculated for the specified patient
- `supplementalData`: if requested by the provided options, an array containing the raw and HTML structure results for each
supplemental data element in the measure, calculated for the specified patient

- `/calculateRaw`: a `cql.Result` object, which contains:
- `/calculateRaw`: a `cql.Result` object, which contains:

- `patientResults`: A map of patient IDs to Statement-level results for that patient
- `patientResults`: A map of patient IDs to Statement-level results for that patient

- A Statement-level result describes the results of one CQL Statement for this patient, including the name, the Library and ID of the Statement,
the relevance of a given Statement to a patient population, and the actual result from the patient. See below for an example:
- A Statement-level result describes the results of one CQL Statement for this patient, including the name, the Library and ID of the Statement,
the relevance of a given Statement to a patient population, and the actual result from the patient. See below for an example:

```json
{
"libraryName": "EXM130",
"statementName": "Denominator",
"localId": "37",
"final": "TRUE",
"relevance": "TRUE",
"raw": true,
"pretty": "true"
}
```
```json
{
"libraryName": "EXM130",
"statementName": "Denominator",
"localId": "37",
"final": "TRUE",
"relevance": "TRUE",
"raw": true,
"pretty": "true"
}
```

- For more information on Clinical Quality Language (CQL) and Expression Logical Model (ELM) formats, see [the CQL specification](https://cql.hl7.org/)
- For more information on Clinical Quality Language (CQL) and Expression Logical Model (ELM) formats, see [the CQL specification](https://cql.hl7.org/)

- `localIdPatientResultsMap`: A map of patient IDs to the raw results from every clause in every `Library` in the `Measure` resource.
- `localIdPatientResultsMap`: A map of patient IDs to the raw results from every clause in every `Library` in the `Measure` resource.

- `patientEvaluatedRecords`: A map of patient IDs to the evaluated records for that patient
- `patientEvaluatedRecords`: A map of patient IDs to the evaluated records for that patient

- `/Measure/$care-gaps`: a FHIR `Bundle` resource, which contains:
- `/Measure/$care-gaps`: a FHIR `Bundle` resource, which contains:

- a `Composition` resource containing the actual Gaps in Care report
- a `Composition` resource containing the actual Gaps in Care report

- a `MeasureReport` resource containing the individual measure results for the patient passed in
- a `MeasureReport` resource containing the individual measure results for the patient passed in

- a set of `DetectedIssue` resources, one for each gap in the measure. Each `DetectedIssue` resource represents a particular gap in care,
and will contain one or more `GuidanceResponse` resources detailing the data that could close that gap.
- a set of `DetectedIssue` resources, one for each gap in the measure. Each `DetectedIssue` resource represents a particular gap in care,
and will contain one or more `GuidanceResponse` resources detailing the data that could close that gap.

- See [this fqm-execution wiki page](https://github.com/projecttacoma/fqm-execution/wiki/Gaps-In-Care) for more detail on the gaps-in-care
methodology, and how to interpret this output.
- See [this fqm-execution wiki page](https://github.com/projecttacoma/fqm-execution/wiki/Gaps-In-Care) for more detail on the gaps-in-care
methodology, and how to interpret this output.

- `/Measure/$data-requirements`: a FHIR module-definition `Library` resource, which contains:
- a `dataRequirement` array, with resources for each `datatype`/`valueSet` combination required.
- `/Measure/$data-requirements`: a FHIR module-definition `Library` resource, which contains:
- a `dataRequirement` array, with resources for each `datatype`/`valueSet` combination required.

### Calculator Architecture

Expand Down
6 changes: 5 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ app.post('/calculate', async (req, res) => {
patients,
options || {} // options are optional, so this defaults to an empty Object
);
return res.json({ results: calculateResult.results, groupClauseCoverageDetails: calculateResult.groupClauseCoverageDetails, withErrors: calculateResult.withErrors });
return res.json({
results: calculateResult.results,
groupClauseCoverageDetails: calculateResult.groupClauseCoverageDetails,
withErrors: calculateResult.withErrors
});
} catch (error) {
logger.log({
level: 'error',
Expand Down
9 changes: 5 additions & 4 deletions test/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ const mockDataRequirementsResult: { results: fhir4.Library; debugOutput?: Calcul
};

const DataRequirementsSpy = jest.spyOn(Calculator, 'calculateDataRequirements');
when(DataRequirementsSpy)
.calledWith(mockMeasureBundle)
.mockReturnValue(Promise.resolve(mockDataRequirementsResult));
when(DataRequirementsSpy).calledWith(mockMeasureBundle).mockReturnValue(Promise.resolve(mockDataRequirementsResult));

test('data requirements calculate', async () => {
const response = await request(app)
Expand Down Expand Up @@ -102,7 +100,10 @@ test('measure reports calculate', async () => {
expect(response.body.results).toEqual(mockMeasureReportResult.results);
});

const mockResult: { results: CalculatorTypes.ExecutionResult<PopulationGroupResult>[]; debugOutput?: CalculatorTypes.DebugOutput } = {
const mockResult: {
results: CalculatorTypes.ExecutionResult<PopulationGroupResult>[];
debugOutput?: CalculatorTypes.DebugOutput;
} = {
results: [
{
patientId: ''
Expand Down

0 comments on commit 6fec277

Please sign in to comment.