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

implement multiple accordions on customize query #2568

Merged
merged 18 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions containers/tefca-viewer/src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,9 @@ export interface ValueSet {
}

export type ValueSetType = keyof ValueSet;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realize I snuck this in in the previous PR, but since were using the "labs | conditions | medications" set of strings in a bunch of places, went ahead and formalized it into a type. Again, would love to know if this is a sensible name / suggestions for alternatives if not

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValueSetType looks good to me and is consistent with how it is referred to in the TCR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this works for me! It's a bit of a weird terminology thing because these three types actually inherit from something called a "Clinical Service Type" in the coding schemes, but there are six of those that map non-uniformly to these value set types here (e.g. 3 of the 6 go to labs, 2 of the 6 to conditions, and 1 just is medications). Since we're not capturing all 6, I think what you've done here makes sense.


export const valueSetTypeToClincalServiceTypeMap = {
Copy link
Collaborator Author

@fzhao99 fzhao99 Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed this information for some frontend sorting work, so I pulled it out / reimported it into the backend database service as well. Let me know if there's a better semantic name for this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of something better off the top of my head! I think there's a decent chance many things get renamed as we work through tech debt in the coming weeks,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh just you wait until we cleanup all of our seventeen mapping constants that all do the same thing...

labs: ["ostc", "lotc", "lrtc"],
medications: ["mrtc"],
conditions: ["dxtc", "sdtc"],
};
11 changes: 2 additions & 9 deletions containers/tefca-viewer/src/app/database-service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";
import { Pool, PoolConfig, QueryResultRow } from "pg";
import dotenv from "dotenv";
import { ValueSetItem } from "./constants";
import { ValueSetItem, valueSetTypeToClincalServiceTypeMap } from "./constants";

const getQuerybyNameSQL = `
select q.query_name, q.id, qtv.valueset_id, vs.name as valueset_name, vs.author as author, vs.type, qic.concept_id, qic.include, c.code, c.code_system, c.display
Expand Down Expand Up @@ -60,14 +60,7 @@ export const filterValueSets = async (
) => {
// Assign clinical code type based on desired filter
// Mapping is established in TCR, so follow that convention
let valuesetFilters: string[];
if (type == "labs") {
valuesetFilters = ["ostc", "lotc", "lrtc"];
} else if (type == "medications") {
valuesetFilters = ["mrtc"];
} else {
valuesetFilters = ["dxtc", "sdtc"];
}
let valuesetFilters = valueSetTypeToClincalServiceTypeMap[type];
const results = vsItems.filter((vs) =>
valuesetFilters.includes(vs.clinicalServiceType),
);
Expand Down
Loading
Loading