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

SNOMED Hydrating, Filtering, Special MR Generation #1648

Draft
wants to merge 19 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
19 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
Prev Previous commit
Next Next commit
feat(snomed): filtering for only the resources we need
Refs: #1442
  • Loading branch information
jonahkaye committed Apr 2, 2024
commit 28b190c5f32673f22b6d5cc72d9c01251cfa2f7d
10 changes: 8 additions & 2 deletions packages/utils/src/customer-requests/full-snomed-pipeline.ts
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the main customer facing output of this PR. A script that for a given customer, gets all their patients consolidated data and performs the filtering and MR summary generation

Copy link
Member Author

Choose a reason for hiding this comment

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

Full script for running this whole process

Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ import { MetriportMedicalApi } from "@metriport/api-sdk";
import { getEnvVarOrFail } from "@metriport/core/util/env-var";
import * as dotenv from "dotenv";
import axios from "axios";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
dotenv.config();
dayjs.extend(duration);

const apiKey = getEnvVarOrFail("API_KEY");
const apiLoadBalancerURL = getEnvVarOrFail("API_URL");
const fhirUrl = getEnvVarOrFail("FHIR_URL");
const cxId = getEnvVarOrFail("CX_ID");
const metriportApi: MetriportMedicalApi = new MetriportMedicalApi(apiKey);
const resultsDirectory = "./runs/consolidatedPatients";

const timestamp = dayjs().toISOString();
const resultsDirectory = `./runs/consolidatedPatients/${timestamp}`;

async function fetchPatientIds(cxId: string): Promise<string[]> {
const url = `${apiLoadBalancerURL}/internal/patient/ids?cxId=${cxId}`;
Expand Down Expand Up @@ -49,7 +54,8 @@ export async function ensureDirectory(): Promise<void> {

async function fetchAndSavePatientData(patientId: string): Promise<void> {
try {
const data = await metriportApi.getPatientConsolidated(patientId);
const resources = ["Conditions, Procedures, MedicationAdministration"];
const data = await metriportApi.getPatientConsolidated(patientId, resources);
const fhirPatient = await getFhirPatientData(patientId);
const resourceWrappedFhirPatient = { resource: fhirPatient };
if (!data.entry) {
Expand Down
Loading