drfaustusfade / ngm-reportDesk

The workdesk for ReportHub
0 stars 1 forks source link

AF population groups update for 2021 #42

Closed drfaustusfade closed 3 years ago

drfaustusfade commented 3 years ago
drfaustusfade commented 3 years ago
fakhrihawari commented 3 years ago

Draft

db.beneficiaries.find({"beneficiary_type_id":{$regex : ".*2020.*"},"cluster":{$ne:"WASH"},"admin0pcode":"AF","report_year":2021}).forEach(function(r){
r.beneficiary_type_id = r.beneficiary_type_id.replace("2020", "2021"); 
r.beneficiary_type_name = r.beneficiary_type_name.replace("2020","2021");
db.beneficiaries.save(r);
});

db.beneficiaries.find({"hrp_beneficiary_type_id":{$regex : ".*2020.*"},"cluster":{$ne:"WASH"},"admin0pcode":"AF","report_year":2021}).forEach(function(r){
r.hrp_beneficiary_type_id = r.hrp_beneficiary_type_id.replace("2020", "2021");
 r.hrp_beneficiary_type_name = r.hrp_beneficiary_type_name.replace("2020","2021");
db.beneficiaries.save(r);
});
db.beneficiaries.find({"beneficiary_type_name":{$regex : ".*2020.*"},"cluster_id":"protection","admin0pcode":"AF","report_year":2021}).forEach(function(r){
if (r.beneficiary_type_name === "Internally Displaced in 2020 (Conflict or Natural Disaster)") { r.beneficiary_type_name = "Internally Displaced (Conflict or Natural Disaster)"};
if (r.beneficiary_type_name === "Shock-Affected Non-Displaced in 2020 (Conflict or Natural Disaster)") { r.beneficiary_type_name = "Shock-Affected Non-Displaced (Conflict or Natural Disaster)"};
if (r.beneficiary_type_name === "Undocumented Returnees in 2020 - at border or in encashment centres") { r.beneficiary_type_name = "Undocumented Returnees at border or in encashment centres"};
if (r.beneficiary_type_name === "Undocumented Returnees in 2020 - in their place of return") { r.beneficiary_type_name = "Undocumented Returnees in their place of return"};
if (r.beneficiary_type_name === "Refugee Returnees in 2020 - at border or in encashment centres") { r.beneficiary_type_name = "Refugee Returnees at border or in encashment centres"};
if (r.beneficiary_type_name === "Refugee Returnees in 2020 - in their place of return") { r.beneficiary_type_name = "Refugee Returnees in their place of return"};
db.beneficiaries.save(r);
})
fakhrihawari commented 3 years ago
  • [ ] to add AF beneficiary types for 2021, using 2020 as a template
  • [ ] change year 2020 to 2021 everywhere except WASH

i check in the code beneficiary types alrready 2021

drfaustusfade commented 3 years ago

for protection, they opted to remove year at all, please update query to incorporate that change

fakhrihawari commented 3 years ago

Link PR: https://github.com/drfaustusfade/ngm-reportHub/pull/92

fakhrihawari commented 3 years ago

Draft

db.beneficiaries.find({"beneficiary_type_id":{$regex : ".*2020.*"},"cluster":{$ne:"WASH"},"admin0pcode":"AF","report_year":2021}).forEach(function(r){
r.beneficiary_type_id = r.beneficiary_type_id.replace("2020", "2021"); 
r.beneficiary_type_name = r.beneficiary_type_name.replace("2020","2021");
db.beneficiaries.save(r);
});

db.beneficiaries.find({"hrp_beneficiary_type_id":{$regex : ".*2020.*"},"cluster":{$ne:"WASH"},"admin0pcode":"AF","report_year":2021}).forEach(function(r){
r.hrp_beneficiary_type_id = r.hrp_beneficiary_type_id.replace("2020", "2021");
 r.hrp_beneficiary_type_name = r.hrp_beneficiary_type_name.replace("2020","2021");
db.beneficiaries.save(r);
});
db.beneficiaries.find({"beneficiary_type_name":{$regex : ".*2020.*"},"cluster_id":"protection","admin0pcode":"AF","report_year":2021}).forEach(function(r){
if (r.beneficiary_type_name === "Internally Displaced in 2020 (Conflict or Natural Disaster)") { r.beneficiary_type_name = "Internally Displaced (Conflict or Natural Disaster)"};
if (r.beneficiary_type_name === "Shock-Affected Non-Displaced in 2020 (Conflict or Natural Disaster)") { r.beneficiary_type_name = "Shock-Affected Non-Displaced (Conflict or Natural Disaster)"};
if (r.beneficiary_type_name === "Undocumented Returnees in 2020 - at border or in encashment centres") { r.beneficiary_type_name = "Undocumented Returnees at border or in encashment centres"};
if (r.beneficiary_type_name === "Undocumented Returnees in 2020 - in their place of return") { r.beneficiary_type_name = "Undocumented Returnees in their place of return"};
if (r.beneficiary_type_name === "Refugee Returnees in 2020 - at border or in encashment centres") { r.beneficiary_type_name = "Refugee Returnees at border or in encashment centres"};
if (r.beneficiary_type_name === "Refugee Returnees in 2020 - in their place of return") { r.beneficiary_type_name = "Refugee Returnees in their place of return"};
db.beneficiaries.save(r);
})

updated draft for protection case