Skip to content

Commit

Permalink
Merge pull request #1284 from ajay-beehyv/2.1.3-generic
Browse files Browse the repository at this point in the history
2.1.3-generic
  • Loading branch information
prasanna-egov authored Oct 14, 2022
2 parents a923e08 + dc8ca3b commit 1fb66a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions backend/certificate_api/src/services/certificate_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ const convertCertificateToDCCPayload = async(certificateRaw, nameDetails) => {
throw new Error("EU Vaccine Details are missing from Configuration");
}
const {credentialSubject, evidence} = certificate;
const manufacturerCode = Object.keys(VACCINE_MANUF).filter(a => evidence[0].manufacturer?.toLowerCase().includes(a)).length > 0 ?
Object.entries(VACCINE_MANUF).filter(([k, v]) => evidence[0].manufacturer?.toLowerCase().includes(k))[0][1] : "";
const prophylaxisCode = Object.keys(EU_VACCINE_PROPH).filter(a => evidence[0].vaccine.toLowerCase().includes(a)).length > 0 ?
Object.entries(EU_VACCINE_PROPH).filter(([k, v]) => evidence[0].vaccine.toLowerCase().includes(k))[0][1] : "";
const vaccineCode = Object.keys(EU_VACCINE_CODE).filter(a => evidence[0].vaccine.toLowerCase().includes(a)).length > 0 ?
Object.entries(EU_VACCINE_CODE).filter(([k, v]) => evidence[0].vaccine.toLowerCase().includes(k))[0][1] : "";
const manufacturerCode = Object.keys(VACCINE_MANUF).filter(a => evidence[0].manufacturer?.toLowerCase().replace(/\s/g, "").includes(a.toLowerCase().replace(/\s/g, ""))).length > 0 ?
Object.entries(VACCINE_MANUF).filter(([k, v]) => evidence[0].manufacturer?.toLowerCase().replace(/\s/g, "").includes(k.toLowerCase().replace(/\s/g, "")))[0][1] : "";
const prophylaxisCode = Object.keys(EU_VACCINE_PROPH).filter(a => evidence[0].vaccine.toLowerCase().replace(/\s/g, "").includes(a.toLowerCase().replace(/\s/g, ""))).length > 0 ?
Object.entries(EU_VACCINE_PROPH).filter(([k, v]) => evidence[0].vaccine.toLowerCase().replace(/\s/g, "").includes(k.toLowerCase().replace(/\s/g, "")))[0][1] : "";
const vaccineCode = Object.keys(EU_VACCINE_CODE).filter(a => evidence[0].vaccine.toLowerCase().replace(/\s/g, "").includes(a.toLowerCase().replace(/\s/g, ""))).length > 0 ?
Object.entries(EU_VACCINE_CODE).filter(([k, v]) => evidence[0].vaccine.toLowerCase().replace(/\s/g, "").includes(k.toLowerCase().replace(/\s/g, "")))[0][1] : "";
const addressCountry = getAlpha2CodeForCountry(evidence[0].facility.address.addressCountry)
const certificateId = "URN:UVCI:01:" + addressCountry + ":" + evidence[0].certificateId;

Expand Down
2 changes: 1 addition & 1 deletion backend/certificate_signer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function transformW3(cert, certificateID) {
const recipientName = R.pathOr('', ['recipient', 'name'], cert);
const recipientDob = dobOfRecipient(cert.recipient);
const vaccine = R.pathOr('', ['vaccination', 'name'], cert);
const icd11Code = vaccine ? VACCINE_ICD11_MAPPINGS.filter(a => vaccine.toLowerCase().includes(a.vaccineName)).map(a => a.icd11Code)[0]: '';
const icd11Code = vaccine ? VACCINE_ICD11_MAPPINGS.filter(a => vaccine.toLowerCase().replace(/\s/g, "").includes(a.vaccineName.toLowerCase().replace(/\s/g, ""))).map(a => a.icd11Code)[0]: '';
const prophylaxis = icd11Code ? ICD11_MAPPINGS[icd11Code]["icd11Term"]: '';
const batch = R.pathOr('', ['vaccination', 'batch'], cert);
const vaccinationDate = R.pathOr('', ['vaccination', 'date'], cert);
Expand Down

0 comments on commit 1fb66a5

Please sign in to comment.