Skip to content
Merged

Dev #139

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6aef765
update vite config to work with deployment
smalho01 Jun 17, 2025
335e936
Handle the case where there is no DrugDescription in the NewRx message.
plarocque4 Jun 19, 2025
270a7e4
run prettier
plarocque4 Jul 1, 2025
b7a7029
Merge pull request #135 from mcode/no-drug-description
plarocque4 Jul 1, 2025
f5ece79
disable hmr in prod
smalho01 Jul 7, 2025
3942c92
Merge pull request #136 from mcode/disable-hmr-prod
plarocque4 Jul 7, 2025
d93f486
remove build command from shell script - running during docker build …
smalho01 Jul 7, 2025
c9635c9
configure vite port for preview - affecting health check & networking
smalho01 Jul 7, 2025
9b42702
config for base url
smalho01 Jul 7, 2025
147f30b
logging for CORS
smalho01 Jul 7, 2025
eca697f
react router routing for prod config
smalho01 Jul 8, 2025
16bff37
remove * from cors origin - override with env variable
smalho01 Jul 8, 2025
8d80e80
update ALLOWED_ORIGIN type for wildcard
smalho01 Jul 8, 2025
826054c
update vite config to remove double route in prod
smalho01 Jul 8, 2025
38064c6
re-add pims vite base url, needed for app to work, duplicate routes i…
smalho01 Jul 8, 2025
747de50
Bump the npm_and_yarn group across 1 directory with 2 updates
dependabot[bot] Jul 18, 2025
87b2401
Update README.md
lmd59 Aug 8, 2025
5efbb6e
run prettier/lint
smalho01 Aug 28, 2025
27e2508
Merge pull request #138 from mcode/data-rights
smalho01 Sep 4, 2025
c6e62f5
Merge pull request #137 from mcode/dependabot/npm_and_yarn/frontend/n…
smalho01 Sep 16, 2025
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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN npm install

WORKDIR /home/node/app/frontend
RUN npm install
RUN npm run build

WORKDIR /home/node/app

Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,35 @@ This application requires node.js v20.0 or greater. Using [`nvm`](https://github

- `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.

# Data Rights

<div style="text-align:center">
<b>NOTICE</b>
</div>

This (software/technical data) was produced for the U. S. Government under Contract Number 75FCMC18D0047/75FCMC23D0004, and is subject to Federal Acquisition Regulation Clause 52.227-14, Rights in Data-General.


No other use other than that granted to the U. S. Government, or to those acting on behalf of the U. S. Government under that Clause is authorized without the express written permission of The MITRE Corporation.


For further information, please contact The MITRE Corporation, Contracts Management Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000.

<div style="text-align:center">
<b>&copy;2025 The MITRE Corporation.</b>
</div>

<br />

Licensed under the Apache License, Version 2.0 (the "License"); use of this repository is permitted in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

15 changes: 2 additions & 13 deletions backend/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@
"default": 5051
},
"ALLOWED_ORIGIN": {
"type": "object",
"default": [
"http://localhost:3000",
"http://localhost:3000/",
"http://localhost:3005",
"http://localhost:3005/",
"http://localhost:3008",
"http://localhost:3008/",
"http://localhost:5050",
"http://localhost:5050/",
"http://localhost:4040",
"http://localhost:4040/"
]
"type": "string",
"default": "*"
},
"MONGO_USERNAME": {
"type": "string",
Expand Down
56 changes: 29 additions & 27 deletions backend/src/routes/doctorOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,51 +396,53 @@ const getDispenseStatus = (order, guidanceResponse) => {
*/
async function parseNCPDPScript(newRx) {
// Parsing XML NCPDP SCRIPT from EHR
const patient = newRx.Message.Body.NewRx.Patient;
const prescriber = newRx.Message.Body.NewRx.Prescriber;
const medicationPrescribed = newRx.Message.Body.NewRx.MedicationPrescribed;

const incompleteOrder = {
orderId: newRx.Message.Header.MessageID.toString(), // Will need to return to this and use actual pt identifier or uuid
caseNumber: newRx.Message.Header.AuthorizationNumber,
prescriberOrderNumber: newRx.Message.Header.PrescriberOrderNumber,
patientName:
newRx.Message.Body.NewRx.Patient.HumanPatient.Name.FirstName +
' ' +
newRx.Message.Body.NewRx.Patient.HumanPatient.Name.LastName,
patientFirstName: newRx.Message.Body.NewRx.Patient.HumanPatient.Name.FirstName,
patientLastName: newRx.Message.Body.NewRx.Patient.HumanPatient.Name.LastName,
patientDOB: newRx.Message.Body.NewRx.Patient.HumanPatient.DateOfBirth.Date,
patientCity: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.City,
patientStateProvince: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.StateProvince,
patientPostalCode: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.PostalCode,
patientCountry: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.Country,
patientName: patient.HumanPatient.Name.FirstName + ' ' + patient.HumanPatient.Name.LastName,
patientFirstName: patient.HumanPatient.Name.FirstName,
patientLastName: patient.HumanPatient.Name.LastName,
patientDOB: patient.HumanPatient.DateOfBirth.Date,
patientCity: patient.HumanPatient.Address.City,
patientStateProvince: patient.HumanPatient.Address.StateProvince,
patientPostalCode: patient.HumanPatient.Address.PostalCode,
patientCountry: patient.HumanPatient.Address.Country,
doctorName:
'Dr. ' +
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.Name.FirstName +
prescriber.NonVeterinarian.Name.FirstName +
' ' +
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.Name.LastName,
doctorContact:
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.CommunicationNumbers.PrimaryTelephone
?.Number,
doctorID: newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.Identification.NPI,
doctorEmail:
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.CommunicationNumbers.ElectronicMail,
drugNames: newRx.Message.Body.NewRx.MedicationPrescribed.DrugDescription,
simpleDrugName: newRx.Message.Body.NewRx.MedicationPrescribed.DrugDescription.split(' ')[0],
prescriber.NonVeterinarian.Name.LastName,
doctorContact: prescriber.NonVeterinarian.CommunicationNumbers.PrimaryTelephone?.Number,
doctorID: prescriber.NonVeterinarian.Identification.NPI,
doctorEmail: prescriber.NonVeterinarian.CommunicationNumbers.ElectronicMail,
drugNames: medicationPrescribed.DrugDescription,
simpleDrugName: medicationPrescribed.DrugDescription?.split(' ')[0],

drugNdcCode:
newRx.Message.Body.NewRx.MedicationPrescribed.DrugCoded.ProductCode?.Code ||
newRx.Message.Body.NewRx.MedicationPrescribed.DrugCoded.NDC ||
medicationPrescribed.DrugCoded.ProductCode?.Code ||
medicationPrescribed.DrugCoded.NDC ||
null,

drugRxnormCode:
newRx.Message.Body.NewRx.MedicationPrescribed.DrugCoded.DrugDBCode?.Code || null,
drugRxnormCode: medicationPrescribed.DrugCoded.DrugDBCode?.Code || null,

rxDate: newRx.Message.Body.NewRx.MedicationPrescribed.WrittenDate.Date,
rxDate: medicationPrescribed.WrittenDate.Date,
drugPrice: 200, // Add later?
quantities: newRx.Message.Body.NewRx.MedicationPrescribed.Quantity.Value,
quantities: medicationPrescribed.Quantity.Value,
total: 1800,
pickupDate: 'Tue Dec 13 2022', // Add later?
dispenseStatus: 'Pending'
};

if (incompleteOrder.drugNames === undefined || incompleteOrder.drugNames === 'undefined') {
incompleteOrder.drugNames = incompleteOrder.drugNdcCode;
incompleteOrder.simpleDrugName = incompleteOrder.drugNdcCode;
}

const metRequirements = isRemsDrug(incompleteOrder) ? [] : null;
const order = new doctorOrder({ ...incompleteOrder, metRequirements });
return order;
Expand Down
2 changes: 2 additions & 0 deletions backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ async function main() {
origin: env.ALLOWED_ORIGIN
};

console.log('CORS OPTIONS: ' + JSON.stringify(options));

app.use(bodyParser.urlencoded({ extended: false }));
app.use(cors(options));
app.use('/doctorOrders', doctorOrders);
Expand Down
3 changes: 2 additions & 1 deletion dockerRunnerProd.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh

cd frontend
( npm run start ) & SERVER_PID=$!
npm run build
( npm run preview ) & SERVER_PID=$!

cd ../backend
( npm run start ) & BACKEND_SERVER_PID=$!
Expand Down
59 changes: 25 additions & 34 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ axios.defaults.baseURL = process.env.REACT_APP_PIMS_BACKEND_URL
: 'http://localhost:' +
(process.env.REACT_APP_PIMS_BACKEND_PORT ? process.env.REACT_APP_PIMS_BACKEND_PORT : '5051');

const basename = process.env.REACT_APP_VITE_BASE?.replace(/\/$/, '') || '';

function App() {
return (
<Box>
<Router>
<Router basename={basename}>
<div className="App">
<Container className="NavContainer" maxWidth="xl">
<div className="containerg">
Expand Down
8 changes: 5 additions & 3 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
dotenv.config({ path: '.env' }); // load env vars from .env
export default defineConfig({
// depending on your application, base can also be "/"
base: '',
base: process.env.REACT_APP_VITE_BASE || '',
plugins: [react()],
preview: {
allowedHosts: ['.mitre.org', '.us-east-1.elb.amazonaws.com']
allowedHosts: ['.mitre.org', '.elb.us-east-1.amazonaws.com'],
port: parseInt(process.env.PORT!),

Check warning on line 13 in frontend/vite.config.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier on front end

Forbidden non-null assertion

Check warning on line 13 in frontend/vite.config.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier on front end

Forbidden non-null assertion
host: true
},
define: {
'process.env': process.env
},
server: {
port: parseInt(process.env.PORT!),

Check warning on line 20 in frontend/vite.config.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier on front end

Forbidden non-null assertion

Check warning on line 20 in frontend/vite.config.ts

View workflow job for this annotation

GitHub Actions / Check tsc, lint, and prettier on front end

Forbidden non-null assertion
open: false,
host: true,
allowedHosts: ['.mitre.org', '.us-east-1.elb.amazonaws.com']
allowedHosts: ['.mitre.org', '.elb.us-east-1.amazonaws.com']
}
});
Loading