Skip to content

Instantly share code, notes, and snippets.

@MilesMcBain
Created April 10, 2020 11:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save MilesMcBain/0a834f54320dd7e6e4a558589bd920d4 to your computer and use it in GitHub Desktop.
Example drake plan
the_plan <-
drake_plan(
start_date = as_datetime("2018-01-01"),
end_date = as_datetime("2020-01-01") - seconds(1),
permanent_limit = 12 * 60,
auxiliary_limit = 7 * 60,
percentile = 0.9,
# spatial block is H3
h3_resolution = 6,
hexes = get_hexes(h3_resolution),
remoteness_areas = get_remoteness_areas(.filter = list(ste_code16 = 3)),
tagged_hexes = tag_hexes(hexes, remoteness_areas),
stations = get_stations(),
crews = get_crewnum_19(),
hexes_assigned_stations = read_rds(
file_in("//pims/dependencies/hex_assigned_stations.rds")
),
hexes_assigned_crew = assign_crew(hexes_assigned_stations,
crews),
h3_geoscience_res6_source = fetch_geoscience_data(),
h3_geoscience_res6 = read_geoscience_data(h3_geoscience_res6_source),
qld_sa1s = get_qld_sa1s(),
future_pop = get_population_data(),
hex_populations = intersect_population_hexes(future_pop,
qld_sa1s,
hexes),
oms_responses = get_oms_responses(start_date, end_date),
# FIXME: hexify the remoteness areas / create remoteness area clusters from hexes?
# this would enforce each incident falls into the same remoteness area and hex bin
tagged_oms_responses = tag_responses(oms_responses, hexes),
hex_response_times = summarise_hex_response_times(
tagged_oms_responses,
tagged_hexes,
percentile
),
## Structure Fires
hex_summary = summarise_hexes(
hex_response_times,
h3_geoscience_res6,
tagged_oms_responses,
hexes_assigned_crew,
hex_populations
),
hex_predictions = knn_prediction(hex_summary),
report = target(
command = {
rmarkdown::render(knitr_in("doc/analysis.Rmd"))
file_out("doc/analysis.html")
}
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment