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

Add golden patient data #4

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
419ef65
Switching fill fields to golden patient
robertandremitchell Oct 8, 2024
6f0e05e
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 9, 2024
d4c1cfa
fixing URLs
robertandremitchell Oct 9, 2024
5fe87e7
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 9, 2024
da42e84
updating e2e
robertandremitchell Oct 9, 2024
b1659b5
trying to fix e2e
robertandremitchell Oct 10, 2024
3ed56dc
uno vez mas
robertandremitchell Oct 10, 2024
96fa090
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 10, 2024
6e0837f
undo
robertandremitchell Oct 10, 2024
55345cc
Merge remote-tracking branch 'refs/remotes/origin/rob/2646-align-pati…
robertandremitchell Oct 10, 2024
dd21f02
fix
robertandremitchell Oct 10, 2024
05284e4
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 10, 2024
cc4ef15
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 11, 2024
b5940ed
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 11, 2024
60b89f3
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 11, 2024
6ac9122
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 11, 2024
56e8eac
turn on video
fzhao99 Oct 11, 2024
69bc743
Merge branch 'main' into bob/debug-e2es
fzhao99 Oct 11, 2024
254feeb
save on fail
fzhao99 Oct 11, 2024
d7be2cd
Merge branch 'bob/debug-e2es' of https://github.com/CDCgov/dibbs-quer…
fzhao99 Oct 11, 2024
bad8efc
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 11, 2024
64340d0
Merge branch 'bob/debug-e2es' of https://github.com/CDCgov/dibbs-quer…
Oct 11, 2024
9a025e2
add to github actions
fzhao99 Oct 11, 2024
18098e2
Merge branch 'bob/debug-e2es' of https://github.com/CDCgov/dibbs-quer…
fzhao99 Oct 11, 2024
5ad0ee8
try adding build path
Oct 11, 2024
83acf53
add env var?
Oct 11, 2024
2b948af
increase timeout
Oct 11, 2024
7bb64f5
Merge branch 'main' into bob/debug-e2es
fzhao99 Oct 11, 2024
fae2a03
add wait for loading indicator
Oct 11, 2024
1604fad
Merge branch 'bob/debug-e2es' of https://github.com/CDCgov/dibbs-quer…
Oct 11, 2024
49e7b1f
removing default server
robertandremitchell Oct 11, 2024
d5f2151
pull playwright url into env var
Oct 11, 2024
954fbef
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 11, 2024
099c743
increase timeout for the loading exits
Oct 11, 2024
a50704b
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 11, 2024
a8908a5
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 11, 2024
b38e81d
add timeout for the successful flow
Oct 11, 2024
5b781df
Merge branch 'rob/2646-align-patient-info-population-between-design-a…
Oct 15, 2024
09a3b23
debug e2es (#6)
fzhao99 Oct 15, 2024
c9a4812
Merge branch 'main' into rob/2646-align-patient-info-population-betwe…
robertandremitchell Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/container-tefca-viewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ jobs:
- name: Playwright Tests
working-directory: ./containers/${{env.CONTAINER}}
run: npx playwright test e2e --reporter=list --config playwright.config.ts
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-results
path: ./containers/${{env.CONTAINER}}/test-results/
14 changes: 9 additions & 5 deletions containers/tefca-viewer/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// @ts-check

import { test, expect } from "@playwright/test";
import { TEST_URL } from "../playwright-setup";

test.describe("querying with the TryTEFCA viewer", () => {
test.beforeEach(async ({ page }) => {
// Start every test on our main landing page
await page.goto("http://localhost:3000/tefca-viewer");
await page.goto(TEST_URL);
});

test("landing page loads", async ({ page }) => {
Expand Down Expand Up @@ -86,6 +87,7 @@ test.describe("querying with the TryTEFCA viewer", () => {
await page.getByLabel("Medical Record Number").fill("18091");
await page.getByLabel("Phone Number").fill("5555555555");
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

// Make sure we have a results page with a single patient
// Non-interactive 'div' elements in the table should be located by text
Expand Down Expand Up @@ -136,15 +138,16 @@ test.describe("querying with the TryTEFCA viewer", () => {

// Among verification, make sure phone number is right
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
await expect(
page.getByRole("heading", { name: "Patient Record" }),
).toBeVisible();
await expect(page.getByText("Patient Name")).toBeVisible();
await expect(page.getByText("Veronica Anne Blackstone")).toBeVisible();
await expect(page.getByText("Hyper A. Unlucky")).toBeVisible();
await expect(page.getByText("Contact")).toBeVisible();
await expect(page.getByText("937-379-3497")).toBeVisible();
await expect(page.getByText("517-425-1398")).toBeVisible();
await expect(page.getByText("Patient Identifiers")).toBeVisible();
await expect(page.getByText("34972316")).toBeVisible();
await expect(page.getByText("8692756")).toBeVisible();
});

test("social determinants query with generalized function", async ({
Expand All @@ -167,8 +170,9 @@ test.describe("querying with the TryTEFCA viewer", () => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByLabel("Query", { exact: true }).selectOption("chlamydia");
await page.getByRole("button", { name: "Fill fields" }).click();
await page.getByLabel("Phone Number").fill("");
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

await expect(
page.getByRole("heading", { name: "Patient Record" }),
).toBeVisible();
Expand Down
3 changes: 2 additions & 1 deletion containers/tefca-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "docker compose -f docker-compose-dev.yaml up -d && next dev",
"dev-win": "start docker compose -f docker-compose-dev.yaml up && next dev",
"dev:db": "docker compose -f docker-compose-dev.yaml up",
"dev:next": "dotenv -e ./tefca.env.local -e ./tefca.env -- next dev",
"dev:next": "dotenv -e ./.env -- next dev",
"setup-local-env": "./setup-env.sh",
"build": "next build && cp -r .next/static .next/standalone/.next && cp -r public .next/standalone/",
"start": "NODE_TLS_REJECT_UNAUTHORIZED=0 node .next/standalone/server.js",
Expand All @@ -17,6 +17,7 @@
"test:unit:watch": "jest --watch",
"test:integration": "jest --testPathPattern=tests/integration",
"test:playwright": "docker compose build --no-cache && docker compose up -d && npx playwright test --reporter=list",
"test:playwright:local": "dotenv -e ./.env -- npx playwright test --ui",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
},
Expand Down
22 changes: 16 additions & 6 deletions containers/tefca-viewer/playwright-setup.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
/**
*
*/

export const TEST_URL =
process.env.TEST_ENV ?? "http://localhost:3000/tefca-viewer";

/**
*
*/
async function globalSetup() {
const url = "http://localhost:3000/tefca-viewer";
const maxRetries = 300; // Maximum number of retries
const delay = 1000; // Delay between retries in milliseconds

for (let attempts = 0; attempts < maxRetries; attempts++) {
try {
const response = await fetch(url); // Fetch the URL
const response = await fetch(TEST_URL); // Fetch the TEST_URL
if (response.status === 200) {
console.log(`Connected to ${url} successfully.`);
console.log(`Connected to ${TEST_URL} successfully.`);
return; // Exit the function if the webpage loads successfully
} else {
console.log(
`Failed to connect to ${url}, status: ${response.status}. Retrying...`,
`Failed to connect to ${TEST_URL}, status: ${response.status}. Retrying...`,
);
// Wait before the next attempt
await new Promise((resolve) => setTimeout(resolve, delay));
}
} catch (error) {
console.log(
`Fetch failed for ${url}: ${(error as Error).message}. Retrying...`,
`Fetch failed for ${TEST_URL}: ${
(error as Error).message
}. Retrying...`,
);
await new Promise((resolve) => setTimeout(resolve, delay));
}
// Wait before the next attempt
await new Promise((resolve) => setTimeout(resolve, delay));
}

throw new Error(`Unable to connect to ${url} after ${maxRetries} attempts.`);
throw new Error(
`Unable to connect to ${TEST_URL} after ${maxRetries} attempts.`,
);
}

export default globalSetup;
1 change: 1 addition & 0 deletions containers/tefca-viewer/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default defineConfig({

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
video: "on-first-retry",
},

/* Configure projects for major browsers */
Expand Down
82 changes: 37 additions & 45 deletions containers/tefca-viewer/src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const FhirServers = [
"HELIOS Meld: eHealthExchange",
"JMC Meld: Direct",
"JMC Meld: eHealthExchange",
"Public HAPI: eHealthExchange",
"Public HAPI: Direct",
"OpenEpic: eHealthExchange",
"CernerHelios: eHealthExchange",
"OPHDST Meld: Direct",
Expand Down Expand Up @@ -90,37 +90,46 @@ export type PatientType =
| "social-determinants"
| "sti-syphilis-positive";

/*
* Common "Hyper Unlucky" patient data used for all non-newborn screening use cases
*/
const hyperUnluckyPatient: DemoDataFields = {
FirstName: "Hyper",
LastName: "Unlucky",
DOB: "1975-12-06",
MRN: "8692756",
Phone: "517-425-1398",
FhirServer: "Public HAPI: Direct",
UseCase: "cancer", // UseCase will be updated per case
};

/*
Demo patient data used to populate the form fields with each value being a type of DemoDataFields
*/
export const demoData: Record<PatientType, DemoDataFields> = {
cancer: {
FirstName: "Lee",
LastName: "Shaw",
DOB: "1975-12-06",
MRN: "8692756",
Phone: "517-425-1398",
FhirServer: "HELIOS Meld: Direct",
UseCase: "cancer",
},
"sti-chlamydia-positive": {
FirstName: "Chlamydia",
LastName: "JMC",
DOB: "2001-05-07",
MRN: "b50z-wayszq-ofib",
Phone: "",
FhirServer: "JMC Meld: Direct",
UseCase: "chlamydia",
},
"sti-gonorrhea-positive": {
FirstName: "GC",
LastName: "JMC",
DOB: "1998-05-31",
MRN: "JMC-1002",
Phone: "",
FhirServer: "JMC Meld: Direct",
UseCase: "gonorrhea",
cancer: { ...hyperUnluckyPatient, UseCase: "cancer" },
"sti-chlamydia-positive": { ...hyperUnluckyPatient, UseCase: "chlamydia" },
"sti-gonorrhea-positive": { ...hyperUnluckyPatient, UseCase: "gonorrhea" },
"social-determinants": {
...hyperUnluckyPatient,
UseCase: "social-determinants",
},
"sti-syphilis-positive": { ...hyperUnluckyPatient, UseCase: "syphilis" },

// Newborn screening data remains unchanged
// We need to figure how to display specific cases for specific referral, fail, pass
// "newborn-screening-technical-fail": {
// ...hyperUnluckyPatient,
// UseCase: "newborn-screening",
// },
// "newborn-screening-referral": {
// ...hyperUnluckyPatient,
// UseCase: "newborn-screening",
// },
// "newborn-screening-pass": {
// ...hyperUnluckyPatient,
// UseCase: "newborn-screening",
// },
"newborn-screening-technical-fail": {
FirstName: "Mango",
LastName: "Smith",
Expand Down Expand Up @@ -148,26 +157,9 @@ export const demoData: Record<PatientType, DemoDataFields> = {
FhirServer: "CernerHelios: eHealthExchange",
UseCase: "newborn-screening",
},
"social-determinants": {
FirstName: "Veronica",
LastName: "Blackstone",
DOB: "1998-06-18",
MRN: "34972316",
Phone: "937-379-3497",
FhirServer: "HELIOS Meld: Direct",
UseCase: "social-determinants",
},
"sti-syphilis-positive": {
FirstName: "Veronica",
LastName: "Blackstone",
DOB: "1998-06-18",
MRN: "34972316",
Phone: "937-379-3497",
FhirServer: "HELIOS Meld: Direct",
UseCase: "syphilis",
},
};

// Define Option type
type Option = {
value: string;
label: string;
Expand Down
11 changes: 7 additions & 4 deletions containers/tefca-viewer/src/app/fhir-servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@ type FHIR_SERVER_CONFIG = {
*/
export const fhirServers: Record<FHIR_SERVERS, FHIR_SERVER_CONFIG> = {
"HELIOS Meld: Direct": {
hostname: "https://gw.interop.community/HeliosConnectathonSa/open/",
hostname: "https://gw.interop.community/HeliosConnectathonSa/open",
init: {} as RequestInit,
},
"HELIOS Meld: eHealthExchange": configureEHX("MeldOpen"),
"JMC Meld: Direct": {
hostname: "https://gw.interop.community/JMCHeliosSTISandbox/open/",
hostname: "https://gw.interop.community/JMCHeliosSTISandbox/open",
init: {} as RequestInit,
},
"JMC Meld: eHealthExchange": configureEHX("JMCHelios"),
"Public HAPI: eHealthExchange": configureEHX("PublicHAPI"),
"Public HAPI: Direct": {
hostname: "https://hapi.fhir.org/baseR4",
init: {} as RequestInit,
},
"OpenEpic: eHealthExchange": configureEHX("OpenEpic"),
"CernerHelios: eHealthExchange": configureEHX("CernerHelios"),
"OPHDST Meld: Direct": {
hostname: "https://gw.interop.community/CDCSepHL7Connectatho/open/",
hostname: "https://gw.interop.community/CDCSepHL7Connectatho/open",
init: {} as RequestInit,
},
};
Expand Down
2 changes: 1 addition & 1 deletion containers/tefca-viewer/src/app/query-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function patientQuery(
queryResponse: QueryResponse,
): Promise<void> {
// Query for patient
let query = "Patient?";
let query = "/Patient?";
if (request.first_name) {
query += `given=${request.first_name}&`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const SearchForm: React.FC<SearchFormProps> = ({
const [firstName, setFirstName] = useState<string>("");
const [lastName, setLastName] = useState<string>("");
const [fhirServer, setFhirServer] = useState<FHIR_SERVERS>();
// "Public HAPI: Direct",
const [phone, setPhone] = useState<string>("");
const [dob, setDOB] = useState<string>("");
const [mrn, setMRN] = useState<string>("");
Expand Down Expand Up @@ -248,6 +249,7 @@ const SearchForm: React.FC<SearchFormProps> = ({
name="fhir_server"
value={fhirServer}
defaultValue={""}
// defaultValue={"Public HAPI: Direct"}
onChange={(event) => {
setFhirServer(event.target.value as FHIR_SERVERS);
}}
Expand Down
Loading