diff --git a/.env b/.env index a964798..46693e6 100644 --- a/.env +++ b/.env @@ -1,5 +1,9 @@ SERVER_PORT=3323 SERVER_HOST=0.0.0.0 SPL_ZIP_PATH=/src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip -REMS_ADMIN_1_URL=http://localhost:8090/ -REMS_ADMIN_2_URL=http://localhost:8095/ \ No newline at end of file + +REMS_ADMIN_1_CDS_URL=http://localhost:8090/ +REMS_ADMIN_1_FHIR_URL=http://localhost:8090/ + +REMS_ADMIN_2_CDS_URL=http://localhost:8095/ +REMS_ADMIN_2_FHIR_URL=http://localhost:8095/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9818dc2..f71d82f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,5 @@ COPY --chown=node:node . . RUN npm install EXPOSE 3323 -HEALTHCHECK --interval=30s --start-period=15s --timeout=10m --retries=10 CMD wget --no-verbose --tries=1 --spider http://localhost:33333/health || exit 1 +HEALTHCHECK --interval=30s --start-period=15s --timeout=10m --retries=10 CMD wget --no-verbose --tries=1 --spider http://${SERVER_HOST}:${SERVER_PORT}/health || exit 1 CMD npm run dev \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev index 7ce1ce8..bca6f12 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -6,5 +6,5 @@ RUN npm install EXPOSE 3323 EXPOSE 3324 -HEALTHCHECK --interval=30s --start-period=15s --timeout=10m --retries=10 CMD wget --no-verbose --tries=1 --spider http://localhost:33333/health || exit 1 +HEALTHCHECK --interval=30s --start-period=15s --timeout=10m --retries=10 CMD wget --no-verbose --tries=1 --spider http://${SERVER_HOST}:${SERVER_PORT}/health || exit 1 CMD ./dockerRunnerDev.sh \ No newline at end of file diff --git a/README.md b/README.md index 14b4268..46907a9 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ Query the server running on http://localhost:33333/ (or whichever port it was ru ### Example query endpoint: -This will search for the listing for the drug with the product_ndc of 0591-2433 (Isotretinoin) +This will search for the listing for the drug with the package_ndc of 0245-0571-01 (Isotretinoin) -- `http://localhost:33333/drug/ndc.json?search=product_ndc=%220591-2433%22` +- `http://localhost:33333/drug/ndc.json?search=package_ndc=%220591-2433%22` ## Environment Variables @@ -50,8 +50,10 @@ Following are a list of modifiable paths: | URI Name | Default | Description | | --------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- | -| SERVER_PORT | 33333 | The port to run the server on. | +| SERVER_PORT | 3323 | The port to run the server on. | | SERVER_HOST | `127.0.0.1` | The hostname of the server. | | SPL_ZIP_PATH | /src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip | the path to the spl zip | -| REMS_ADMIN_1_URL | http://localhost:8090/ | the base url for the first rems admin | -| REMS_ADMIN_2_URL | http://localhost:8095/ | the base url for the second rems admin | \ No newline at end of file +| REMS_ADMIN_1_CDS_URL | http://localhost:8090/ | the CDS base url for the first rems admin | +| REMS_ADMIN_1_FHIR_URL | http://localhost:8090/ | the FHIR base url for the first rems admin | +| REMS_ADMIN_2_CDS_URL | http://localhost:8095/ | the CDS base url for the second rems admin | +| REMS_ADMIN_2_FHIR_URL | http://localhost:8095/ | the FHIR base url for the second rems admin | \ No newline at end of file diff --git a/src/data.ts b/src/data.ts index f881127..1fa610e 100644 --- a/src/data.ts +++ b/src/data.ts @@ -3,9 +3,10 @@ import * as env from 'env-var'; export type Medication = { brand_name: string; generic_name: string, - product_ndc: string, + package_ndc: string, rems_administrator: string, - rems_endpoint: string | undefined, + rems_cds_endpoint: string | undefined, + rems_fhir_base_url: string | undefined, rems_approval_date: string, rems_spl_date?: string rems_modification_date: string @@ -15,36 +16,40 @@ export const medications : Medication[] = [ { brand_name: "ADDYI", generic_name: "FLIBANSERINE", - product_ndc: "58604-214", + package_ndc: "58604-214-30", rems_administrator: "REMS Prototype Admin 1", - rems_endpoint: env.get('REMS_ADMIN_1_URL').asString(), + rems_cds_endpoint: env.get('REMS_ADMIN_1_CDS_URL').asString(), + rems_fhir_base_url: env.get('REMS_ADMIN_1_FHIR_URL').asString(), rems_approval_date: "20240906", rems_modification_date: "20240906" }, { brand_name: "Isotretinoin", generic_name: "ISOTRETINOIN", - product_ndc: "0245-0571-01", + package_ndc: "0245-0571-01", rems_administrator: "REMS Prototype Admin 2", - rems_endpoint: env.get('REMS_ADMIN_2_URL').asString(), + rems_cds_endpoint: env.get('REMS_ADMIN_2_CDS_URL').asString(), + rems_fhir_base_url: env.get('REMS_ADMIN_2_FHIR_URL').asString(), rems_approval_date: "20240906", rems_modification_date: "20240906", rems_spl_date: "20230912" }, { brand_name: "Fentanyl Citrate", generic_name: "FENTANYL CITRATE", - product_ndc: "63459-502-30", + package_ndc: "63459-502-30", rems_administrator: "REMS Prototype Admin 1", - rems_endpoint: env.get('REMS_ADMIN_1_URL').asString(), + rems_cds_endpoint: env.get('REMS_ADMIN_1_CDS_URL').asString(), + rems_fhir_base_url: env.get('REMS_ADMIN_1_FHIR_URL').asString(), rems_approval_date: "20240906", rems_modification_date: "20240906", rems_spl_date: "20230401" }, { brand_name: "Turalio", generic_name: "PEXIDARTINIB HYDROCHLORIDE", - product_ndc: "65597-402-20", + package_ndc: "65597-407-20", rems_administrator: "REMS Prototype Admin 2", - rems_endpoint: env.get('REMS_ADMIN_2_URL').asString(), + rems_cds_endpoint: env.get('REMS_ADMIN_2_CDS_URL').asString(), + rems_fhir_base_url: env.get('REMS_ADMIN_2_FHIR_URL').asString(), rems_approval_date: "20240906", rems_modification_date: "20240906" } -]; +]; \ No newline at end of file diff --git a/src/server.ts b/src/server.ts index 05e378c..88a154a 100644 --- a/src/server.ts +++ b/src/server.ts @@ -44,8 +44,8 @@ const server = createServer((req: IncomingMessage, res: ServerResponse) => { foundElement = medications.find(element => element.generic_name.toLowerCase() === searchValue.toLowerCase()); } else if (searchKey === 'brand_name') { foundElement = medications.find(element => element.brand_name.toLowerCase() === searchValue.toLowerCase()); - } else if (searchKey === 'product_ndc') { - foundElement = medications.find(element => element.product_ndc.toLowerCase() === searchValue.toLowerCase()); + } else if (searchKey === 'package_ndc') { + foundElement = medications.find(element => element.package_ndc.toLowerCase() === searchValue.toLowerCase()); } if (foundElement) { @@ -73,6 +73,8 @@ const server = createServer((req: IncomingMessage, res: ServerResponse) => { if (response) { console.log(' - return: ' + response.results[0]?.brand_name); + console.log(' - CDS endpoint: ' + response.results[0]?.rems_cds_endpoint); + console.log(' - FHIR base URL: ' + response.results[0]?.rems_fhir_base_url); res.statusCode = 200; res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(response)); @@ -139,4 +141,4 @@ const server = createServer((req: IncomingMessage, res: ServerResponse) => { server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); -}); +}); \ No newline at end of file diff --git a/src/spl/TESTDATA_Docker_rems_document_and_rems_indexing_spl_files.zip b/src/spl/TESTDATA_Docker_rems_document_and_rems_indexing_spl_files.zip index b53042c..aaef2d8 100644 Binary files a/src/spl/TESTDATA_Docker_rems_document_and_rems_indexing_spl_files.zip and b/src/spl/TESTDATA_Docker_rems_document_and_rems_indexing_spl_files.zip differ diff --git a/src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip b/src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip index 3013038..f622050 100644 Binary files a/src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip and b/src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip differ