Skip to content

Commit bafc005

Browse files
authored
Merge pull request #139 from mcode/dev
Dev
2 parents 3483b53 + c6e62f5 commit bafc005

File tree

9 files changed

+101
-79
lines changed

9 files changed

+101
-79
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN npm install
88

99
WORKDIR /home/node/app/frontend
1010
RUN npm install
11+
RUN npm run build
1112

1213
WORKDIR /home/node/app
1314

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,35 @@ This application requires node.js v20.0 or greater. Using [`nvm`](https://github
5252

5353
- `nvm install 20`
5454
- `nvm use 20` or `nvm use default 20`, as most of the REMS Integration Prototype repositories are compatible with node v20.0.
55+
56+
# Data Rights
57+
58+
<div style="text-align:center">
59+
<b>NOTICE</b>
60+
</div>
61+
62+
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.
63+
64+
65+
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.
66+
67+
68+
For further information, please contact The MITRE Corporation, Contracts Management Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000.
69+
70+
<div style="text-align:center">
71+
<b>&copy;2025 The MITRE Corporation.</b>
72+
</div>
73+
74+
<br />
75+
76+
Licensed under the Apache License, Version 2.0 (the "License"); use of this repository is permitted in compliance with the License.
77+
You may obtain a copy of the License at
78+
79+
http://www.apache.org/licenses/LICENSE-2.0
80+
81+
Unless required by applicable law or agreed to in writing, software
82+
distributed under the License is distributed on an "AS IS" BASIS,
83+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84+
See the License for the specific language governing permissions and
85+
limitations under the License.
86+

backend/env.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,8 @@
44
"default": 5051
55
},
66
"ALLOWED_ORIGIN": {
7-
"type": "object",
8-
"default": [
9-
"http://localhost:3000",
10-
"http://localhost:3000/",
11-
"http://localhost:3005",
12-
"http://localhost:3005/",
13-
"http://localhost:3008",
14-
"http://localhost:3008/",
15-
"http://localhost:5050",
16-
"http://localhost:5050/",
17-
"http://localhost:4040",
18-
"http://localhost:4040/"
19-
]
7+
"type": "string",
8+
"default": "*"
209
},
2110
"MONGO_USERNAME": {
2211
"type": "string",

backend/src/routes/doctorOrders.js

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -396,51 +396,53 @@ const getDispenseStatus = (order, guidanceResponse) => {
396396
*/
397397
async function parseNCPDPScript(newRx) {
398398
// Parsing XML NCPDP SCRIPT from EHR
399+
const patient = newRx.Message.Body.NewRx.Patient;
400+
const prescriber = newRx.Message.Body.NewRx.Prescriber;
401+
const medicationPrescribed = newRx.Message.Body.NewRx.MedicationPrescribed;
402+
399403
const incompleteOrder = {
400404
orderId: newRx.Message.Header.MessageID.toString(), // Will need to return to this and use actual pt identifier or uuid
401405
caseNumber: newRx.Message.Header.AuthorizationNumber,
402406
prescriberOrderNumber: newRx.Message.Header.PrescriberOrderNumber,
403-
patientName:
404-
newRx.Message.Body.NewRx.Patient.HumanPatient.Name.FirstName +
405-
' ' +
406-
newRx.Message.Body.NewRx.Patient.HumanPatient.Name.LastName,
407-
patientFirstName: newRx.Message.Body.NewRx.Patient.HumanPatient.Name.FirstName,
408-
patientLastName: newRx.Message.Body.NewRx.Patient.HumanPatient.Name.LastName,
409-
patientDOB: newRx.Message.Body.NewRx.Patient.HumanPatient.DateOfBirth.Date,
410-
patientCity: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.City,
411-
patientStateProvince: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.StateProvince,
412-
patientPostalCode: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.PostalCode,
413-
patientCountry: newRx.Message.Body.NewRx.Patient.HumanPatient.Address.Country,
407+
patientName: patient.HumanPatient.Name.FirstName + ' ' + patient.HumanPatient.Name.LastName,
408+
patientFirstName: patient.HumanPatient.Name.FirstName,
409+
patientLastName: patient.HumanPatient.Name.LastName,
410+
patientDOB: patient.HumanPatient.DateOfBirth.Date,
411+
patientCity: patient.HumanPatient.Address.City,
412+
patientStateProvince: patient.HumanPatient.Address.StateProvince,
413+
patientPostalCode: patient.HumanPatient.Address.PostalCode,
414+
patientCountry: patient.HumanPatient.Address.Country,
414415
doctorName:
415416
'Dr. ' +
416-
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.Name.FirstName +
417+
prescriber.NonVeterinarian.Name.FirstName +
417418
' ' +
418-
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.Name.LastName,
419-
doctorContact:
420-
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.CommunicationNumbers.PrimaryTelephone
421-
?.Number,
422-
doctorID: newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.Identification.NPI,
423-
doctorEmail:
424-
newRx.Message.Body.NewRx.Prescriber.NonVeterinarian.CommunicationNumbers.ElectronicMail,
425-
drugNames: newRx.Message.Body.NewRx.MedicationPrescribed.DrugDescription,
426-
simpleDrugName: newRx.Message.Body.NewRx.MedicationPrescribed.DrugDescription.split(' ')[0],
419+
prescriber.NonVeterinarian.Name.LastName,
420+
doctorContact: prescriber.NonVeterinarian.CommunicationNumbers.PrimaryTelephone?.Number,
421+
doctorID: prescriber.NonVeterinarian.Identification.NPI,
422+
doctorEmail: prescriber.NonVeterinarian.CommunicationNumbers.ElectronicMail,
423+
drugNames: medicationPrescribed.DrugDescription,
424+
simpleDrugName: medicationPrescribed.DrugDescription?.split(' ')[0],
427425

428426
drugNdcCode:
429-
newRx.Message.Body.NewRx.MedicationPrescribed.DrugCoded.ProductCode?.Code ||
430-
newRx.Message.Body.NewRx.MedicationPrescribed.DrugCoded.NDC ||
427+
medicationPrescribed.DrugCoded.ProductCode?.Code ||
428+
medicationPrescribed.DrugCoded.NDC ||
431429
null,
432430

433-
drugRxnormCode:
434-
newRx.Message.Body.NewRx.MedicationPrescribed.DrugCoded.DrugDBCode?.Code || null,
431+
drugRxnormCode: medicationPrescribed.DrugCoded.DrugDBCode?.Code || null,
435432

436-
rxDate: newRx.Message.Body.NewRx.MedicationPrescribed.WrittenDate.Date,
433+
rxDate: medicationPrescribed.WrittenDate.Date,
437434
drugPrice: 200, // Add later?
438-
quantities: newRx.Message.Body.NewRx.MedicationPrescribed.Quantity.Value,
435+
quantities: medicationPrescribed.Quantity.Value,
439436
total: 1800,
440437
pickupDate: 'Tue Dec 13 2022', // Add later?
441438
dispenseStatus: 'Pending'
442439
};
443440

441+
if (incompleteOrder.drugNames === undefined || incompleteOrder.drugNames === 'undefined') {
442+
incompleteOrder.drugNames = incompleteOrder.drugNdcCode;
443+
incompleteOrder.simpleDrugName = incompleteOrder.drugNdcCode;
444+
}
445+
444446
const metRequirements = isRemsDrug(incompleteOrder) ? [] : null;
445447
const order = new doctorOrder({ ...incompleteOrder, metRequirements });
446448
return order;

backend/src/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ async function main() {
2121
origin: env.ALLOWED_ORIGIN
2222
};
2323

24+
console.log('CORS OPTIONS: ' + JSON.stringify(options));
25+
2426
app.use(bodyParser.urlencoded({ extended: false }));
2527
app.use(cors(options));
2628
app.use('/doctorOrders', doctorOrders);

dockerRunnerProd.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/sh
22

33
cd frontend
4-
( npm run start ) & SERVER_PID=$!
4+
npm run build
5+
( npm run preview ) & SERVER_PID=$!
56

67
cd ../backend
78
( npm run start ) & BACKEND_SERVER_PID=$!

frontend/package-lock.json

Lines changed: 25 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ axios.defaults.baseURL = process.env.REACT_APP_PIMS_BACKEND_URL
1313
: 'http://localhost:' +
1414
(process.env.REACT_APP_PIMS_BACKEND_PORT ? process.env.REACT_APP_PIMS_BACKEND_PORT : '5051');
1515

16+
const basename = process.env.REACT_APP_VITE_BASE?.replace(/\/$/, '') || '';
17+
1618
function App() {
1719
return (
1820
<Box>
19-
<Router>
21+
<Router basename={basename}>
2022
<div className="App">
2123
<Container className="NavContainer" maxWidth="xl">
2224
<div className="containerg">

frontend/vite.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import dotenv from 'dotenv';
66
dotenv.config({ path: '.env' }); // load env vars from .env
77
export default defineConfig({
88
// depending on your application, base can also be "/"
9-
base: '',
9+
base: process.env.REACT_APP_VITE_BASE || '',
1010
plugins: [react()],
1111
preview: {
12-
allowedHosts: ['.mitre.org', '.us-east-1.elb.amazonaws.com']
12+
allowedHosts: ['.mitre.org', '.elb.us-east-1.amazonaws.com'],
13+
port: parseInt(process.env.PORT!),
14+
host: true
1315
},
1416
define: {
1517
'process.env': process.env
@@ -18,6 +20,6 @@ export default defineConfig({
1820
port: parseInt(process.env.PORT!),
1921
open: false,
2022
host: true,
21-
allowedHosts: ['.mitre.org', '.us-east-1.elb.amazonaws.com']
23+
allowedHosts: ['.mitre.org', '.elb.us-east-1.amazonaws.com']
2224
}
2325
});

0 commit comments

Comments
 (0)