-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from mcode/dev
Dev
- Loading branch information
Showing
11 changed files
with
99 additions
and
69 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
# Pharmacy Information Management System | ||
|
||
### Setup | ||
## Setup | ||
|
||
The application is divided into a frontend and backend service. 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. | ||
|
||
The application is divided into a frontend and backend service. For an initial setup you will need to `run npm install` in both the frontend and backend subdirectories. This will install the dependencies required for each of the services. | ||
## Running backend and frontend | ||
|
||
### Running | ||
Run the individual services by either launching both of them independently or using pm2 innately through Docker. | ||
|
||
Running the individual services can be done by either launching both of them independently or using pm2. To run them individually you will need to open a terminal window in each of the frontend and backend subdirectories. From there you will need to run `npm start` in each of the terminal windows. | ||
### Running independently | ||
|
||
To run both the systems under pm2 you will first need to install it: `npm install pm2 -g` After it is installed you can run both the systems with a single command `pm2 start pm2.config.json`. This will start both the frontend and the backend services. | ||
To run them individually you will need to open a terminal window in each of the frontend and backend subdirectories. From there you will need to run `npm start` in each of the terminal windows. | ||
|
||
By default, the frontend will start on port 3000 and the backend will start on port 5051. To configure the frontend to start on different port set the PORT environment variable to the port you would like it to start on. ex. `PORT 5050 npm start` To configure the backend to start on a different port set the BACKEND_PORT environment variable to the port you would like it to run on. | ||
By default, the frontend will start on port 5050 (defined in `frontend/.env`) and the backend will start on port 5051 (defined in `backend/env.json`). | ||
|
||
These environment variables, and others , can also be set in the pm2 configuration file for the individula service entries. | ||
To configure the frontend to start on different port, set the `PORT` environment variable to the desired port; e.g. `PORT=5050 npm start`, or create a `frontend/.env.local` to override `PORT`. | ||
|
||
Once running both the frontend and backend systems open [http://localhost:5050](http://localhost:5050) in your browser to view the application. | ||
To configure the backend to start on a different port, set the `BACKEND_PORT` environment variable to the desired port; e.g. | ||
`BACKEND_PORT=5051 npm start`. | ||
|
||
These environment variables, and others, can also be set in the pm2 configuration file for the individual service entries. | ||
|
||
Once running both the frontend and backend systems, open [http://localhost:5050](http://localhost:5050) in your browser to view the application. | ||
|
||
### Using pm2 | ||
|
||
`pm2` is used in our [Dockerized REMS Integration Prototype setup](https://github.com/mcode/rems-setup/blob/main/DeveloperSetupGuide.md) for production to start both the frontend and the backend services. It is not used in development due to a bug with hot-reloading code changes in the two services. | ||
|
||
## Version | ||
This application requires node v20.0 or greater. | ||
|
||
This application requires node.js v20.0 or greater. Using [`nvm`](https://github.com/nvm-sh/nvm) is optional, but easier when managing different node.js versions. | ||
|
||
- `nvm install 20` | ||
- `nvm use 20` or `nvm use default 20`, as most of the REMS Integration Prototype repositories are compatible with node v20.0. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* NCPDP SCRIPT v2017071 Support */ | ||
import { XMLBuilder } from 'fast-xml-parser'; | ||
|
||
export default function buildRxStatus(caseNumber, doctorName, drugNames) { | ||
var time = new Date(); | ||
var rxStatus = { | ||
RxStatus: [ | ||
{ | ||
Message: [ | ||
{ | ||
Header: [ | ||
{ | ||
To: doctorName | ||
}, | ||
{ | ||
From: 'Pharmacy' // Placeholder: This is dependant on individual pharmacy | ||
}, | ||
{ | ||
Message: 'NewRx Request Recieved For: ' + drugNames | ||
}, | ||
{ | ||
RelatesToMessageID: caseNumber // Placeholder: This is dependant on individual pharmacy, using Case Number | ||
}, | ||
{ | ||
Time: time | ||
} | ||
] | ||
}, | ||
{ | ||
Body: [ | ||
{ | ||
Status: [ | ||
{ | ||
Code: '200' // Placeholder: This is dependant on individual pharmacy | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
const builder = new XMLBuilder({ oneListGroup: 'true' }); | ||
var RxStatus = builder.build(rxStatus); | ||
|
||
return RxStatus; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters