Skip to content
Merged

Dev #148

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d077494
update jon snow
smalho01 Sep 22, 2025
8b23d97
Merge pull request #141 from mcode/update-jon-snow
plarocque4 Sep 29, 2025
2454b7c
fix login bug with auth context
smalho01 Oct 21, 2025
ebc57ef
update keycloak url
smalho01 Oct 21, 2025
7001b3b
run prettier/lint
smalho01 Oct 21, 2025
37f3f66
update env variables
smalho01 Oct 21, 2025
ee6433f
Merge pull request #143 from mcode/env-update
plarocque4 Nov 5, 2025
cb889de
Merge pull request #142 from mcode/login-bug
plarocque4 Nov 5, 2025
c374020
impliment middleware to prevent xss attacks
smalho01 Dec 15, 2025
cf669b7
run lint
smalho01 Dec 15, 2025
01548b8
update index to not include intermediary title
smalho01 Dec 15, 2025
286a704
update title to be PIMS short hand
smalho01 Dec 15, 2025
3ca9aec
Merge pull request #144 from mcode/xss-middleware
smalho01 Dec 15, 2025
0848d8e
undo xss middleware
smalho01 Dec 22, 2025
57a5214
Merge branch 'dev' into xss-middleware
smalho01 Dec 22, 2025
c7090c8
Merge pull request #145 from mcode/xss-middleware
smalho01 Dec 22, 2025
4884348
send rems initiation and rems request
smalho01 Jan 14, 2026
d7fc774
remove questionset logic - unused
smalho01 Jan 14, 2026
25622a4
rxfill update
smalho01 Jan 14, 2026
794bd5e
rxfill
smalho01 Jan 14, 2026
1a82e64
single denial code
smalho01 Jan 14, 2026
ae832a6
single denial code
smalho01 Jan 14, 2026
65b5f2b
single denial reason
smalho01 Jan 14, 2026
c557d22
remove question set logic
smalho01 Jan 14, 2026
0000e01
clean up
smalho01 Jan 14, 2026
e4bc1f7
replace view etasu in backend
smalho01 Jan 14, 2026
008e509
return helper functions for old guidance response approach
smalho01 Jan 14, 2026
8a4891c
frontend changes for fhir/ncpdp hybrid approach
smalho01 Jan 14, 2026
9226bdd
patch metReq update
smalho01 Jan 14, 2026
2f15d91
updates for success case
smalho01 Jan 14, 2026
2ab030f
Merge pull request #146 from mcode/ncpdp-integration
plarocque4 Feb 5, 2026
96594af
integration with ncpdp intermediary
smalho01 Feb 12, 2026
be8a6b9
update url path
smalho01 Feb 12, 2026
4104576
rxfill error fix
smalho01 Feb 12, 2026
507314f
update pharmacy config
smalho01 Feb 12, 2026
af86377
update pharmacy config
smalho01 Feb 12, 2026
aa5bc61
Merge branch 'dev' into intermediary-ncpdp
smalho01 Feb 12, 2026
0c67fc3
Merge pull request #147 from mcode/intermediary-ncpdp
smalho01 Feb 12, 2026
4c19e81
Merge branch 'main' into dev
smalho01 Feb 12, 2026
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
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,43 @@ The backend consists of multiple HTTP GET, POST, PATCH, or DELETE routes, most o

The frontend displays pending, approved, and picked up proprietary doctor orders at [http://localhost:5050/DoctorOrders](http://localhost:5050/DoctorOrders). While there is a login page at [http://localhost:5050](http://localhost:5050) for a dummy user, there is no user authentication or authorization system.

## Environment Variables

The PIMS system uses environment variables to configure both the frontend and backend services.

### Frontend Environment Variables

The frontend environment variables are configured in `frontend/.env`:

| Variable Name | Default Value | Description |
| ------------- | ------------- | ----------- |
| PORT | `5050` | The port that the frontend server runs on. Change if there are conflicts with port usage. |
| REACT_APP_PIMS_BACKEND_PORT | `5051` | The port that the backend server runs on. Must match the backend's `BACKEND_PORT` setting. |

To override defaults, either:
- Start the app with environment variables: `PORT=5050 npm start`
- Create a `frontend/.env.local` file with the desired values

### Backend Environment Variables

The backend environment variables are configured in `backend/env.json`:

| Variable Name | Default Value | Description |
| ------------- | ------------- | ----------- |
| BACKEND_PORT | `5051` | The port that the backend server runs on. Change if there are conflicts with port usage. |
| ALLOWED_ORIGIN | `*` | CORS allowed origins. Specify domains that are allowed to access the backend API. |
| MONGO_USERNAME | `pims-user` | Username for MongoDB authentication. Should match the user created during MongoDB setup. |
| MONGO_PASSWORD | `pims-pass` | Password for MongoDB authentication. Should match the password created during MongoDB setup. |
| MONGO_URL | `mongodb://localhost:27017/pims` | MongoDB connection URL. Update if using a different host, port, or database name. |
| AUTH_SOURCE | `pims` | MongoDB authentication source database name. |
| HTTPS_KEY_PATH | `server.key` | Path to the HTTPS private key file. Required only if `USE_HTTPS` is true. |
| HTTPS_CERT_PATH | `server.cert` | Path to the HTTPS certificate file. Required only if `USE_HTTPS` is true. |
| USE_HTTPS | `false` | Set to `true` to enable HTTPS. Ensure valid certificate and key paths are configured. |
| EHR_RXFILL_URL | `http://localhost:8080/test-ehr/ncpdp/script` | URL endpoint for sending RxFill messages to the EHR system. |
| USE_INTERMEDIARY | `true` | Set to `true` to route ETASU checks through the REMS intermediary instead of directly to REMS admin. |
| INTERMEDIARY_FHIR_URL | `http://localhost:3003/4_0_0` | Base URL of the REMS intermediary FHIR server. Used when `USE_INTERMEDIARY` is true. |
| REMS_ADMIN_NCPDP | `http://localhost:8090/ncpdp/script` | URL endpoint for sending NCPDP Script messages directly to REMS admin. |

## Setup

For an initial setup run `npm install` in both the frontend and backend subdirectories. This will install the dependencies required for each of the services.
Expand Down
8 changes: 8 additions & 0 deletions backend/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,13 @@
"REMS_ADMIN_NCPDP": {
"type": "string",
"default": "http://localhost:8090/ncpdp/script"
},
"INTERMEDIARY_URL": {
"type": "string",
"default": "http://localhost:8090/ncpdp/script"
},
"EHR_NCPDP_URL": {
"type": "string",
"default": "|| 'http://localhost:8080/ncpdp/script'"
}
}
6 changes: 5 additions & 1 deletion backend/src/database/schemas/doctorOrderSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const orderSchema = new mongoose.Schema({
total: Number,
pickupDate: String,
dispenseStatus: String,
authorizationNumber: String,
authorizationExpiration: String,
denialReasonCode: String,
remsNote: String,
metRequirements: [
{
name: String,
Expand All @@ -44,4 +48,4 @@ export const orderSchema = new mongoose.Schema({
// Compound index is used to prevent duplicates based off of the given parameters
orderSchema.index({ simpleDrugName: 1, patientName: 1 }, { unique: true }); // schema level

export const doctorOrder = mongoose.model('doctorOrder', orderSchema);
export const doctorOrder = mongoose.model('doctorOrder', orderSchema);
56 changes: 56 additions & 0 deletions backend/src/lib/pharmacyConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

// Configuration state
let config = {
useIntermediary: process.env.USE_INTERMEDIARY,
intermediaryUrl: process.env.INTERMEDIARY_URL,
remsAdminUrl: process.env.REMS_ADMIN_NCPDP,
ehrUrl: process.env.EHR_NCPDP_URL
};



export function getConfig() {
return { ...config };
}


export function updateConfig(newConfig) {
config = { ...config, ...newConfig };
console.log('Configuration updated:', config);
return { ...config };
}

/**
* Get the endpoint for NCPDP messages (REMS)
*/
export function getNCPDPEndpoint() {
if (config.useIntermediary) {
return `${config.intermediaryUrl}/ncpdp/script`;
}
return config.remsAdminUrl;
}

/**
* Get the endpoint for ETASU requests
*/
export function getETASUEndpoint() {
if (config.useIntermediary) {
return `${config.intermediaryUrl}/etasu`;
}
// Direct ETASU endpoint to REMS Admin
return config.remsAdminUrl.replace('/ncpdp', '/4_0_0/GuidanceResponse/$rems-etasu');
}

/**
* Get the endpoint for RxFill messages (to EHR)
* RxFill is sent to both EHR and REMS Admin
* If using intermediary, send to intermediary (it forwards to both)
* If not using intermediary, return EHR endpoint (caller must also send to REMS)
*/
export function getRxFillEndpoint() {
if (config.useIntermediary) {
// Intermediary handles forwarding to both EHR and REMS Admin
return `${config.intermediaryUrl}/ncpdp/script`;
}
return config.ehrUrl;
}
Loading
Loading