Skip to content

1028 Reduce export_input_data_county_timeseries #1029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ed96ce6
short test example. Reset later
HenrZu May 8, 2024
92e778b
extrapolate function now shorter
HenrZu May 10, 2024
65ad509
adjust example
HenrZu May 10, 2024
cecee21
[ci skip] set up benchmark example
HenrZu May 10, 2024
c0b43af
load static population data only once
HenrZu Jun 24, 2024
9acb873
[ci skip] tests for secir extrapolation, adapt function extrapolation
HenrZu Jun 25, 2024
7055cfa
Merge branch 'main' into 1028-export_input_data_county_timeseries-ret…
HenrZu Jun 25, 2024
95c3d54
add test data
HenrZu Jun 25, 2024
bbb897d
[ci skip] benchmark example
HenrZu Jun 25, 2024
24e580d
add pop manually to load pop data only once
HenrZu Jun 25, 2024
f8d1391
empty extrapolation function if no hdf5
HenrZu Jun 25, 2024
8ebef3c
fix msvc build
HenrZu Jun 26, 2024
0ebaf1c
seperating reading and processing for pop and case data
HenrZu Jun 26, 2024
ddb1122
size_t -> int
HenrZu Jun 26, 2024
2d75114
secir for num_days + 1. More general naming
HenrZu Jun 26, 2024
09ff7b6
same for secir vvs code
HenrZu Jun 26, 2024
99ea23d
[ci skip] size_t to int cast for msvc
HenrZu Jun 26, 2024
8f37800
reset secir ageres example
HenrZu Jun 27, 2024
92cffab
delete old function
HenrZu Jun 27, 2024
113c024
add more tests for input data with old date
HenrZu Jun 27, 2024
5b81f94
some assertions and test old dates
HenrZu Jun 28, 2024
563965d
mock that export data is called
HenrZu Jun 28, 2024
94771df
rm include
HenrZu Jul 1, 2024
36ce480
include gmock
HenrZu Jul 1, 2024
7c48cd4
rm gmock include
HenrZu Jul 2, 2024
d624fad
comment out mock functions
HenrZu Jul 3, 2024
236b741
remove comments from mock class
HenrZu Jul 3, 2024
a1b0037
just mock_method
HenrZu Jul 3, 2024
411f452
add pointer
HenrZu Jul 3, 2024
9ec9550
overwrite export function
HenrZu Jul 3, 2024
14c63b3
rm comments
HenrZu Jul 3, 2024
2731b39
comment out test function
HenrZu Jul 4, 2024
b896839
comment setup
HenrZu Jul 4, 2024
586454f
comment overwrite function
HenrZu Jul 4, 2024
eb5876c
rm mock test because of msvc
HenrZu Jul 5, 2024
58e7cea
test for set_population_data overflow of vacccinated individuals
HenrZu Jul 5, 2024
5a708e0
one more test with no pop data avail
HenrZu Jul 10, 2024
d899aa9
mainly update documentation
HenrZu Aug 15, 2024
6a3385b
rm accumulate age_groups
HenrZu Aug 16, 2024
75a71af
explicit casting, naming
HenrZu Aug 20, 2024
a43a6ea
rm boolean set_vaccination_data
HenrZu Aug 20, 2024
7976337
Test_F in test secir, log level
HenrZu Aug 21, 2024
ba9442f
test value for elegant
HenrZu Aug 21, 2024
3d1c477
Merge branch 'main' into 1028-export_input_data_county_timeseries-ret…
HenrZu Aug 21, 2024
86203d9
type conversation
HenrZu Aug 28, 2024
1db2103
Update cpp/models/ode_secir/parameters_io.h
HenrZu Sep 3, 2024
0ed1db6
some fixes for doc, [in] and [out], del function interpolate_ages
HenrZu Sep 3, 2024
49de116
additional doc
HenrZu Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 52 additions & 64 deletions cpp/models/ode_secir/parameters_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,15 @@ namespace osecir

namespace details
{
/**
* @brief Interpolates age_ranges to param_ranges and saves ratios in interpolation.
* @param age_ranges Original age ranges of the data.
* @param interpolation Vector of ratios that are aplied to the data of age_ranges.
* @param carry_over Boolean vector which indicates whether there is an overflow from one age group to the next while interpolating data.
*/
void interpolate_ages(const std::vector<double>& age_ranges, std::vector<std::vector<double>>& interpolation,
std::vector<bool>& carry_over);

/**
* @brief reads populations data from RKI.
* @param[in] rki_data Vector of ConfirmedCasesDataEntry%s.
* @param[in] vregion Vector of keys of the region of interest.
* @param[in] year Specifies year at which the data is read.
* @param[in] month Specifies month at which the data is read.
* @param[in] day Specifies day at which the data is read.
* @param[in, out] num_* Output vector for number of people in the corresponding compartement.
* @param[in] t_* vector Average time it takes to get from one compartement to another for each age group.
* @param[in] mu_* vector Probabilities to get from one compartement to another for each age group.
* @param[in] date Date at which the data is read.
* @param[in, out] vnum_* Output vector for number of people in the corresponding compartement.
* @param[in] vt_* vector Average time it takes to get from one compartement to another for each age group.
* @param[in] vmu_* vector Probabilities to get from one compartement to another for each age group.
* @param[in] scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
*/
IOResult<void> read_confirmed_cases_data(
std::vector<ConfirmedCasesDataEntry>& rki_data, std::vector<int> const& vregion, Date date,
Expand Down Expand Up @@ -161,11 +151,11 @@ IOResult<void> set_confirmed_cases_data(std::vector<Model<FP>>& model, std::vect
* @brief Sets the infected population for a given model based on confirmed cases data. Here, we
* read the case data from a file.
* @tparam FP Floating point data type, e.g., double.
* @param model Vector of models for which the confirmed cases data will be set.
* @param path Path to the confirmed cases data file.
* @param region Vector of keys of the region of interest
* @param date Date at which the data is read
* @param scaling_factor_inf Factors by which to scale the confirmed cases of rki data
* @param[in, out] Vector of models for which the confirmed cases data will be set.
* @param[in] path Path to the confirmed cases data file.
* @param[in] region Vector of keys of the region of interest
* @param[in] date Date at which the data is read
* @param[in] scaling_factor_inf Factors by which to scale the confirmed cases of rki data
*/
template <typename FP = double>
IOResult<void> set_confirmed_cases_data(std::vector<Model<FP>>& model, const std::string& path,
Expand All @@ -179,7 +169,7 @@ IOResult<void> set_confirmed_cases_data(std::vector<Model<FP>>& model, const std

/**
* @brief Reads number of ICU patients from DIVI register into Parameters.
* @param path Path to DIVI file.
* @param[out] path Path to DIVI file.
* @param vregion Keys of the region of interest.
* @param year Specifies year at which the data is read.
* @param month Specifies month at which the data is read.
Expand All @@ -192,13 +182,11 @@ IOResult<void> read_divi_data(const std::string& path, const std::vector<int>& v
/**
* @brief Sets populations data from DIVI register into Model.
* @tparam FP floating point data type, e.g., double.
* @param model Vector of models in which the data is set.
* @param path Path to DIVI file.
* @param vregion Vector of keys of the regions of interest.
* @param year Specifies year at which the data is read.
* @param month Specifies month at which the data is read.
* @param day Specifies day at which the data is read.
* @param scaling_factor_icu factor by which to scale the icu cases of divi data.
* @param[in, out] model Vector of models in which the data is set.
* @param[in] path Path to DIVI file.
* @param[in] vregion Vector of keys of the regions of interest.
* @param[in] date Date for which the arrays are initialized.
* @param[in]scaling_factor_icu factor by which to scale the icu cases of divi data.
*/
template <typename FP = double>
IOResult<void> set_divi_data(std::vector<Model<FP>>& model, const std::string& path, const std::vector<int>& vregion,
Expand Down Expand Up @@ -290,16 +278,16 @@ IOResult<void> set_population_data(std::vector<Model<FP>>& model, const std::str
* The initialisation is applied for a predefined number of days and finally saved in a timeseries for each region. In the end,
* we save the files "Results_rki.h5" and "Results_rki_sum.h5" in the results_dir.
* Results_rki.h5 contains a time series for each region and Results_rki_sum.h5 contains the sum of all regions.
* @param models Vector of models in which the data is set. Copy is made to avoid changing the original model.
* @param results_dir Path to result files.
* @param region Vector of keys of the region of interest.
* @param date Date for which the data should be read.
* @param scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param num_days Number of days to be simulated/initialized.
* @param divi_data_path Path to DIVI file.
* @param confirmed_cases_path Path to confirmed cases file.
* @param population_data_path Path to population data file.
* @param[in] models Vector of models in which the data is set. Copy is made to avoid changing the original model.
* @param[in] results_dir Path to result files.
* @param[in] region Vector of keys of the region of interest.
* @param[in] date Date for which the data should be read.
* @param[in] scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param[in] scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param[in] num_days Number of days to be simulated/initialized.
* @param[in] divi_data_path Path to DIVI file.
* @param[in] confirmed_cases_path Path to confirmed cases file.
* @param[in] population_data_path Path to population data file.
*/
template <class Model>
IOResult<void> export_input_data_county_timeseries(
Expand Down Expand Up @@ -358,11 +346,11 @@ export_input_data_county_timeseries(std::vector<Model> models, const std::string

/**
* @brief Reads population data from population files for the whole country.
* @param model Vector of model in which the data is set.
* @param date Date for which the data should be read.
* @param scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param dir Directory of files.
* @param[in, out] model Vector of model in which the data is set.
* @param[in] date Date for which the data should be read.
* @param[in] scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param[in] scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param[in] dir Directory of files.
*/
template <class Model>
IOResult<void> read_input_data_germany(std::vector<Model>& model, Date date,
Expand All @@ -384,12 +372,12 @@ IOResult<void> read_input_data_germany(std::vector<Model>& model, Date date,

/**
* @brief Reads population data from population files for the specefied state.
* @param model Vector of model in which the data is set.
* @param date Date for which the data should be read.
* @param state Vector of region keys of states of interest.
* @param scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param dir Directory of files.
* @param[in, out] model Vector of model in which the data is set.
* @param[in] date Date for which the data should be read.
* @param[in] state Vector of region keys of states of interest.
* @param[in] scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param[in] scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param[in] dir Directory of files.
*/
template <class Model>
IOResult<void> read_input_data_state(std::vector<Model>& model, Date date, std::vector<int>& state,
Expand All @@ -412,14 +400,14 @@ IOResult<void> read_input_data_state(std::vector<Model>& model, Date date, std::

/**
* @brief Reads population data from population files for the specefied county.
* @param model Vector of model in which the data is set.
* @param date Date for which the data should be read.
* @param county Vector of region keys of counties of interest.
* @param scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param dir Directory of files.
* @param num_days [Default: 0] Number of days to be simulated; required to extrapolate real data.
* @param export_time_series [Default: false] If true, reads data for each day of simulation and writes it in the same directory as the input files.
* @param[in, out] model Vector of model in which the data is set.
* @param[in] date Date for which the data should be read.
* @param[in] county Vector of region keys of counties of interest.
* @param[in] scaling_factor_inf Factors by which to scale the confirmed cases of rki data.
* @param[in] scaling_factor_icu Factor by which to scale the icu cases of divi data.
* @param[in] dir Directory of files.
* @param[in] num_days [Default: 0] Number of days to be simulated; required to extrapolate real data.
* @param[in] export_time_series [Default: false] If true, reads data for each day of simulation and writes it in the same directory as the input files.
*/
template <class Model>
IOResult<void> read_input_data_county(std::vector<Model>& model, Date date, const std::vector<int>& county,
Expand Down Expand Up @@ -455,13 +443,13 @@ IOResult<void> read_input_data_county(std::vector<Model>& model, Date date, cons

/**
* @brief reads population data from population files for the specified nodes
* @param model vector of model in which the data is set
* @param date Date for which the data should be read
* @param county vector of region keys of interest
* @param scaling_factor_inf factors by which to scale the confirmed cases of rki data
* @param scaling_factor_icu factor by which to scale the icu cases of divi data
* @param dir directory of files
* @param age_group_names strings specifying age group names
* @param[in, out] model vector of model in which the data is set
* @param[in] date Date for which the data should be read
* @param[in] county vector of region keys of interest
* @param[in] scaling_factor_inf factors by which to scale the confirmed cases of rki data
* @param[in] scaling_factor_icu factor by which to scale the icu cases of divi data
* @param[in] dir directory of files
* @param[in] age_group_names strings specifying age group names
*/
template <class Model>
IOResult<void> read_input_data(std::vector<Model>& model, Date date, const std::vector<int>& node_ids,
Expand Down
Loading
Loading