Parcourir la source

move data collection into subfolder

main
Garrick Aden-Buie il y a 2 ans
Parent
révision
70369dd98b
Aucune clé connue n'a été trouvée dans la base pour cette signature
13 fichiers modifiés avec 13 ajouts et 10 suppressions
  1. +3
    -2
      .gitignore
  2. +4
    -4
      collect/DESCRIPTION
  3. +0
    -0
      collect/R/get.R
  4. +6
    -4
      collect/R/read_report_file.R
  5. +0
    -0
      collect/R/urls.R
  6. +0
    -0
      collect/R/utils-delay.R
  7. +0
    -0
      collect/README.Rmd
  8. +0
    -0
      collect/_targets.R
  9. +0
    -0
      collect/_targets/.gitignore
  10. +0
    -0
      collect/_targets/meta/meta
  11. +0
    -0
      collect/nc-campaign-finance_collect.Rproj
  12. +0
    -0
      collect/run.R
  13. +0
    -0
      collect/scripts/2023-09-24_organize-data-raw-into-subfolders.R

+ 3
- 2
.gitignore Voir le fichier

@@ -4,5 +4,6 @@
.Rdata
.history
0-time-log.csv
data-raw/
data/
data-raw
collect/data-raw/
collect/data-old/

DESCRIPTION → collect/DESCRIPTION Voir le fichier

@@ -1,12 +1,12 @@
Type: Project
Package: nc-campaign-finance
Title: What the Package Does (One Line, Title Case)
Package: nc-campaign-finance-collect
Title: Collect NC Campaign Finance Data
Version: 0.0.0.9000
Authors@R:
person("Garrick", "Aden-Buie", , "garrick@adenbuie.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7111-0077"))
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Description: Collect campaign finance data from the NC State Board of Elections.
License: None
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3

R/get.R → collect/R/get.R Voir le fichier


R/read_report_file.R → collect/R/read_report_file.R Voir le fichier

@@ -52,13 +52,12 @@ read_report_section <- function(section, info, report_path) {

read_reports_by_sboe_id <- function(sboe_id) {
raw_paths <- fs::dir_ls(
here::here("data-raw", "reports", sboe_id),
here::here("data-raw", "reports", sboe_id, "all"),
glob = "*.txt"
)
names(raw_paths) <- fs::path_rel(raw_paths, here::here("data-raw", "reports"))

data <-
raw_paths |>
raw_paths |>
map(read_report_file) |>
transpose() |>
map(list_rbind) |>
@@ -101,11 +100,14 @@ write_reports_by_sboe_id <- function(sboe_id) {
}

report_path_info <- function(report_path) {
# data-raw/reports/{sboe_id}/all/{report_id}_{received_date}.txt
report_path <- fs::path_abs(report_path)
x <- fs::path_rel(report_path, here::here("data-raw", "reports"))
x <- fs::path_split(x)[[1]]

id <- strsplit(x[2], "_")[[1]][1]
# x[2] is "all"

id <- strsplit(x[3], "_")[[1]][1]

list(
sboe_id = x[1],

R/urls.R → collect/R/urls.R Voir le fichier


R/utils-delay.R → collect/R/utils-delay.R Voir le fichier


README.Rmd → collect/README.Rmd Voir le fichier


_targets.R → collect/_targets.R Voir le fichier


_targets/.gitignore → collect/_targets/.gitignore Voir le fichier


_targets/meta/meta → collect/_targets/meta/meta Voir le fichier


nc-campaign-finance.Rproj → collect/nc-campaign-finance_collect.Rproj Voir le fichier


run.R → collect/run.R Voir le fichier


scripts/2023-09-24_organize-data-raw-into-subfolders.R → collect/scripts/2023-09-24_organize-data-raw-into-subfolders.R Voir le fichier


Chargement…
Annuler
Enregistrer