Skip to content
Merged
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
8 changes: 6 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -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/

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/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 |
| 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 |
27 changes: 16 additions & 11 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
];
];
8 changes: 5 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -139,4 +141,4 @@ const server = createServer((req: IncomingMessage, res: ServerResponse) => {

server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
});
Binary file not shown.
Binary file modified src/spl/TESTDATA_rems_document_and_rems_indexing_spl_files.zip
Binary file not shown.
Loading