Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AF population groups update for 2021 #42

Closed
2 tasks done
drfaustusfade opened this issue Feb 3, 2021 · 6 comments
Closed
2 tasks done

AF population groups update for 2021 #42

drfaustusfade opened this issue Feb 3, 2021 · 6 comments
Assignees

Comments

@drfaustusfade
Copy link
Owner

drfaustusfade commented Feb 3, 2021

  • to add AF beneficiary types for 2021, using 2020 as a template
  • change year 2020 to 2021 everywhere except WASH
@drfaustusfade
Copy link
Owner Author

drfaustusfade commented Feb 4, 2021

  • draft db queries to update existing 2021 records with _2020 to _2021, except WASH ( including hrp beneficiaries )

@fakhrihawari
Copy link
Collaborator

fakhrihawari commented Feb 4, 2021

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
Copy link
Collaborator

  • 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
Copy link
Owner Author

drfaustusfade commented Feb 4, 2021

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

@fakhrihawari
Copy link
Collaborator

fakhrihawari commented Feb 4, 2021

Link PR: drfaustusfade/ngm-reportHub#92

@fakhrihawari
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants