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
4 changes: 2 additions & 2 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 Down
10 changes: 5 additions & 5 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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_cds_endpoint: string | undefined,
rems_fhir_base_url: string | undefined,
Expand All @@ -16,7 +16,7 @@ export const medications : Medication[] = [
{
brand_name: "ADDYI",
generic_name: "FLIBANSERINE",
product_ndc: "58604-214-30",
package_ndc: "58604-214-30",
rems_administrator: "REMS Prototype Admin 1",
rems_cds_endpoint: env.get('REMS_ADMIN_1_CDS_URL').asString(),
rems_fhir_base_url: env.get('REMS_ADMIN_1_FHIR_URL').asString(),
Expand All @@ -25,7 +25,7 @@ export const medications : Medication[] = [
}, {
brand_name: "Isotretinoin",
generic_name: "ISOTRETINOIN",
product_ndc: "0245-0571-01",
package_ndc: "0245-0571-01",
rems_administrator: "REMS Prototype Admin 2",
rems_cds_endpoint: env.get('REMS_ADMIN_2_CDS_URL').asString(),
rems_fhir_base_url: env.get('REMS_ADMIN_2_FHIR_URL').asString(),
Expand All @@ -35,7 +35,7 @@ export const medications : Medication[] = [
}, {
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_cds_endpoint: env.get('REMS_ADMIN_1_CDS_URL').asString(),
rems_fhir_base_url: env.get('REMS_ADMIN_1_FHIR_URL').asString(),
Expand All @@ -45,7 +45,7 @@ export const medications : Medication[] = [
}, {
brand_name: "Turalio",
generic_name: "PEXIDARTINIB HYDROCHLORIDE",
product_ndc: "65597-407-20",
package_ndc: "65597-407-20",
rems_administrator: "REMS Prototype Admin 2",
rems_cds_endpoint: env.get('REMS_ADMIN_2_CDS_URL').asString(),
rems_fhir_base_url: env.get('REMS_ADMIN_2_FHIR_URL').asString(),
Expand Down
4 changes: 2 additions & 2 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