cynkra / munch Goto Github PK
View Code? Open in Web Editor NEWFunctions for working with the historicized list of communes of Switzerland.
Home Page: https://munch.cynkra.com
Functions for working with the historicized list of communes of Switzerland.
Home Page: https://munch.cynkra.com
Was possible in the original code, we should be able to adapt here. Leads to somewhat more matching tables.
Not sure, but maybe we could use {dplyr} instead of {plyr} and {kimisc}?
We're looking only for internal consistency here -- within the mapping tables. Consistency with external data is important too, but a different issue.
becocmes -> becomes
with a graph widget or a sankey? Could be useful for #30.
needs to be activated
Provide helpers to conveniently import matching tables into a database.
sum
)Also check how zazuko is doing it. Old way: zazuko/fso-lod@e8f08de, maybe this has improved by now?
or of all mutation events in a time range. Could make use of #35.
Useful for cross-checking with the official SFSO communication.
Generates a lookup table for the mapping of the municipality id's which were involved in the time series between year_from and year_to.
mID_to can be a vector of mID's.
output columns: mID_from, name_from, mID_to, name_to, year_from, population, area
In an rmarkdown document, indicating for which cantons for which years we need to expect problems.
See script/analyze.R
for a start.
Only relevant if we ever need to match data prior to 2006.
https://doodles.mountainmath.ca/blog/2020/11/10/tongfen/
Solves this problem for arbitrary geometries.
Apparently, US and Canada have "correspondence files". Is this similar to our historicized municipality list?
We should strive towards working with the dates as provided by the data, and not combine to years. (I remember adding an issue but can't find it now.)
Now the parameter municipalityIds
is gone.
Could be optimized.
write_all_mapping_tables() determines the latest target year by:
MAX_YEAR <- lubridate::year(
max(swc_get_municipality_mutations()$mAbolitionDate, na.rm = TRUE)
) + 1L
which means in case the last abolition happened during the current year, the target year will be 1 year in the future.
I would suggest
lubridate::year(
max(swc_get_municipality_mutations()$mAdmissionDate, na.rm = TRUE)
)
Gets the municipalities-inventory of a certain year.
Discussion:
Could this be character encoding problems? Switching to testthat 3rd edition should show the difference.
https://github.com/cynkra/munch/pull/44/checks?check_run_id=2236574313
Via #22.
I changed cantons
to get_cantons()
, need to clean up.
upgrade.yaml
in RSQLiteAllows to aggregate time series to the specified year_to municipality data.
Options for summarize_fun: sum, mean, median, min, max, ...
Options for weight: NULL, population, area
Output: tibble with columns: year, value
Discussion: Add weight to output? (how much did each municipality contribute to the output value)
e.g. additional column weight_info:
"3 municipalities: 20%, 30%, 50%"
It downloads the data for 2019-01-01 hardcoded. We have new functions for the intended purpose.
and other legacy code, convert to dplyr.
Needs #31.
Would be useful to have for testing if the deduction of the inventory from the manipulations achieves the correct result.
in inst
directory, recreated by the pkgdown.yaml
workflow. The data.Rmd
vignette should link to those files.
Rationale: putting stuff into ../docs
no longer works when rendering a pkgdown vignette.
As it turns out, our mapping tables include the only land-area which is not part of a municipality ("Staatswald Galm", BFSNr: 2391) and five "Kommunanzen", which belong to more than one municipality. Two of the latter still exist.
I don't think that's necessarily wrong, it's just something to be aware of.
Possibly we should mention it in the documentation.
E.g. in the downloaded BFS data (load_bfs_mun_list()
) these areas do not appear among the municipalities.
More details in https://github.com/cynkra/munch/blob/f-31-tests/tests/testthat/test-external-consistency.R
renv::consent()
)httr::HEAD()
to check if the cache is up to dateshould be possible for each year
Let's start with a few known output tests for select municipalities, and also error behavior.
Read from GitHub and cache locally, update on demand, issue a HEAD()
request to check if data has changed.
Running swc_get_mun_merges(2019, canton = "AG")
into the console does not return a data.frame or a tibble, conversely to what happens with:
tibble::as_tibble(swc_get_mun_merges(2019, canton = "AG"))
as.data.frame(swc_get_mun_merges(2019, canton = "AG"))
This behaviour is not aligned with those provided by other functions, such as swc_get_mutations()
or swc_get_merger_mapping_table()
In particular to list
development:
mode: auto
as well as the pkgdown website URL.
Can we add Tobias as contributor since we want to work together on this project, or should we fork the repo?
Function to get all historical municipality id's between year_from and year_to, for a municipality id valid in year_to.
is rather terse right now, we need much more. With examples and perhaps a walkthrough.
This way I can push my docs- branch @krlmlr
swc_()
prefixA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.