infosigasp 0.2.0
- Coordinate validation now uses the São Paulo state boundary with a 2 km buffer instead of its rectangular bounding box.
- Documented important changes in source-data coverage and definitions, including that 2015–2018 covers fatal crashes only and that
sinistrosincludes unconfirmed notifications. - Missing
qtd_*counts now remainNAduring cleaning because a blank source value does not establish a zero count. - Simplified the public API around
read_infosiga(),dictionary_infosiga()and cache management; download, update, data-listing, cleaning and label-standardization helpers are internal implementation details. (#20) -
clear_infosiga_cache()andinfosiga_cache_info()remove processed cache entries and report their disk use while keeping operations within the package-managed user cache. -
dictionary_infosiga()now opens the searchable pkgdown data dictionary by default and can point to the official INFOSIGA-SP source withsource = "official". -
read_infosiga()caches the canonical clean result by source checksum and cleaning-schema version, reuses it before applying optional standardizations, and removes obsolete processed artifacts. Setcache = FALSEto bypass the processed cache. -
read_infosiga()now supports explicit"raw","typed"and"clean"processing modes, with"clean"remaining the default. (#22) -
read_infosiga()now supports selective label standardization throughstandardize = "municipios","cores","profissoes"or"all", while preserving source categories that cannot be harmonized safely. (#22) -
read_infosiga()now preserves unexpected categorical, flag and integer representations and emits a warning instead of silently coercing them. (#22) -
read_infosiga()no longer accepts the non-pushdownyearargument; filterano_sinistroafter import when a year subset is needed. (#20)
infosigasp 0.1.0
Initial release.
- Added
read_infosiga(), which downloads (with caching) and imports the three INFOSIGA-SP datasets (sinistros,pessoasandveiculos) as tidy tibbles, handling the source encoding, decimal marks and date formats. - Added
clean_infosiga(), applied by default, which trims text, maps"NAO DISPONIVEL"toNA, makes ordinal columns ordered factors, parses theano_mes_*columns to first-of-monthDates, turns thetp_sinistro_*crash-type flags logical, fills blankqtd_*counts with0inside an otherwise-populated count block, caststempo_sinistro_obitoto integer, strips the spurious".0"onnumero_logradouro, and voids coordinates outside the São Paulo state bounding box. - Added
clean = FALSEtoread_infosiga()for the raw data as published. - Added
tidy_infosiga_labels(), an opt-in second pass that rewrites category labels for analysts who do not need the published categories verbatim: IBGE spellings formunicipioandregiao_administrativa, mergedcor_veiculospellings, Title Casedprofissao, and route codes split out ofconservacaointo a newconservacao_codigocolumn. - Added the
infosiga_municipiosdataset, pairing the official IBGE name and the INFOSIGA-SP spelling of each São Paulo municipality, keyed bycod_ibge. - Added
infosiga_download()to pre-fetch the source archive, falling back to a GitHub-release mirror when the DETRAN-SP endpoint is unavailable; further mirrors go in theinfosigasp.zip_urloption. Responses are checked for the ZIP signature before being cached, so a portal serving an error page under a 200 status falls through to the next mirror instead of poisoning the cache. - Added a warning when
read_infosiga()orinfosiga_download()reuses a cached archive whose data are older than theinfosigasp.stale_daysoption (30 days by default; set toInfto disable), since DETRAN-SP refreshes the data monthly under the same file name. The age is that of the CSVs inside the archive rather than of the downloaded file, and the warning names the date they carry. It describes the local copy only; useinfosiga_check_update()to compare it against a remote source. - Added
infosiga_check_update(), which reports whether the archive published on the package mirror is newer than the cached copy. It reads a small manifest describing the mirrored archive rather than the archive itself. A weekly GitHub Actions job re-fetches the official archive and republishes the mirror whenever its contents change, so the mirror can trail DETRAN-SP by up to a week.infosigasp.manifest_urlaccepts a vector of mirrors tried in order, matchinginfosigasp.zip_url. - Added
infosiga_cache_dir(),infosiga_cache_list()andinfosiga_cache_clear()to manage the on-disk cache. - Added
infosiga_datasets(), which lists the available datasets and their keys, andinfosiga_dictionary(), which downloads the official data dictionary.infosigasp.dictionary_urlaccepts a vector of mirrors tried in order, matchinginfosigasp.zip_url. - Added a package hex logo drawn from the major road network of the São Paulo Metropolitan Region in the INFOSIGA-SP dark blue (
data-raw/logo.R).
