Catalogue des données ouvertes de la Ville de Paris

Données - Ville de Paris

Code
source(here::here("_rinit.R"))
source(here::here("code", "basic_functions.R"))   # related_data()
invisible(Sys.setlocale("LC_TIME", "fr_FR.UTF-8"))
here::i_am("data/paris/catalogue.qmd")
# cd ~/iCloud/website/data/paris; Rscript _catalogue.R
# cd ~/iCloud/website/data/paris; /usr/local/bin/R -e 'quarto::quarto_render("catalogue.qmd")'

cat_df <- readr::read_csv(here::here("data", "paris", "catalogue.csv"),
                          show_col_types = FALSE)

Les 490 jeux de données publiés sur opendata.paris.fr, récupérés via l’API Opendatasoft Explore (/api/explore/v2.1/catalog/)

Tous les jeux de données

Liste

Code
cat_df |>
  dplyr::transmute(
    Code = sprintf('<a href="https://opendata.paris.fr/explore/dataset/%s/information/" target="_blank">%s</a>',
                   id, id),
    Titre = titre
  ) |>
  reactable::reactable(
    searchable = TRUE,
    pagination = TRUE,
    defaultPageSize = 25,
    showPageSizeOptions = TRUE,
    pageSizeOptions = c(10, 25, 50, 100),
    compact = TRUE,
    resizable = TRUE,
    highlight = TRUE,
    wrap = TRUE,
    defaultColDef = reactable::colDef(
      align = "left",
      headerStyle = list(fontWeight = "bold"),
      style = list(whiteSpace = "normal", wordBreak = "break-word")
    ),
    columns = list(
      Code  = reactable::colDef(html = TRUE, minWidth = 160, maxWidth = 320),
      Titre = reactable::colDef(minWidth = 200)
    )
  )

Détails

Tableau cherchable : recherche plein texte, filtres par colonne sous chaque en-tête, tri en cliquant sur l’en-tête.

Code
cat_df |>
  dplyr::transmute(
    Titre = sprintf('<a href="https://opendata.paris.fr/explore/dataset/%s/" target="_blank">%s</a>',
                    id, titre),
    `Thème` = theme,
    `Mots-clés` = mots_cles,
    Producteur = producteur,
    `Fréquence` = frequence,
    Modifié = modifie,
    Lignes = lignes
  ) |>
  reactable::reactable(
    searchable = TRUE,
    filterable = TRUE,
    pagination = TRUE,
    defaultPageSize = 25,
    showPageSizeOptions = TRUE,
    pageSizeOptions = c(10, 25, 50, 100),
    defaultSorted = list(Modifié = "desc"),
    compact = TRUE,
    resizable = TRUE,
    highlight = TRUE,
    wrap = TRUE,
    defaultColDef = reactable::colDef(
      align = "left",
      headerStyle = list(fontWeight = "bold"),
      style = list(whiteSpace = "normal", wordBreak = "break-word")
    ),
    columns = list(
      Titre = reactable::colDef(html = TRUE, minWidth = 220),
      `Thème` = reactable::colDef(minWidth = 140, maxWidth = 220),
      `Mots-clés` = reactable::colDef(
        minWidth = 180,
        cell = function(value) {
          if (is.na(value)) return("")
          if (nchar(value) > 60) paste0(substr(value, 1, 60), "…") else value
        }
      ),
      Producteur = reactable::colDef(minWidth = 160),
      `Fréquence` = reactable::colDef(minWidth = 90, maxWidth = 120),
      Modifié = reactable::colDef(minWidth = 90, maxWidth = 110, align = "right"),
      Lignes = reactable::colDef(minWidth = 70, maxWidth = 100, align = "right",
                                 format = reactable::colFormat(separators = TRUE))
    )
  )

Interroger l’API directement

  • Catalogue JSON : https://opendata.paris.fr/api/explore/v2.1/catalog/datasets?limit=100
  • Export du catalogue (CSV / JSON) : https://opendata.paris.fr/api/explore/v2.1/catalog/exports/csv
  • Un jeu de données : https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/<id>/records?limit=100
  • Export d’un jeu (CSV, JSON, Parquet, GeoJSON…) : https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/<id>/exports/parquet
  • Documentation : help.opendatasoft.com

Voir aussi