diff --git a/.github/codecov.yml b/.github/codecov.yml index a19a62a03..15b0f9e9e 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -1,44 +1,49 @@ comment: - layout: "diff, flags, files" - behavior: default + layout: "condensed_header, condensed_files, condensed_footer" + hide_project_coverage: true coverage: - range: 80...100 status: project: default: - target: 80% - threshold: 10% + target: auto # auto means better than the last non-failing build patch: default: target: 95% threshold: 10% - flags: - - sdk -flags: - ecr-viewer: - paths: - - "containers/ecr-viewer" - fhir-converter: - paths: - - "containers/fhir-converter" - ingestion: - paths: - - "containers/ingestion" - message-parser: - paths: - - "containers/message-parser" - message-refiner: - paths: - - "containers/message-refiner" - orchestration: - paths: - - "containers/orchestration" - record-linkage: - paths: - - "containers/record-linkage" - trigger-code-reference: - paths: - - "containers/trigger-code-reference" - validation: - paths: - - "containers/validation" +flag_management: + default_rules: + carryforward: true + statuses: + - type: project + target: auto + - patch: 95% + individual_flags: + - name: ecr-viewer + paths: + - "containers/ecr-viewer" + statuses: + - type + - name: fhir-converter + paths: + - "containers/fhir-converter" + - name: ingestion + paths: + - "containers/ingestion" + - name: "message-parser" + paths: + - "containers/message-parser" + - name: "message-refiner" + paths: + - "containers/message-refiner" + - name: "orchestration" + paths: + - "containers/orchestration" + - name: "record-linkage" + paths: + - "containers/record-linkage" + - name: "trigger-code-reference" + paths: + - "containers/trigger-code-reference" + - name: "validation" + paths: + - "containers/validation" diff --git a/.github/workflows/container-ecr-viewer.yaml b/.github/workflows/container-ecr-viewer.yaml index 20671f376..ddd394108 100644 --- a/.github/workflows/container-ecr-viewer.yaml +++ b/.github/workflows/container-ecr-viewer.yaml @@ -45,11 +45,17 @@ jobs: with: node-version: ${{env.NODE_VERSION}} - name: Install dependencies - working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory + working-directory: ./containers/${{env.CONTAINER}} run: npm install - name: Run tests - working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory + working-directory: ./containers/${{env.CONTAINER}} run: npm test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + flags: ${{ env.CONTAINER }} cypress-e2e-tests: if: false runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 442e5b2b3..bfd0a19d5 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,6 @@ tsconfig.tsbuildinfo ## Make local config file /containers/local-config.env + +# Code coverage +**/coverage/ diff --git a/containers/ecr-viewer/jest.config.js b/containers/ecr-viewer/jest.config.js index 384eede97..1af75c2f0 100644 --- a/containers/ecr-viewer/jest.config.js +++ b/containers/ecr-viewer/jest.config.js @@ -14,6 +14,7 @@ const customJestConfig = { "^mssql$": "/src/app/tests/__mocks__/mssql.js", "^tedious$": "/src/app/tests/__mocks__/mssql.js", }, + collectCoverage: true, }; // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async diff --git a/containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts b/containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts index f50adbea2..ca60b3d61 100644 --- a/containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts +++ b/containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts @@ -554,11 +554,15 @@ export const evaluateEmergencyContact = ( .map((contact) => { const relationship = contact.relationship?.[0].coding?.[0]?.display; - const address = formatAddress(contact.address); + const contactName = contact.name ? formatName(contact.name) : ""; + + const address = contact.address ? formatAddress(contact.address) : ""; const phoneNumbers = formatContactPoint(contact.telecom); - return [relationship, address, phoneNumbers].filter(Boolean).join("\n"); + return [relationship, contactName, address, phoneNumbers] + .filter(Boolean) + .join("\n"); }) .join("\n\n"); }; diff --git a/containers/ecr-viewer/src/app/tests/services/evaluateFhirDataServices.test.ts b/containers/ecr-viewer/src/app/tests/services/evaluateFhirDataServices.test.ts index 569449fbd..3c9dcb9ac 100644 --- a/containers/ecr-viewer/src/app/tests/services/evaluateFhirDataServices.test.ts +++ b/containers/ecr-viewer/src/app/tests/services/evaluateFhirDataServices.test.ts @@ -296,6 +296,10 @@ describe("Evaluate Emergency Contact", () => { use: "home", }, ], + name: { + given: ["Anastasia", "Bubbletea"], + family: "Pizza", + }, address: { use: "home", line: ["999 Single Court"], @@ -312,7 +316,7 @@ describe("Evaluate Emergency Contact", () => { mappings, ); expect(actual).toEqual( - `sister\n999 Single Court\nBEVERLY HILLS, CA\n90210, USA\nHome: 615-995-9999`, + `sister\nAnastasia Bubbletea Pizza\n999 Single Court\nBEVERLY HILLS, CA\n90210, USA\nHome: 615-995-9999`, ); }); it("should return multiple emergency contacts", () => { @@ -343,6 +347,10 @@ describe("Evaluate Emergency Contact", () => { use: "home", }, ], + name: { + given: ["Anastasia", "Bubbletea"], + family: "Pizza", + }, address: { use: "home", line: ["999 Single Court"], @@ -363,6 +371,10 @@ describe("Evaluate Emergency Contact", () => { ], }, ], + name: { + given: ["Alberto", "Bonanza", "Bartholomew"], + family: "Eggbert", + }, telecom: [ { system: "phone", @@ -382,7 +394,7 @@ describe("Evaluate Emergency Contact", () => { mappings, ); expect(actual).toEqual( - `sister\n999 Single Court\nBEVERLY HILLS, CA\n90210, USA\nHome: 615-995-9999\n\nbrother\nHome: 615-995-1000\nHome Fax: 615-995-1001`, + `sister\nAnastasia Bubbletea Pizza\n999 Single Court\nBEVERLY HILLS, CA\n90210, USA\nHome: 615-995-9999\n\nbrother\nAlberto Bonanza Bartholomew Eggbert\nHome: 615-995-1000\nHome Fax: 615-995-1001`, ); }); it("should not return empty space when address is not available in", () => { @@ -406,6 +418,10 @@ describe("Evaluate Emergency Contact", () => { ], }, ], + name: { + given: ["Anastasia", "Bubbletea"], + family: "Pizza", + }, telecom: [ { system: "phone", @@ -419,7 +435,9 @@ describe("Evaluate Emergency Contact", () => { BundleWithPatientAndContact, mappings, ); - expect(actual).toEqual(`sister\nHome: 615-995-9999`); + expect(actual).toEqual( + `sister\nAnastasia Bubbletea Pizza\nHome: 615-995-9999`, + ); }); it("should return undefined if a patient has no contact", () => { const actual = evaluateEmergencyContact(