Skip to content

Commit

Permalink
remove data_source from core.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
BobanL committed Jan 16, 2025
1 parent 11c66c0 commit 3dacdb5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 39 deletions.
1 change: 0 additions & 1 deletion containers/ecr-viewer/sql/core.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE ecr_data (
eICR_ID VARCHAR(200) PRIMARY KEY,
set_id VARCHAR(255),
data_source VARCHAR(2), -- S3 or DB
fhir_reference_link VARCHAR(500), -- Link to the ecr fhir bundle
patient_name_first VARCHAR(100),
patient_name_last VARCHAR(100),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,12 @@ export const saveMetadataToPostgres = async (
await database.tx(async (t) => {
// Insert main ECR metadata
const saveToEcrData = new PQ({
text: "INSERT INTO ecr_data (eICR_ID, patient_name_last, patient_name_first, patient_birth_date, data_source, report_date, set_id) VALUES ($1, $2, $3, $4, $5, $6, $7)",
text: "INSERT INTO ecr_data (eICR_ID, patient_name_last, patient_name_first, patient_birth_date, report_date, set_id) VALUES ($1, $2, $3, $4, $5, $6)",
values: [
ecrId,
metadata.last_name,
metadata.first_name,
metadata.birth_date,
"DB",
metadata.report_date,
metadata.eicr_set_id,
],
Expand Down
1 change: 0 additions & 1 deletion containers/ecr-viewer/src/app/api/save-fhir-data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export interface BundleMetadata {
last_name: string;
first_name: string;
birth_date: string;
data_source: string;
eicr_set_id: string | undefined;
rr: RR[] | undefined;
report_date: string;
Expand Down
2 changes: 0 additions & 2 deletions containers/ecr-viewer/src/app/services/listEcrDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { DateRangePeriod } from "@/app/view-data/utils/date-utils";

export interface CoreMetadataModel {
eicr_id: string;
data_source: "DB" | "S3";
data_link: string;
patient_name_first: string;
patient_name_last: string;
Expand All @@ -18,7 +17,6 @@ export interface CoreMetadataModel {

export interface ExtendedMetadataModel {
eICR_ID: string;
data_source: "DB" | "S3";
data_link: string;
first_name: string;
last_name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ describe("listEcrDataService", () => {
report_date: date3,
conditions: ["Long"],
rule_summaries: ["Longer"],
data_source: "DB",
data_link: "",
},
{
Expand All @@ -61,7 +60,6 @@ describe("listEcrDataService", () => {
report_date: date3,
conditions: ["Stuff"],
rule_summaries: ["Other stuff", "Even more stuff"],
data_source: "DB",
data_link: "",
},
];
Expand Down Expand Up @@ -144,7 +142,6 @@ describe("listEcrDataService", () => {
conditions: ["super ebola", "double ebola"],
rule_summaries: ["watch out for super ebola"],
data_link: "",
data_source: "DB",
},
]),
);
Expand Down Expand Up @@ -198,7 +195,6 @@ describe("listEcrDataService", () => {
conditions: ["sick", "tired"],
rule_summaries: ["stuff", "disease discovered"],
data_link: "",
data_source: "DB",
},
]),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ describe("saveMetadataToPostgres", () => {
last_name: "lname",
first_name: "fname",
birth_date: "01/01/2000",
data_source: "s3",
eicr_set_id: "1234",
rr: [],
report_date: "12/20/2024",
};

const saveEcrDataQuery =
"INSERT INTO ecr_data (eICR_ID, patient_name_last, patient_name_first, patient_birth_date, data_source, report_date, set_id) VALUES ($1, $2, $3, $4, $5, $6, $7)";
"INSERT INTO ecr_data (eICR_ID, patient_name_last, patient_name_first, patient_birth_date, report_date, set_id) VALUES ($1, $2, $3, $4, $5, $6)";
const saveRRConditionsQuery =
"INSERT INTO ecr_rr_conditions (uuid, eICR_ID, condition) VALUES (uuid_generate_v4(), $1, $2) RETURNING uuid";
const saveRRSummaryQuery =
Expand Down Expand Up @@ -66,15 +65,7 @@ describe("saveMetadataToPostgres", () => {
expect(mockTransaction.one).not.toHaveBeenCalled();
expect(mockTransaction.none).toHaveBeenCalledExactlyOnceWith({
text: saveEcrDataQuery,
values: [
"1-2-3-4",
"lname",
"fname",
"01/01/2000",
"DB",
"12/20/2024",
"1234",
],
values: ["1-2-3-4", "lname", "fname", "01/01/2000", "12/20/2024", "1234"],
});
});

Expand All @@ -101,15 +92,7 @@ describe("saveMetadataToPostgres", () => {
});
expect(mockTransaction.none).toHaveBeenCalledExactlyOnceWith({
text: saveEcrDataQuery,
values: [
"1-2-3-4",
"lname",
"fname",
"01/01/2000",
"DB",
"12/20/2024",
"1234",
],
values: ["1-2-3-4", "lname", "fname", "01/01/2000", "12/20/2024", "1234"],
});
});

Expand Down Expand Up @@ -137,15 +120,7 @@ describe("saveMetadataToPostgres", () => {
expect(mockTransaction.none).toHaveBeenCalledTimes(3);
expect(mockTransaction.none).toHaveBeenNthCalledWith(1, {
text: saveEcrDataQuery,
values: [
"1-2-3-4",
"lname",
"fname",
"01/01/2000",
"DB",
"12/20/2024",
"1234",
],
values: ["1-2-3-4", "lname", "fname", "01/01/2000", "12/20/2024", "1234"],
});

expect(mockTransaction.none).toHaveBeenNthCalledWith(2, {
Expand Down

0 comments on commit 3dacdb5

Please sign in to comment.