Skip to content

Commit

Permalink
POC-781: added HPV payload to etl
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqedme committed Jul 18, 2024
1 parent fc3b5f0 commit cb94831
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
34 changes: 21 additions & 13 deletions app/lab-integration/utils/lab-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export class LabClient {
return this.postViralLoad(payload);
case 3:
return this.postCD4(payload);
case 5:
return this.postHPV(payload);
default:
break;
}
Expand All @@ -84,20 +86,26 @@ export class LabClient {
postCD4(payload) {
return this.getPostRequest(payload, `${this.config.serverUrl}/api/cd4`);
}

postHPV(payload) {
return this.getPostRequest(payload, `${this.config.serverUrl}/api/hpv`);
}
getPostRequest(payload, endpoint) {
const options = {
uri: endpoint,
headers: {
apikey: this.config.apiKey,
'Content-Type': 'application/x-www-form-urlencoded'
},
method: 'POST',
// json: true,
form: payload,
timeout: 40000
};
return rp(options);
try {
const options = {
uri: endpoint,
headers: {
apikey: this.config.apiKey,
'Content-Type': 'application/x-www-form-urlencoded'
},
method: 'POST',
// json: true,
form: payload,
timeout: 40000
};
return rp(options);
} catch (error) {
console.log('getPostRequestError', error.message);
}
}

getFetchRequest(filterOptions, offset) {
Expand Down
11 changes: 11 additions & 0 deletions app/lab-integration/utils/poc-eid-payload-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
amrs_location: getLocation(payload, 'mrsId')
};
break;
case 'HPV':
eidPayload = {
test: 5,
mflCode: getLocation(payload, 'mflCode'),
patient_identifier: payload.patientIdentifier,
dob: payload.birthDate,
order_no: payload.orderNumber,
datecollected: payload.dateDrawn,
sex: getGenderCode(payload.sex)
};
break;
case 'DNAPCR':
eidPayload = {
test: 1,
Expand Down

0 comments on commit cb94831

Please sign in to comment.