From 5aed2ab3a41d93e89f0da099176151ded9166d06 Mon Sep 17 00:00:00 2001 From: Gordon Farrell <93161643+gordonfarrell@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:00:38 -0700 Subject: [PATCH 1/2] Add emergency contact name to viewer (#3038) * Add emergency contact name to ecr display, update tests * Make sure it doesn't render with no name * Switch if to ternary * switch to helper function for nameformat * reorder some lines --- .../app/services/evaluateFhirDataService.ts | 8 +++++-- .../services/evaluateFhirDataServices.test.ts | 24 ++++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts b/containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts index f50adbea2b..ca60b3d61a 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 569449fbd9..3c9dcb9ac7 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( From 1e129aea298b5d7392be846eb9f9983588e59ed1 Mon Sep 17 00:00:00 2001 From: Josh Nygaard <141273852+JNygaard-Skylight@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:35:35 -0500 Subject: [PATCH 2/2] Code Coverage For ecr-viewer (#3030) * Enable code coverage with Jest * Codecov step for ecr-viewert * Attempting to upload to Codecov * The token is required. * Make codecov verbose * Update codecov comment, flags, and set default for flagged commits * Remove verbose flag, and increase patch target * Clean up comment --- .github/codecov.yml | 75 +++++++++++---------- .github/workflows/container-ecr-viewer.yaml | 10 ++- .gitignore | 3 + containers/ecr-viewer/jest.config.js | 1 + 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/.github/codecov.yml b/.github/codecov.yml index a19a62a034..15b0f9e9eb 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 5361e75a81..fbb2b522b8 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 442e5b2b35..bfd0a19d5e 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 e5b1b5f487..d4c5c27d8d 100644 --- a/containers/ecr-viewer/jest.config.js +++ b/containers/ecr-viewer/jest.config.js @@ -13,6 +13,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