#| label: init
#| include: false

knitr::opts_knit$set(root.dir = getwd())

library(rlang,
        include.only = "%|%")
library(magrittr,
        include.only = c("%>%", "%<>%", "%T>%", "%!>%", "%$%"))

r pal::desc_value("Package")

#| label: pkg-desc
#| results: asis
#| echo: false

pal::cat_lines(paste0("[![CRAN Status](https://r-pkg.org/badges/version/", pal::desc_value(key = "Package"), ")](https://cran.r-project.org/package=",
                      pal::desc_value(key = "Package"), "){.pkgdown-release}"),
               "",
               pal::desc_value("Description"))

Porting all the functionality from the legacy fokus_aargau repository to this R package and the separate fokus_reports Quarto project is still work in progress.

#| label: pkg-doc
#| eval: !expr '!isTRUE(getOption("pal.build_readme.is_pkgdown"))'
#| results: asis
#| echo: false

pkgsnip::md_snip(id = "pkgdown_site") %>%
  paste0("## Documentation\n\n",
         "[![Netlify Status](https://api.netlify.com/api/v1/badges/0cc31095-153a-4d21-bec7-be8dd936ddf1/deploy-status)]",
         "(https://app.netlify.com/sites/fokus-rpkg-dev/deploys)\n\n",
         .) |>
  pal::cat_lines()

Installation

#| label: pkg-instl-dev
#| child: !expr pkgsnip::snip_path("pkg-instl-dev-gitlab.Rmd")
#| label: pkg-usage
#| eval: !expr isTRUE(getOption("pal.build_readme.is_pkgdown"))
#| results: asis
#| echo: false

pkgsnip::md_snip(id = "pkg_usage") %>%
  paste0("## Usage\n\n", .) |>
  pal::cat_lines()

Package configuration

#| label: pkg-config
#| child: !expr pkgsnip::snip_path("pkg-config.Rmd")

Questionnaires

Netlify
Status

Generated survey questionnaires are automatically deployed to qstnr.fokus.ag/{ballot_date}_{canton}.{ext}, where {ext} is one of html, md, csv or xlsx. The following questionnaires are available:

#| label: qstnrs
#| echo: false
#| results: "asis"

fokus::all_ballot_dates |>
  purrr::map_chr(\(ballot_date) {
    fokus::cantons(ballot_date = ballot_date) |>
      purrr::map_chr(\(canton) {
        url_start <- glue::glue(fokus:::url_qstnr[[canton]], "/{ballot_date}_{canton}")
        glue::glue("-   {ballot_date} {stringr::str_to_title(canton)}: ",
                   "[{fontawesome::fa(name = 'fab fa-html5')}]({url_start}.html) | ",
                   "[{fontawesome::fa(name = 'fab fa-markdown')}]({url_start}.md) | ",
                   "[{fontawesome::fa(name = 'fas fa-file-csv')}]({url_start}.csv) | ",
                   "[{fontawesome::fa(name = 'fas fa-file-excel')}]({url_start}.xlsx)")
      }) |>
      paste0(collapse = "\n")
  }) |>
  paste0(collapse = "\n") |>
  cat()

Private FOKUS directory structure

#| label: fokus-private-desc
#| child: "data-raw/snippets/fokus_private_description.Rmd"

Directory structure schema

#| label: fokus-private-schema
#| echo: false
#| results: "asis"

fokus:::print_private_repo_structure()

Development

R Markdown format

#| label: pkgpurl
#| child: !expr pkgsnip::snip_path("pkgpurl.Rmd")

Coding style

#| label: pkg-code-style
#| child: !expr pkgsnip::snip_path("pkg-code-style.Rmd")

Abbreviations

The abbreviations used to name things (function and parameter names etc.) in this package include:

Table of abbreviations

#| label: abbrs
#| echo: false

fokus:::abbrs() |>
  # flatten list col to comma-separted char col in order to avoid weird whitespacing before (some) commas (apparently `pal::pipe_table()` has flaws)
  dplyr::mutate(full_expressions = purrr::map_chr(full_expressions,
                                                  \(x) cli::ansi_collapse(x = x,
                                                                          sep2 = ", ",
                                                                          last = ", "))) |>
  dplyr::rename("Full expression(s)" = full_expressions,
                "Abbreviation" = abbreviation) |>
  pal::pipe_table()



zdaarau/fokus documentation built on Dec. 24, 2024, 10:47 p.m.