Skip to content

Commit

Permalink
build fresh; url changes; documentation changes; removed some unncess…
Browse files Browse the repository at this point in the history
…ary logging
  • Loading branch information
Dtphelan1 committed Sep 6, 2024
1 parent 38ee01c commit d0d047c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ node . [options]
node . --help

# An example of running the CLI with a custom config, and a CLI-specified FHIR URL and pointer to a patients.ndjson file
node . --config config/my-config.json -f https://bulk-match-provider-df228d68a43b.herokuapp.com/fhir/ --resource data/patients-to-match.ndjson
node . --config config/my-config.json -f https://bulk-match.smarthealthit.org/fhir/ --resource data/patients-to-match.ndjson
```

## Options
Expand Down
8 changes: 3 additions & 5 deletions build/lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ async function augmentedFetch(input, options = {}) {
// After requests – handle logging and retrying
.then(async (response) => {
let body = await response.text();
const contentType = response.headers.get("content-type") || "";
if (body.length && contentType.match(/\bjson\b/i)) {
if (body.length && (0, utils_1.isJsonResponse)(response)) {
body = JSON.parse(body);
}
// Create eventual response now so we can use it in error objects
Expand Down Expand Up @@ -61,8 +60,8 @@ async function augmentedFetch(input, options = {}) {
// downstream by the postprocessing components
if (options?.context?.interactive && body && (0, utils_1.isJsonResponse)(response)) {
// @ts-ignore OperationOutcome errors
// Parse the body from above into JSON
const oo = JSON.parse(body);
// Treat the body as an operationOutcome to check for errors
const oo = body;
if (oo.resourceType === "OperationOutcome") {
if (oo.issue.every((i) => i.code === "transient")) {
const msg = oo.issue
Expand All @@ -89,7 +88,6 @@ async function augmentedFetch(input, options = {}) {
})
.catch((e) => {
debug("FAILED fetch: ", e.message);
console.error(e);
throw e;
}));
}
Expand Down
2 changes: 1 addition & 1 deletion build/reporters/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CLIReporter extends reporter_1.default {
lib_1.Utils.print("There was an error in the matching process: " + JSON.stringify(details)).commit();
}
onDownloadStart({ fileUrl, itemType, startTime, }) {
lib_1.Utils.print(`Begin ${itemType === "error" ? "error-file " : " "}download for ${fileUrl} at ${lib_1.Utils.formatDatetimeTimestamp(startTime)}...`).commit();
lib_1.Utils.print(`Begin ${itemType === "error" ? "error-file " : ""}download for ${fileUrl} at ${lib_1.Utils.formatDatetimeTimestamp(startTime)}...`).commit();
}
onDownloadComplete({ fileUrl, duration }) {
lib_1.Utils.print(`${fileUrl} download complete in ${duration}`).commit();
Expand Down
3 changes: 0 additions & 3 deletions src/lib/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ async function augmentedFetch<T>(
})
.catch((e: Error) => {
debug("FAILED fetch: ", e.message);
if (process.env.NODE_ENV !== "test") {
console.error(e);
}
throw e;
})
);
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class CLIReporter extends Reporter {
startTime: number;
}) {
Utils.print(
`Begin ${itemType === "error" ? "error-file " : " "}download for ${fileUrl} at ${Utils.formatDatetimeTimestamp(startTime)}...`,
`Begin ${itemType === "error" ? "error-file " : ""}download for ${fileUrl} at ${Utils.formatDatetimeTimestamp(startTime)}...`,
).commit();
}
onDownloadComplete({ fileUrl, duration }: { fileUrl: string; duration: string }) {
Expand Down

0 comments on commit d0d047c

Please sign in to comment.