misocialr 0.4.0
-
Paging by
cursorMark. Pages are read by the sort key (id), not by position: documents added or removed while reading no longer shift the pages. Checked live: the same 185 documents for PE in 2024-01 as paging bystart. The checks for a stable total, no repeatedidand nothing missing remain. -
Nature of each field in the dictionary (
nature,nature_basisinmds_fields()):estoque,fluxo,fluxo anual,acumulado,taxa,médiaoríndice, with the rule for summing across municipalities and months in the help page. 18 fields were measured on the monthly series (PE, 2024-10 to 2025-12), 33 follow a measured field of the same group and 81 come from the label and unit. - Corrected label: the Fomento Rural field
..._ano_fequals the monthly one in 14,755 of 14,755 municipality-month pairs (Brazil, 2013–2026); it is the longest monthly series, not a yearly total. -
options(misocialr.cache_ttl = seconds): optional cache validity (the default remains the session). - DESCRIPTION:
cli (>= 3.6.1)anddplyr (>= 1.1.1)— the declared minimum versions were not usable together today:testthat3.2.1 requirescli >= 3.6.1, anddplyr1.1.0 calls the vctrs C routinevec_is_vector, removed in vctrs 0.7.0 (checked in the CI job that installs the minimum versions).
misocialr 0.3.1
Fixes from the final report on 0.3.0 and the parallel verification.
- Queries by POST. With many months, fields and codes, the GET URL exceeded the server limit (HTTP 414, reproduced with 35 fields, 288 months and 200 municipalities). The query now goes in the body; the same query returned 136,989 rows.
-
mds_drop_unpublished(action = "flag")keeps the three classification columns also on an empty table (F2); a datetimetodayis read as a date; the period follows the same calendar rule as documents and facets. - Non-finite values (
"NaN","Inf","1e999") are a response error; in deduplication, a missing value never replaces a known one, in any order (F4). - Documents and facets with a month outside 01–12, facets with a repeated month, documents beyond
numFoundand incoherent facets (n_nonzerolarger thann_localities, with a fresh read of the pair before the error) are errors and do not enter the cache (F5). - A body that is not JSON is a
misocialr_error_response, with the original error inparent(F6). -
Retry-Aftercapped at 30 s per attempt and 120 s in total;options(misocialr.retry_backoff = ). Retries tested against a real local HTTP server (webfakes). -
parse_periods(): years from 2000 to the year after the current one. -
parse_localities():statesalways character; round numeric codes without scientific notation in messages. - Behaviour cases shared with the Python package (
tests/testthat/paridade/casos.json). -
LICENSE.mdwith the full MIT text;data-raw/record_fixtures.Rvalidates each recorded response and restores the previous fixtures if the replacement fails. - Suggests:
jsonlite,webfakes.
misocialr 0.3.0
Fixes from the in-depth analysis of 0.2.1.
- Single response contract (
check_response()): a partial result, aresponseHeader$statusother than 0, an invalidnumFoundand missingdocsorfacet_countsare errors, including inmds_periods(),mds_localities()and the field check. Only complete responses enter the cache (B1, B2, B8). -
mds_localities()pages, checks codes and repetitions and gainsperiodandrefresh(B2). -
mds_drop_unpublished()never removes a non-zero value: a contradictory national reference is queried again and, if still contradictory, the month is kept with a warning (B3). The period is normalised and checked as month 01 to 12, including factor and numeric (B6);field,todayand infinite values are validated; a missing value is never treated as zero (B7). Newaction = "flag"(M2). - A document without a valid
codigo_ibgeoranomes_sis an error (B4); a non-scalar value is an error, without flattening lists (B5); two different values for the same key are a conflict error (B4). A requested municipality inside a requested state is not queried twice. - Paging: a
numFoundthat changes between pages and a repeatedidare errors (M5). -
mds_periods()sums facets of disjoint blocks of up to 200 codes (M4) and gainsrefresh; canonical cache keys (M1). - Classed errors (
misocialr_error_validation,_response,_conflict,_http), withstatusandparenton the HTTP error; retry on connection failure; version in the user agent;options(misocialr.quiet = TRUE)(M8). -
storage_typeinmds_fields()andmds_api_fields(); unit"unknown"for_sand fields without suffix (M3). - Local field validation even with
validate = FALSE(M7); warning for a municipality without documents (M9);ibge_code7()computes each code once (M6). - DESCRIPTION:
httr2 (>= 1.0.4),testthat (>= 3.2.1)(B9). -
data-raw/record_fixtures.Rrecords into a temporary folder and only replaces the fixtures after checking the result, keeping a copy inapi.bak/(B10). - CI workflows in
.github/workflows/(M10).
misocialr 0.2.1
Fixes from the external review of 0.2.0.
- An empty,
NAor empty-string locality is an error; it used to become a query for the whole of Brazil. - Every locality is validated, even next to
"BR". - A 7-digit code with a wrong check digit is an error; the last digit used to be dropped (
2611600queried Recife). - An empty,
NA, non-integer or negative period mixed with others is an error. - A text field is an error (
regiao); its values used to becomeNAand vanish. Identification fields (municipio,anomes_s…) cannot be requested as a measure. - An empty page before
numFound, a partial Solr result and a response withoutresponseare errors; reading used to finish with missing data. -
mds_api_fields()pages through the whole history (previously up to 1,000 documents) and returns an empty table, with a warning, for a municipality without documents. -
mds_drop_unpublished()validatesperiodandvalueand gainsreference = "brazil", which decides by the whole country. -
options(misocialr.timeout = )andattr(x, "retrieved_at"). - Shortcuts with
fields = NULL, as in Python;mds_themes()help page with the seven shortcuts. - DESCRIPTION:
dplyr (>= 1.1.0)andpurrr (>= 1.0.0). - Errors from
mds_data()reach the user without purrr’s “In index: 1” wrapper.
misocialr 0.2.0
- Four new themes, with shortcuts:
mds_suas_rede(),mds_suas_financiamento(),mds_pbf_condicionalidades()andmds_seguranca_alimentar(). The dictionary grows from 35 to 130 fields. - The Bolsa Família quilombola and homeless fields leave the dictionary: the API returns the same value in both fields in every municipality and month.
- A field may belong to more than one theme (CRAS and CREAS).
- Fields with the
_lsuffix (long integer) now have unitcount.
misocialr 0.1.0
- First version:
mds_data(), shortcutsmds_cadunico(),mds_bolsa_familia()andmds_bpc_suas(); discovery withmds_themes(),mds_fields(),mds_api_fields(),mds_periods()andmds_localities();mds_drop_unpublished(),ibge_code7()andmds_clear_cache().