Skip to content

Commit

Permalink
Added RxStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyrobin committed Jan 8, 2024
1 parent be412e6 commit 7801ae3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"body-parser-xml": "^2.0.3",
"cors": "^2.8.5",
"express": "^4.18.2",
"fast-xml-parser": "^4.3.2",
"mongoose": "^6.11.4",
"var": "^0.4.0",
"web-vitals": "^2.1.4",
Expand Down
50 changes: 50 additions & 0 deletions backend/src/ncpdpScriptBuilder/buildScript.v2017071.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* NCPDP SCRIPT v2017071 Support */
import { XMLBuilder } from 'fast-xml-parser';

export default function buildRxStatus(caseNumber, doctorName, drugNames) {
var time = new Date();
var rxStatus =
{
"RxStatus": [

Check failure on line 8 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 8 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
{
"Message": [

Check failure on line 10 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 10 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
{
"Header": [

Check failure on line 12 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 12 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
{
"To": doctorName

Check failure on line 14 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 14 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
},
{
"From": "Pharmacy" // Placeholder: This is dependant on individual pharmacy

Check failure on line 17 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 17 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 17 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 17 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
},
{
"Message": "NewRx Request Recieved For: " + drugNames

Check failure on line 20 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 20 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 20 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 20 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
},
{
"RelatesToMessageID": caseNumber // Placeholder: This is dependant on individual pharmacy, using Case Number

Check failure on line 23 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 23 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
},
{
"Time": time

Check failure on line 26 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote

Check failure on line 26 in backend/src/ncpdpScriptBuilder/buildScript.v2017071.js

View workflow job for this annotation

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

Strings must use singlequote
},
]
},
{
"Body": [
{
"Status": [
{
"Code": "200" // Placeholder: This is dependant on individual pharmacy
}
]
}
]
}

]
}
]
};
const builder = new XMLBuilder({ oneListGroup: "true" });
var RxStatus = builder.build(rxStatus);

return RxStatus;
}
9 changes: 8 additions & 1 deletion backend/src/routes/doctorOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import axios from 'axios';
import bodyParser from 'body-parser';
import bpx from 'body-parser-xml';
import env from 'var';
import buildRxStatus from '../ncpdpScriptBuilder/buildScript.v2017071.js';

bpx(bodyParser);
router.use(
bodyParser.xml({
Expand Down Expand Up @@ -47,7 +49,12 @@ router.post('/api/addRx', async (req, res) => {

console.log('POST DoctorOrder: ');
console.log(newOrder);
res.send(newOrder);

var RxStatus = buildRxStatus(newOrder.caseNumber, newOrder.doctorName, newOrder.drugNames);
console.log('RxStatus:');
console.log(RxStatus);

res.send(RxStatus);
});

/**
Expand Down

0 comments on commit 7801ae3

Please sign in to comment.