@@ -74,7 +74,7 @@ class StringDate : public Date
7474class ConfirmedCasesDataEntry
7575{
7676public:
77- static const std::array <const char *, 6 > age_group_names;
77+ static std::vector <const char *> age_group_names;
7878
7979 double num_confirmed;
8080 double num_recovered;
@@ -223,7 +223,7 @@ IOResult<std::vector<T>> unpack_all(const std::vector<IOResult<T>>& v)
223223class PopulationDataEntry
224224{
225225public:
226- static const std::array <const char *, 11 > age_group_names;
226+ static std::vector <const char *> age_group_names;
227227
228228 CustomIndexArray<double , AgeGroup> population;
229229 boost::optional<regions::StateId> state_id;
@@ -260,8 +260,8 @@ inline void get_rki_age_interpolation_coefficients(const std::vector<double>& ag
260260 std::vector<bool >& carry_over)
261261{
262262 std::array<double , 6 > param_ranges = {5 ., 10 ., 20 ., 25 ., 20 ., 20 .};
263- static_assert (param_ranges.size () == ConfirmedCasesDataEntry::age_group_names.size (),
264- " Number of RKI age groups does not match number of age ranges." );
263+ assert (param_ranges.size () == ConfirmedCasesDataEntry::age_group_names.size () &&
264+ " Number of RKI age groups does not match number of age ranges." );
265265
266266 // counter for parameter age groups
267267 size_t counter = 0 ;
@@ -342,12 +342,19 @@ interpolate_to_rki_age_groups(const std::vector<PopulationDataEntry>& population
342342 * Deserialize population data from a JSON value.
343343 * Age groups are interpolated to RKI age groups.
344344 * @param jsvalue JSON value that contains the population data.
345+ * @param rki_age_groups Specifies whether population data should be interpolated to rki age groups.
345346 * @return list of population data.
346347 */
347- inline IOResult<std::vector<PopulationDataEntry>> deserialize_population_data (const Json::Value& jsvalue)
348+ inline IOResult<std::vector<PopulationDataEntry>> deserialize_population_data (const Json::Value& jsvalue,
349+ bool rki_age_groups = true )
348350{
349351 BOOST_OUTCOME_TRY (population_data, deserialize_json (jsvalue, Tag<std::vector<PopulationDataEntry>>{}));
350- return success (details::interpolate_to_rki_age_groups (population_data));
352+ if (rki_age_groups) {
353+ return success (details::interpolate_to_rki_age_groups (population_data));
354+ }
355+ else {
356+ return success (population_data);
357+ }
351358}
352359
353360/* *
@@ -356,27 +363,46 @@ inline IOResult<std::vector<PopulationDataEntry>> deserialize_population_data(co
356363 * @param filename JSON file that contains the population data.
357364 * @return list of population data.
358365 */
359- inline IOResult<std::vector<PopulationDataEntry>> read_population_data (const std::string& filename)
366+ inline IOResult<std::vector<PopulationDataEntry>> read_population_data (const std::string& filename,
367+ bool rki_age_group = true )
360368{
361369 BOOST_OUTCOME_TRY (jsvalue, read_json (filename));
362- return deserialize_population_data (jsvalue);
370+ return deserialize_population_data (jsvalue, rki_age_group );
363371}
364372
373+ /* *
374+ * @brief Sets the age groups' names for the ConfirmedCasesDataEntry%s.
375+ * @param[in] names age group names
376+ */
377+ IOResult<void > set_confirmed_cases_age_group_names (std::vector<const char *> names);
378+
379+ /* *
380+ * @brief Sets the age groups' names for the PopulationDataEntry%s.
381+ * @param[in] names age group names
382+ */
383+ IOResult<void > set_population_data_age_group_names (std::vector<const char *> names);
384+
385+ /* *
386+ * @brief Sets the age groups' names for the VaccinationDataEntry%s.
387+ * @param[in] names age group names
388+ */
389+ IOResult<void > set_vaccination_data_age_group_names (std::vector<const char *> names);
390+
365391/* *
366392 * @brief returns a vector with the ids of all nodes.
367393 * @param[in] path directory to population data
368394 * @param[in] is_node_for_county boolean specifying whether the nodes should be counties or districts
369395 * @return list of node ids.
370396 */
371- IOResult<std::vector<int >> get_node_ids (const std::string& path, bool is_node_for_county);
397+ IOResult<std::vector<int >> get_node_ids (const std::string& path, bool is_node_for_county, bool rki_age_groups = true );
372398
373399/* *
374400 * Represents an entry in a vaccination data file.
375401 */
376402class VaccinationDataEntry
377403{
378404public:
379- static const std::array <const char *, 6 > age_group_names;
405+ static std::vector <const char *> age_group_names;
380406
381407 double num_vaccinations_completed;
382408 Date date;
0 commit comments