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

Adding Step Counter to new workflow #20

Merged
merged 55 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9114b5b
begin step indicator implementation
fzhao99 Sep 18, 2024
ab98d0e
new files
fzhao99 Sep 18, 2024
4f1c193
Merge branch 'main' into bob/2559-step-counter-implementation
fzhao99 Oct 8, 2024
143155c
import
fzhao99 Oct 8, 2024
461b58c
Merge branch 'main' into bob/2559-step-counter-implementation
fzhao99 Oct 15, 2024
7e78382
Merge branch 'main' into bob/2559-step-counter-implementation
robertandremitchell Oct 15, 2024
1129f75
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 15, 2024
b40304c
changing order of steps, beginning to refactor each component to seam…
robertandremitchell Oct 15, 2024
df3951f
Adding doc block
robertandremitchell Oct 15, 2024
5099318
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 15, 2024
15d4cfa
adding back buttons for ease of debugging
robertandremitchell Oct 16, 2024
df7dd60
Merge branch 'bob/2559-step-counter-implementation' of https://github…
robertandremitchell Oct 16, 2024
a0bdb43
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 16, 2024
40c5b3f
switching to hyper unlucky as default fill, re-commenting out buttons…
robertandremitchell Oct 16, 2024
85ce291
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 16, 2024
640fc35
redirect query
fzhao99 Oct 16, 2024
a8aff18
new files
fzhao99 Oct 16, 2024
981dc15
aligning demo query change with button click
robertandremitchell Oct 16, 2024
953208f
refactor
robertandremitchell Oct 16, 2024
80b95c7
Try to fix
robertandremitchell Oct 16, 2024
1ebd0d9
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 16, 2024
d911d19
change some copy
fzhao99 Oct 16, 2024
e2380e8
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 16, 2024
2dac064
Merge branch 'main' into bob/2663-customize-query-alignment
fzhao99 Oct 16, 2024
2732c44
Merge branch 'main' into bob/2559-step-counter-implementation
robertandremitchell Oct 16, 2024
4e69625
pull out copy
fzhao99 Oct 16, 2024
120dd10
Merge branch 'bob/2663-customize-query-alignment' of https://github.c…
fzhao99 Oct 16, 2024
d03b4f4
woops
fzhao99 Oct 16, 2024
2062b57
Merge branch 'main' into bob/2663-customize-query-alignment
fzhao99 Oct 16, 2024
4fe391b
change the link
fzhao99 Oct 16, 2024
f71b418
fixing pages
robertandremitchell Oct 16, 2024
1f5c1ec
Merge branch 'bob/2663-customize-query-alignment' into bob/2559-step-…
robertandremitchell Oct 16, 2024
0210908
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 16, 2024
3d15069
undoing changes
robertandremitchell Oct 16, 2024
cf7f962
Merge branch 'bob/2559-step-counter-implementation' of https://github…
robertandremitchell Oct 16, 2024
ffc0498
adding step commentary
robertandremitchell Oct 16, 2024
4defd0b
undoing local
robertandremitchell Oct 16, 2024
002e666
updating imports
robertandremitchell Oct 16, 2024
ce458d0
Merge branch 'main' into bob/2663-customize-query-alignment
fzhao99 Oct 17, 2024
34ba53c
Merge branch 'bob/2663-customize-query-alignment' into bob/2559-step-…
robertandremitchell Oct 17, 2024
22f1e93
fixing padding, adding default select query
robertandremitchell Oct 17, 2024
018e481
lint
robertandremitchell Oct 17, 2024
9307ee5
fixing lint placement
robertandremitchell Oct 17, 2024
187edcc
removing lint rule to address in future ticket
robertandremitchell Oct 17, 2024
5ed84b7
moving step headers to step indicator
robertandremitchell Oct 17, 2024
87bb3fa
standardizing return label
robertandremitchell Oct 17, 2024
bab3b9b
Update query-connector/src/styles/custom-styles.scss
robertandremitchell Oct 17, 2024
7dfe6f8
Update query-connector/src/styles/custom-styles.scss
robertandremitchell Oct 17, 2024
e7cedad
Merge branch 'main' of https:/CDCgov/dibbs-query-connecto…
m-goggins Oct 17, 2024
4a1828d
merge conflicts
fzhao99 Oct 18, 2024
1b5b255
make mapped object type more specific
fzhao99 Oct 18, 2024
4853d9e
Merge branch 'bob/2559-step-counter-implementation' of https://github…
fzhao99 Oct 18, 2024
95d8be5
specify
fzhao99 Oct 18, 2024
bffa6fe
add a dropdown selection step
fzhao99 Oct 18, 2024
bb8c631
Merge branch 'main' into bob/2559-step-counter-implementation
fzhao99 Oct 18, 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
1 change: 0 additions & 1 deletion query-connector/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"publicOnly": true
}
]
// "@typescript-eslint/no-explicit-any": "error"
robertandremitchell marked this conversation as resolved.
Show resolved Hide resolved
},
"overrides": [
{
Expand Down
9 changes: 5 additions & 4 deletions query-connector/e2e/alternate_queries.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { TEST_URL } from "../playwright-setup";
import { STEP_TWO_PAGE_TITLE } from "@/app/query/components/patientSearchResults/PatientSearchResultsTable";
import { STEP_THREE_PAGE_TITLE } from "@/app/query/components/selectQuery/SelectSavedQuery";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";

import { TEST_PATIENT, TEST_PATIENT_NAME } from "./constants";

test.describe("alternate queries with the Query Connector", () => {
Expand All @@ -24,12 +24,13 @@ test.describe("alternate queries with the Query Connector", () => {
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
await expect(
page.getByRole("heading", { name: STEP_TWO_PAGE_TITLE }),
page.getByRole("heading", { name: PAGE_TITLES["patient-results"] }),
).toBeVisible();
await page.getByRole("link", { name: "Select patient" }).click();
await expect(
page.getByRole("heading", { name: STEP_THREE_PAGE_TITLE }),
page.getByRole("heading", { name: PAGE_TITLES["select-query"] }),
).toBeVisible();
await page.getByTestId("Select").selectOption("chlamydia");
await page.getByRole("button", { name: "Submit" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

Expand Down
6 changes: 3 additions & 3 deletions query-connector/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { test, expect } from "@playwright/test";
import { TEST_URL } from "../playwright-setup";
import { STEP_ONE_PAGE_TITLE } from "@/app/query/components/searchForm/SearchForm";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";
import {
CONTACT_US_DISCLAIMER_EMAIL,
CONTACT_US_DISCLAIMER_TEXT,
Expand Down Expand Up @@ -44,7 +44,7 @@ test.describe("querying with the Query Connector", () => {
"This site is for demo purposes only. Please do not enter PII on this website.",
);
await expect(
page.getByRole("heading", { name: STEP_ONE_PAGE_TITLE, exact: true }),
page.getByRole("heading", { name: PAGE_TITLES["search"], exact: true }),
).toBeVisible();

await page.getByRole("button", { name: "Fill fields" }).click();
Expand Down Expand Up @@ -115,7 +115,7 @@ test.describe("querying with the Query Connector", () => {
// Now let's use the return to search to go back to a blank form
await page.getByRole("button", { name: "New patient search" }).click();
await expect(
page.getByRole("heading", { name: STEP_ONE_PAGE_TITLE, exact: true }),
page.getByRole("heading", { name: PAGE_TITLES["search"], exact: true }),
).toBeVisible();
});
});
4 changes: 2 additions & 2 deletions query-connector/src/app/query/components/CustomizeQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Accordion from "../designSystem/Accordion";
import CustomizeQueryNav from "./customizeQuery/CustomizeQueryNav";
import { mapValueSetItemsToValueSetTypes } from "./customizeQuery/customizeQueryUtils";
import Backlink from "./backLink/Backlink";
import { RETURN_LABEL } from "../stepIndicator/StepIndicator";

interface CustomizeQueryProps {
useCaseQueryResponse: UseCaseQueryResponse;
Expand Down Expand Up @@ -159,7 +160,7 @@ const CustomizeQuery: React.FC<CustomizeQueryProps> = ({
return (
<div>
<div className="padding-top-3">
<Backlink onClick={goBack} label="Return to Select query" />
<Backlink onClick={goBack} label={RETURN_LABEL["results"]} />
</div>
<LoadingView loading={!useCaseQueryResponse} />
<h1 className="font-sans-2xl text-bold margin-top-205">
Expand Down Expand Up @@ -218,7 +219,6 @@ const CustomizeQuery: React.FC<CustomizeQueryProps> = ({
};

export default CustomizeQuery;

export const QUERY_CUSTOMIZATION_CONFIRMATION_HEADER =
"Query Customization Successful!";
export const QUERY_CUSTOMIZATION_CONFIRMATION_BODY =
Expand Down
31 changes: 31 additions & 0 deletions query-connector/src/app/query/components/DisclaimerAlerts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Alert } from "@trussworks/react-uswds";
import { ReactNode } from "react";

const PII_DISCLAIMER_BANNER = (
<Alert type="info" headingLevel="h4" slim className="custom-alert">
This site is for demo purposes only. Please do not enter PII on this
website.
</Alert>
);
const CONTACT_US_BANNER = (
<Alert type="info" headingLevel="h4" slim className="custom-alert">
Interested in learning more about using the TEFCA Query Connector for your
jurisdiction? Send us an email at{" "}
<a
href="mailto:[email protected]"
style={{
color: "inherit",
fontWeight: "bold",
textDecoration: "underline",
}}
>
[email protected]
</a>
</Alert>
);

export const alertBannerMap: { [mode: string]: ReactNode } = {
search: PII_DISCLAIMER_BANNER,
customize_query: PII_DISCLAIMER_BANNER,
results: CONTACT_US_BANNER,
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Mode } from "@/app/constants";
import Backlink from "./backLink/Backlink";
import PatientSearchResultsTable from "./patientSearchResults/PatientSearchResultsTable";
import NoPatientsFound from "./patientSearchResults/NoPatientsFound";
import { RETURN_LABEL } from "@/app/query/stepIndicator/StepIndicator";

/**
* The props for the PatientSearchResults component.
Expand Down Expand Up @@ -57,7 +58,7 @@ const PatientSearchResults: React.FC<PatientSearchResultsProps> = ({
)}
{patients.length > 0 && (
<>
<Backlink onClick={goBack} label={RETURN_TO_STEP_ONE_LABEL} />
<Backlink onClick={goBack} label={RETURN_LABEL["patient-results"]} />

<PatientSearchResultsTable
patients={patients}
Expand All @@ -70,4 +71,3 @@ const PatientSearchResults: React.FC<PatientSearchResultsProps> = ({
};

export default PatientSearchResults;
export const RETURN_TO_STEP_ONE_LABEL = "Return to Enter patient info";
11 changes: 6 additions & 5 deletions query-connector/src/app/query/components/ResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import MedicationRequestTable from "./resultsView/tableComponents/MedicationRequ
import ObservationTable from "./resultsView/tableComponents/ObservationTable";
import Backlink from "./backLink/Backlink";
import { USE_CASES, demoQueryValToLabelMap } from "@/app/constants";
import {
PAGE_TITLES,
RETURN_LABEL,
} from "@/app/query/stepIndicator/StepIndicator";

type ResultsViewProps = {
useCaseQueryResponse: UseCaseQueryResponse;
Expand Down Expand Up @@ -61,10 +65,7 @@ const ResultsView: React.FC<ResultsViewProps> = ({
<>
<div className="results-banner">
<div className={`${styles.resultsBannerContent}`}>
<Backlink
onClick={() => goBack()}
label={"Return to query selection"}
/>
<Backlink onClick={() => goBack()} label={RETURN_LABEL["results"]} />
<button
className="usa-button usa-button--outline margin-left-auto"
onClick={() => goToBeginning()}
Expand All @@ -75,7 +76,7 @@ const ResultsView: React.FC<ResultsViewProps> = ({
</div>
<div className="margin-bottom-3">
<h2 className="margin-0" id="ecr-summary">
Patient Record
{PAGE_TITLES["results"]}
</h2>
<h3>
Query:{" "}
Expand Down
1 change: 0 additions & 1 deletion query-connector/src/app/query/components/SelectQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,3 @@ const SelectQuery: React.FC<SelectQueryProps> = ({
};

export default SelectQuery;
export const RETURN_TO_STEP_ONE_LABEL = "Return to Select patient";
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
formatMRN,
formatName,
} from "@/app/format-service";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";

type PatientSeacrchResultsTableProps = {
patients: Patient[];
Expand All @@ -28,7 +29,7 @@ const PatientSearchResultsTable: React.FC<PatientSeacrchResultsTableProps> = ({
return (
<>
<h1 className="font-sans-2xl text-bold margin-top-205">
{STEP_TWO_PAGE_TITLE}
{PAGE_TITLES["patient-results"]}
</h1>
<p className="font-sans-lg text-light">
The following records match your search. Select a patient to continue.
Expand Down Expand Up @@ -74,4 +75,3 @@ const PatientSearchResultsTable: React.FC<PatientSeacrchResultsTableProps> = ({
};

export default PatientSearchResultsTable;
export const STEP_TWO_PAGE_TITLE = "Step 2: Select a patient";
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
demoData,
stateOptions,
Mode,
} from "../../../constants";
import { UseCaseQueryResponse, UseCaseQuery } from "../../../query-service";
import { fhirServers } from "../../../fhir-servers";
} from "@/app/constants";
import { UseCaseQueryResponse, UseCaseQuery } from "@/app/query-service";
import { fhirServers } from "@/app/fhir-servers";
import styles from "./searchForm.module.css";

import { FormatPhoneAsDigits } from "@/app/format-service";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";

interface SearchFormProps {
useCase: USE_CASES;
Expand Down Expand Up @@ -55,7 +55,6 @@ const SearchForm: React.FC<SearchFormProps> = ({
//Set the patient options based on the demoOption
const [firstName, setFirstName] = useState<string>("");
const [lastName, setLastName] = useState<string>("");

const [phone, setPhone] = useState<string>("");
const [dob, setDOB] = useState<string>("");
const [mrn, setMRN] = useState<string>("");
Expand All @@ -74,7 +73,6 @@ const SearchForm: React.FC<SearchFormProps> = ({
setMRN(data.MRN);
setPhone(data.Phone);
setFhirServer(data.FhirServer as FHIR_SERVERS);
setUseCase(data.UseCase as USE_CASES);
setAutofilled(highlightAutofilled);
}
},
Expand All @@ -83,8 +81,8 @@ const SearchForm: React.FC<SearchFormProps> = ({

async function HandleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
if (!useCase || !fhirServer) {
console.error("Use case and FHIR server are required.");
if (!fhirServer) {
console.error("FHIR server is required.");
return;
}
setLoading(true);
Expand Down Expand Up @@ -112,7 +110,7 @@ const SearchForm: React.FC<SearchFormProps> = ({
<>
<form className="content-container-smaller-width" onSubmit={HandleSubmit}>
<h1 className="font-sans-2xl text-bold margin-bottom-105">
{STEP_ONE_PAGE_TITLE}
{PAGE_TITLES["search"]}
</h1>
<h2 className="font-sans-lg text-normal margin-top-0 margin-bottom-105">
Enter patient information below to search for a patient. We will query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { Select, Button } from "@trussworks/react-uswds";
import Backlink from "../backLink/Backlink";
import styles from "./selectQuery.module.css";
import { useState } from "react";
import {
PAGE_TITLES,
RETURN_LABEL,
} from "@/app/query/stepIndicator/StepIndicator";

type SelectSavedQueryProps = {
selectedQuery: string;
Expand Down Expand Up @@ -51,9 +55,9 @@ const SelectSavedQuery: React.FC<SelectSavedQueryProps> = ({
return (
<form className="content-container-smaller-width">
{/* Back button */}
<Backlink onClick={goBack} label={"Return to select a patient"} />
<Backlink onClick={goBack} label={RETURN_LABEL["select-query"]} />
<h1 className={`${styles.selectQueryHeaderText}`}>
{STEP_THREE_PAGE_TITLE}
{PAGE_TITLES["select-query"]}
</h1>
<div
className={`font-sans-md text-light ${styles.selectQueryExplanationText}`}
Expand All @@ -74,6 +78,9 @@ const SelectSavedQuery: React.FC<SelectSavedQueryProps> = ({
className={`${styles.queryDropDown}`}
required
>
<option value="" disabled>
Select query
</option>
{demoQueryOptions.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
Expand Down Expand Up @@ -138,4 +145,3 @@ const SelectSavedQuery: React.FC<SelectSavedQueryProps> = ({
};

export default SelectSavedQuery;
export const STEP_THREE_PAGE_TITLE = "Step 3: Select a query";
10 changes: 10 additions & 0 deletions query-connector/src/app/query/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import LoadingView from "./components/LoadingView";
import { ToastContainer } from "react-toastify";

import "react-toastify/dist/ReactToastify.min.css";
import StepIndicator, {
CUSTOMIZE_QUERY_STEPS,
} from "./stepIndicator/StepIndicator";
import SiteAlert from "./designSystem/SiteAlert";
import { Patient } from "fhir/r4";

Expand All @@ -40,7 +43,11 @@ const Query: React.FC = () => {
return (
<>
<SiteAlert page={mode} />
{Object.keys(CUSTOMIZE_QUERY_STEPS).includes(mode) && (
robertandremitchell marked this conversation as resolved.
Show resolved Hide resolved
<StepIndicator headingLevel="h4" curStep={mode} />
)}
<div className="main-container">
{/* Step 1 */}
{mode === "search" && (
<SearchForm
useCase={useCase}
Expand All @@ -53,6 +60,7 @@ const Query: React.FC = () => {
/>
)}

{/* Step 2 */}
{mode === "patient-results" && (
<>
<PatientSearchResults
Expand All @@ -64,6 +72,7 @@ const Query: React.FC = () => {
</>
)}

{/* Step 3 */}
{mode === "select-query" && (
<SelectQuery
goBack={() => setMode("patient-results")}
Expand All @@ -79,6 +88,7 @@ const Query: React.FC = () => {
/>
)}

{/* Step 4 */}
{mode === "results" && (
<>
{resultsQueryResponse && (
Expand Down
Loading