Skip to content

Commit

Permalink
Merge branch 'main' into nickclyde/fhir-server-config
Browse files Browse the repository at this point in the history
  • Loading branch information
nickclyde committed Jan 10, 2025
2 parents 902fdca + f87166b commit c64b003
Show file tree
Hide file tree
Showing 29 changed files with 721 additions and 912 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ecs_terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ on:
merge_group:
types:
- checks_requested
push:
branches:
- main
workflow_dispatch:
inputs:
workspace:
description: "The workspace to terraform against"
description: "Choose terraform workspace for deployment"
required: true
type: string
default: "dev"
type: choice
options:
- dev
- demo
default: dev

concurrency:
group: ${{ github.event.inputs.workspace }}-terraform
Expand All @@ -25,7 +25,7 @@ permissions:
contents: read

env:
workspace: dev
workspace: ${{ github.event.inputs.workspace }}

jobs:
terraform:
Expand Down
25 changes: 20 additions & 5 deletions .github/workflows/terraform_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ name: Ad-hoc Terraform Plan
run-name: Terraform plan ${{ inputs.workspace }} by @${{ github.actor }}

on:
pull_request:
branches:
- shanice/deploy_demo_ecs
merge_group:
types:
- checks_requested
workflow_dispatch:
inputs:
workspace:
description: "The workspace to terraform against"
description: "Choose terraform workspace for deployment"
required: true
type: string
default: "dev"
type: choice
options:
- dev
- demo
default: dev

concurrency:
group: ${{ github.event.inputs.workspace }}-terraform
Expand All @@ -19,7 +28,7 @@ permissions:
contents: read

env:
workspace: dev
workspace: ${{ github.event.inputs.workspace }}

jobs:
terraform:
Expand Down Expand Up @@ -49,7 +58,6 @@ jobs:

- name: Terraform
env:
# ACTION: ${{ env.terraform_action }}
BUCKET: ${{ secrets.TFSTATE_BUCKET }}
DYNAMODB_TABLE: ${{ secrets.TFSTATE_DYNAMODB_TABLE }}
REGION: ${{ vars.region }}
Expand All @@ -60,6 +68,7 @@ jobs:
TLS_KEY: ${{ secrets.TLS_KEY}}
shell: bash
run: |
echo "Deploying to ${{ github.event.inputs.workspace }}..."
rm -rf .terraform .terraform.lock.hcl
terraform init \
-var-file="$WORKSPACE.tfvars" \
Expand All @@ -68,6 +77,12 @@ jobs:
-backend-config "region=$REGION" \
|| (echo "terraform init failed, exiting..." && exit 1)
terraform workspace select "$WORKSPACE"
terraform apply -auto-approve -target=aws_acm_certificate.cloudflare_cert \
-var-file="$WORKSPACE.tfvars" \
-var "umls_api_key=${UMLS_API_KEY}" \
-var "ersd_api_key=${ERSD_API_KEY}" \
-var "qc_tls_key=${TLS_KEY}" \
-var "qc_tls_cert=${TLS_CERT}"
terraform plan \
-var-file="$WORKSPACE.tfvars" \
-var "umls_api_key=${UMLS_API_KEY}" \
Expand Down
6 changes: 3 additions & 3 deletions query-connector/e2e/alternate_queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.describe("alternate queries with the Query Connector", () => {
test("query using form-fillable demo patient by phone number", async ({
page,
}) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Try it out" }).click();
await page.getByRole("button", { name: "Fill fields" }).click();

// Delete Last name and MRN to force phone number as one of the 3 fields
Expand Down Expand Up @@ -50,7 +50,7 @@ test.describe("alternate queries with the Query Connector", () => {

// test("social determinants query with generalized function", async ({
test("cancer query with generalized function", async ({ page }) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Try it out" }).click();
await page.getByRole("button", { name: "Fill fields" }).click();
// Select FHIR server from drop down
await page.getByRole("button", { name: "Advanced" }).click();
Expand All @@ -77,7 +77,7 @@ test.describe("alternate queries with the Query Connector", () => {
test("form-fillable STI query using generalized function", async ({
page,
}) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Try it out" }).click();
await page.getByRole("button", { name: "Fill fields" }).click();
// Select FHIR server from drop down
await page.getByRole("button", { name: "Advanced" }).click();
Expand Down
2 changes: 1 addition & 1 deletion query-connector/e2e/customize_query.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test.describe("querying with the Query Connector", () => {
// Start every test by navigating to the customize query workflow
test.beforeEach(async ({ page }) => {
await page.goto(TEST_URL);
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Try it out" }).click();

// Check that the info alert is visible and contains the correct text
const alert = page.locator(".custom-alert");
Expand Down
4 changes: 1 addition & 3 deletions query-connector/e2e/load.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ test("landing page loads", async ({ page }) => {

// Check that interactable elements are present (header and Get Started)
await expect(page.getByRole("link", { name: metadata.title })).toBeVisible();
await expect(
page.getByRole("button", { name: "Go to the demo" }),
).toBeVisible();
await expect(page.getByRole("button", { name: "Try it out" })).toBeVisible();
});
4 changes: 2 additions & 2 deletions query-connector/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test.describe("querying with the Query Connector", () => {
});

test("unsuccessful user query: no patients", async ({ page }) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Try it out" }).click();
await page.getByRole("button", { name: "Fill fields" }).click();
await page.getByLabel("First name").fill("Shouldnt");
await page.getByLabel("Last name").fill("Findanyone");
Expand All @@ -41,7 +41,7 @@ test.describe("querying with the Query Connector", () => {
});

test("successful demo user query", async ({ page }) => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByRole("button", { name: "Try it out" }).click();

// Check that the info alert is visible and contains the correct text
const alert = page.locator(".custom-alert");
Expand Down
10 changes: 7 additions & 3 deletions query-connector/src/app/backend/query-building.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"use server";

import { getDbClient } from "./dbClient";
import { NestedQuery, QueryDetailsResult } from "../queryBuilding/utils";
import {
NestedQuery,
QueryDetailsResult,
QueryUpdateResult,
} from "../queryBuilding/utils";
import { DibbsValueSet } from "../constants";
import { DEFAULT_TIME_WINDOW } from "../utils";
import { randomUUID } from "crypto";
Expand Down Expand Up @@ -56,7 +60,7 @@ export async function saveCustomQuery(
query_data = EXCLUDED.query_data,
author = EXCLUDED.author,
date_last_modified = EXCLUDED.date_last_modified
RETURNING id, query_name;
RETURNING id, query_name, CASE WHEN xmax = 0 THEN 'INSERT' ELSE 'UPDATE' END AS operation;
`;
const { queryDataInsert, conditionInsert } =
formatQueryDataForDatabase(queryInput);
Expand All @@ -76,7 +80,7 @@ export async function saveCustomQuery(
];
const result = await dbClient.query(queryString, dataToWrite);
if (result.rows.length > 0) {
return result.rows as unknown as QueryDetailsResult[];
return result.rows as QueryUpdateResult[];
}
console.error("Query save failed:", dataToWrite);
return [];
Expand Down
23 changes: 11 additions & 12 deletions query-connector/src/app/database-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
CustomUserQuery,
} from "./query-building";
import {
CategoryToConditionToNameMap,
ConditionIdToNameMap,
CategoryToConditionArrayMap,
ConditionsMap,
} from "./queryBuilding/utils";
import {
CategoryStruct,
Expand Down Expand Up @@ -489,25 +489,24 @@ export async function getConditionsData() {
const rows = result.rows;

// 1. Grouped by category with id:name pairs
const categoryToConditionArrayMap: CategoryToConditionToNameMap = rows.reduce(
(acc, row) => {
const categoryToConditionNameArrayMap: CategoryToConditionArrayMap =
rows.reduce((acc, row) => {
const { category, id, name } = row;
if (!acc[category]) {
acc[category] = [];
}
acc[category].push({ [id]: name });
acc[category].push({ id: id, name: name });
return acc;
},
{} as CategoryToConditionToNameMap,
);
}, {} as CategoryToConditionArrayMap);

// 2. ID-Name mapping
const conditionIdToNameMap: ConditionIdToNameMap = rows.reduce((acc, row) => {
acc[row.id] = row.name;
const conditionIdToNameMap: ConditionsMap = rows.reduce((acc, row) => {
acc[row.id] = { name: row.name, category: row.category };
return acc;
}, {} as ConditionIdToNameMap);
}, {} as ConditionsMap);

return {
categoryToConditionArrayMap,
categoryToConditionNameArrayMap,
conditionIdToNameMap,
} as const;
}
Expand Down
16 changes: 8 additions & 8 deletions query-connector/src/app/page.module.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.pageSubtitle {
margin: 2rem 0 0.5rem 0;
margin: 2rem 0 0.5rem 0;
}

.pageSubtitle:last-of-type{
margin-top: 1.5rem;
.pageSubtitle:last-of-type {
margin-top: 1.5rem;
}

.pageContent {
font-weight: 300;
margin-top: 0;
font-size:1rem;
margin-bottom: 0.5rem
}
font-weight: 300;
margin-top: 0;
font-size: 1rem;
margin-bottom: 1rem;
}
27 changes: 9 additions & 18 deletions query-connector/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ export default function LandingPage() {
network of healthcare providers through your existing data use
agreements, giving you access to more complete and timely data
</h2>

<Button
className="next-button margin-bottom-2"
type="button"
id="next-button"
onClick={() => handleGoToDemo()}
>
Try it out
</Button>
</div>
<Image
alt="Graphic illustrating what TEFCA is"
Expand Down Expand Up @@ -81,24 +90,6 @@ export default function LandingPage() {
</ProcessListItem>
</ProcessList>
</div>
<div className="blue-background-container">
<div className="flex-justify-center flex-column">
<div className="text-holder">
<h2 className="font-sans-xs text-light margin-top-0">
Check out the Query Connector demo to try out features using
sample data.
</h2>
<Button
className="next-button"
type="button"
id="next-button"
onClick={() => handleGoToDemo()}
>
Go to the demo
</Button>
</div>
</div>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type DrawerProps = {
onSave: () => void;
onClose: () => void;
onSearch?: () => void;
hasChanges: boolean;
};

/**
Expand Down
Loading

0 comments on commit c64b003

Please sign in to comment.