worldbank / pddcs

pddcs: fetch raw data from different sources and prepare datasets for upload to DCS.
https://worldbank.github.io/pddcs/
Other
1 stars 1 forks source link

Add unicef indicators #20

Closed hkashiwase closed 3 years ago

hkashiwase commented 3 years ago

Dear Aleksander, I have added 4 new UNICEF indicators to "fetch_unicef.R" and "internal_variables.R"(Raw data).
'SP.REG.BRTH.MA.ZS','SP.REG.BRTH.FE.ZS','SP.M18.2024.FE.ZS','SP.M15.2024.FE.ZS'

Could you review the files?

Thanks, Haruna

Aeilert commented 3 years ago

Dear Haruna,

Thank you. This looks good!

I only made some minor additional updates;

  1. In order for fetch_indicator() to work with the new indicators you also need to execute the data-raw/internal-variables.R script. This will update a file called sysdata.rda which contains a list of internal variables / vectors used by the package. (Basically in this case these variables are used to check that the user specifies a valid indicator for the chosen source).
  2. It is also nice to update the indicatorlist of available indicators. This can be done by executing the data-raw/indicatorlist.R script, and also updating the R/data.R documentation file.

See the changes in my commit here.

For future reference the steps I took were:

  1. Run source('data-raw/internal-variables.R')
  2. Run source('data-raw/indicatorlist.R')
  3. Manually edit the R/data.R file
  4. Run devtools::document()
hkashiwase commented 3 years ago

Dear Aleksander,

Thank you very much for your review and comments. As for #2 in your comments, should I update data-raw/internal-variables.R only? I didn't do anything for data-raw/indicatorlist.R, but should I have done something?

May I confirm the process to add new indicators by using UNICEF's example?

  1. Update 2 files: R/fetch_unicef.R and data-raw/internal-variables.R.
  2. Create a branch from a master PDDCS.
  3. Commit and push the updated files
  4. Submit a pull request and assign you as a reviewer.

By the way, I was able to download the new UNICEF indicators! I confirmed that the updated files work well!

I appreciate your advice.

Haruna

Aeilert commented 3 years ago

Dear Haruna,

Glad to hear that you were able to download the new indicators!

Regarding the process:

In order for fetch_indicator() to work when adding new indicators you will need to run the script data-raw/internal-variables.R, in addition to editing the two files R/fetch_unicef.R and data-raw/internal-variables.R.

The package also contains a dataset called indicatorlist, with all the available indicators per source (take a look at data("indicatorlist") and ?indicatorlist). Updating this is not strictly necessary for fetch_indicator() to work, but it is helpful to ensure that all elements of the package are in sync.

The full process then becomes something like this:

  1. Create a branch from a master PDDCS.
  2. Edit the files: R/fetch_unicef.R and data-raw/internal-variables.R.
  3. Run the files data-raw/internal-variables.R and data-raw/indicatorlist.R
  4. Edit R/data.R and run devtools::document()
  5. Commit and push the updated files
  6. Submit a pull request and assign a reviewer.

I already made the necessary changes for this update, but if you follow this list for future changes all aspects should be covered :)

/Aleksander

hkashiwase commented 3 years ago

Dear Aleksander,

Thank you very much for the clarification! This is really helpful. I will follow your instruction when I need to add more indicators.

Many thanks again, Haruna