Pull Data From ActivityInfo
Details
Note that this function is specific to a specific DB schema - the form to query as well as the columns variable name are hard coded and would need to be adjusted if the DB change
Note also that the function is based on a token stored as an environment variable
# Credentials set up as environment variables -
# token <- "activityinfotoken.." # print(Sys.setenv(ACTIVITYINFOTOKEN = token)) # Sys.getenv("ACTIVITYINFOTOKEN") # rm(token)
Examples
lookup_dfadmin1 <- fct_read_lookup(type = "admin1")
head(lookup_dfadmin1, 10)
#> # A tibble: 10 × 4
#> Country Admin1 ISOCode countryadmin1
#> <chr> <chr> <chr> <chr>
#> 1 Argentina Buenos Aires AR-B Argentina Buenos Aires
#> 2 Argentina Catamarca AR-K Argentina Catamarca
#> 3 Argentina Chaco AR-H Argentina Chaco
#> 4 Argentina Chubut AR-U Argentina Chubut
#> 5 Argentina Ciudad Autonoma de Buenos Aires AR-C Argentina Ciudad Autonoma …
#> 6 Argentina Córdoba AR-X Argentina Córdoba
#> 7 Argentina Corrientes AR-W Argentina Corrientes
#> 8 Argentina Entre Ríos AR-E Argentina Entre Ríos
#> 9 Argentina Formosa AR-P Argentina Formosa
#> 10 Argentina Jujuy AR-Y Argentina Jujuy
lookup_dfadmin2 <- fct_read_lookup(type = "admin2")
head(lookup_dfadmin2, 10)
#> # A tibble: 10 × 4
#> Country Admin1 Admin2 admin1and2
#> <chr> <chr> <chr> <chr>
#> 1 Argentina Buenos Aires 25 de Mayo (Buenos Aires) Buenos Aires 25 de May…
#> 2 Argentina Buenos Aires 9 de Julio (Buenos Aires) Buenos Aires 9 de Juli…
#> 3 Argentina Buenos Aires Adolfo Alsina (Buenos Aires) Buenos Aires Adolfo Al…
#> 4 Argentina Buenos Aires Adolfo Gonzáles Chaves Buenos Aires Adolfo Go…
#> 5 Argentina Buenos Aires Alberti Buenos Aires Alberti
#> 6 Argentina Buenos Aires Almirante Brown (Buenos Aires) Buenos Aires Almirante…
#> 7 Argentina Buenos Aires Arrecifes Buenos Aires Arrecifes
#> 8 Argentina Buenos Aires Avellaneda (Buenos Aires) Buenos Aires Avellaned…
#> 9 Argentina Buenos Aires Ayacucho (Buenos Aires) Buenos Aires Ayacucho …
#> 10 Argentina Buenos Aires Azul Buenos Aires Azul
lookup_dfindicator <- fct_read_lookup(type = "indicator")
head(lookup_dfindicator, 10)
#> # A tibble: 10 × 5
#> CODE Subsector Indicator IndicatorType sectindic
#> <chr> <chr> <chr> <chr> <chr>
#> 1 RE-CP1 Protection (Child Protection) # of refug… Direct Assis… Protecti…
#> 2 RE-CP2 Protection (Child Protection) # of refug… Direct Assis… Protecti…
#> 3 RE-CP3 Protection (Child Protection) # of indiv… Capacity Bui… Protecti…
#> 4 RE-CP4 Protection (Child Protection) # of campa… Campaign Protecti…
#> 5 RE-CSC01 Common Services (Coordination) # of multi… Other Common S…
#> 6 RE-CSCO01 Common Services (Communication) # of impre… Other Common S…
#> 7 RE-CSCO02 Common Services (Communication) # of views… Other Common S…
#> 8 RE-CSCO03 Common Services (Communication) # of commu… Other Common S…
#> 9 RE-CSCO04 Common Services (Communication) # of visit… Other Common S…
#> 10 RE-CSCO05 Common Services (Communication) # of insti… Capacity Bui… Common S…
lookup_dfpartner <- fct_read_lookup(type = "partner")
head(lookup_dfpartner, 10)
#> AOIDORG Name Type RMlead
#> 1 ORG001 100% Diversidad y Derechos NNGO <NA>
#> 2 ORG002 ACAPS INGO <NA>
#> 3 ORG003 ACTED INGO <NA>
#> 4 ORG004 Action against Hunger INGO <NA>
#> 5 ORG005 ActionAid INGO <NA>
#> 6 ORG006 Adventist Development and Relief Agency (ADRA) INGO <NA>
#> 7 ORG007 AID FOR AIDS INGO <NA>
#> 8 ORG008 AIDS Healthcare Foundation (AHF) INGO <NA>
#> 9 ORG009 Alas de Colibrí Foundation NNGO <NA>
#> 10 ORG010 Americares Foundation INGO <NA>