8000 ENG-532 Don't include req headers on CW errors by leite08 · Pull Request #4092 · metriport/metriport · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ENG-532 Don't include req headers on CW errors #4092

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"full-hbs-lint": "cd packages/fhir-converter && ./full-hbs-lint.sh"
},
"workspaces": [
"packages/eslint-rules",
"packages/shared",
"packages/api-sdk",
"packages/ihe-gateway-sdk",
Expand All @@ -50,8 +51,7 @@
"packages/api",
"packages/mllp-server",
"packages/infra",
"packages/utils",
"packages/eslint-rules"
"packages/utils"
],
"lint-staged": {
"*.{ts,tsx}": [
Expand Down
6 changes: 3 additions & 3 deletions packages/api-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metriport/api-sdk",
"version": "15.0.5",
"version": "15.0.7-alpha.0",
"description": "Metriport helps you access and manage health and medical data, through a single open source API.",
"author": "Metriport Inc. <contact@metriport.com>",
"homepage": "https://metriport.com/",
Expand Down Expand Up @@ -58,8 +58,8 @@
},
"dependencies": {
"@medplum/fhirtypes": "^2.0.32",
"@metriport/commonwell-sdk": "^5.9.8",
"@metriport/shared": "^0.23.8",
"@metriport/commonwell-sdk": "^5.9.10-alpha.0",
"@metriport/shared": "^0.23.10-alpha.0",
"axios": "^1.8.2",
"dayjs": "^1.11.7",
"dotenv": "^16.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "1.27.8",
"version": "1.27.10-alpha.0",
"description": "",
"main": "app.js",
"private": true,
Expand Down
35 changes: 18 additions & 17 deletions packages/api/src/external/commonwell/document/document-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
operationOutcomeResourceType,
organizationQueryMeta,
} from "@metriport/commonwell-sdk";
import { ingestIntoSearchEngine } from "@metriport/core/command/consolidated/search/document-reference/ingest";
import {
isCQDirectEnabledForCx,
isEnhancedCoverageEnabledForCx,
Expand Down Expand Up @@ -35,7 +36,6 @@ import { getPatientOrFail } from "../../../command/medical/patient/get-patient";
import { Config } from "../../../shared/config";
import { mapDocRefToMetriport } from "../../../shared/external";
import { reportMetric } from "../../aws/cloudwatch";
import { ingestIntoSearchEngine } from "@metriport/core/command/consolidated/search/document-reference/ingest";
import { convertCDAToFHIR, isConvertible } from "../../fhir-converter/converter";
import { makeFhirApi } from "../../fhir/api/api-factory";
import { cwToFHIR } from "../../fhir/document";
Expand Down Expand Up @@ -267,18 +267,17 @@ export async function queryAndProcessDocuments({

const cwReference = error instanceof CommonwellError ? error.cwReference : undefined;

capture.message(msg, {
capture.error(msg, {
extra: {
context: `cw.queryAndProcessDocuments`,
error,
patientId: patientParam.id,
facilityId,
forceDownload,
requestId,
ignoreDocRefOnFHIRServer,
cwReference,
error: errorToString(error),
},
level: "error",
});
throw error;
}
Expand All @@ -302,15 +301,15 @@ export async function internalGetDocuments({

const cwData = patient.data.externalData.COMMONWELL;

const reportDocQueryMetric = (queryStart: number) => {
function reportDocQueryMetric(queryStart: number) {
const queryDuration = Date.now() - queryStart;
reportMetric({
name: context,
value: queryDuration,
unit: "Milliseconds",
additionalDimension: "CommonWell",
});
};
}
const commonWell = makeCommonWellAPI(initiator.name, addOidPrefix(initiator.oid));
const queryMeta = organizationQueryMeta(initiator.oid, { npi: initiator.npi });

Expand Down Expand Up @@ -389,9 +388,8 @@ function reportCWErrors({
for (const [category, errors] of Object.entries(errorsByCategory)) {
const msg = `CW Document query error`;
log(`${msg} - Category: ${category}. Cause: ${JSON.stringify(errors)}`);
capture.message(msg, {
capture.error(msg, {
extra: { ...context, errors, category },
level: "error",
});
}
}
Expand Down Expand Up @@ -526,10 +524,11 @@ async function downloadDocsAndUpsertFHIR({
log(`I have ${validDocs.length} valid docs to process`);

// Get File info from S3 (or from memory, if override = true)
const getFilesWithStorageInfo = async () =>
forceDownload
async function getFilesWithStorageInfo() {
return forceDownload
? await Promise.all(validDocs.map(convertToNonExistingS3Info(patient)))
: await getS3Info(validDocs, patient);
}

// Get all DocumentReferences for this patient + File info from S3
const [foundOnFHIR, filesWithStorageInfo] = await Promise.all([
Expand All @@ -553,7 +552,9 @@ async function downloadDocsAndUpsertFHIR({

const docsToDownload = filesToDownload.flatMap(f => validDocs.find(d => d.id === f.docId) ?? []);

const fileInfoByDocId = (docId: string) => filesWithStorageInfo.find(f => f.docId === docId);
function fileInfoByDocId(docId: string) {
return filesWithStorageInfo.find(f => f.docId === docId);
}

const convertibleDocCount = docsToDownload.filter(doc =>
isConvertible(doc.content?.mimeType)
Expand Down Expand Up @@ -639,9 +640,8 @@ async function downloadDocsAndUpsertFHIR({
patientId: patient.id,
documentReference: doc,
requestId,
error,
error: errorToString(error),
},
level: "error",
});
throw error;
}
Expand Down Expand Up @@ -746,15 +746,14 @@ async function downloadDocsAndUpsertFHIR({
const msg = `Error processing doc from CW`;
log(`${msg}: ${error}; doc ${JSON.stringify(doc)}`);
if (!errorReported && !(error instanceof NotFoundError)) {
capture.message(msg, {
capture.error(msg, {
extra: {
context: `cw.downloadDocsAndUpsertFHIR`,
patientId: patient.id,
document: doc,
requestId,
error,
error: errorToString(error),
},
level: "error",
});
}
throw error;
Expand Down Expand Up @@ -835,7 +834,9 @@ async function triggerDownloadDocument({
}
}

const fileIsConvertible = (f: File) => isConvertible(f.contentType);
function fileIsConvertible(f: File) {
return isConvertible(f.contentType);
}

async function sleepBetweenChunks(): Promise<void> {
return sleepRandom(DOC_DOWNLOAD_CHUNK_DELAY_MAX_MS, DOC_DOWNLOAD_CHUNK_DELAY_MIN_PCT / 100);
Expand Down
6 changes: 3 additions & 3 deletions packages/carequality-cert-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metriport/carequality-cert-runner",
"version": "1.18.8",
"version": "1.18.10-alpha.0",
"description": "Tool to run through Carequality certification test cases - by Metriport Inc.",
"author": "Metriport Inc. <contact@metriport.com>",
"homepage": "https://metriport.com/",
Expand Down Expand Up @@ -41,7 +41,7 @@
"url": "https://github.com/metriport/metriport/issues"
},
"dependencies": {
"@metriport/ihe-gateway-sdk": "^0.19.8",
"@metriport/shared": "^0.23.8"
"@metriport/ihe-gateway-sdk": "^0.19.10-alpha.0",
"@metriport/shared": "^0.23.10-alpha.0"
}
}
2 changes: 1 addition & 1 deletion packages/carequality-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metriport/carequality-sdk",
"version": "1.6.8",
"version": "1.6.10-alpha.0",
"description": "SDK to interact with the Carequality directory - by Metriport Inc.",
"author": "Metriport Inc. <contact@metriport.com>",
"homepage": "https://metriport.com/",
Expand Down
4 changes: 2 additions & 2 deletions packages/commonwell-cert-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metriport/commonwell-cert-runner",
"version": "1.26.10",
"version": "1.26.12-alpha.0",
"description": "Tool to run through Edge System CommonWell certification test cases - by Metriport Inc.",
"author": "Metriport Inc. <contact@metriport.com>",
"homepage": "https://metriport.com/",
Expand Down Expand Up @@ -42,7 +42,7 @@
"url": "https://github.com/metriport/metriport/issues"
},
"dependencies": {
"@metriport/commonwell-sdk": "^5.9.8",
"@metriport/commonwell-sdk": "^5.9.10-alpha.0",
"axios": "^1.8.2",
"commander": "^9.5.0",
"dayjs": "^1.11.7",
Expand Down
Loading
Loading
0