Skip to content
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

Gce minimum report #10

Closed
wants to merge 13 commits into from
Closed

Gce minimum report #10

wants to merge 13 commits into from

Conversation

confunguido
Copy link
Collaborator

Provides a skeleton for a report. Also includes changes from the pop loader so probably need to land that first.

Copy link
Collaborator

@ChiragKumar9 ChiragKumar9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @confunguido. I have one big comment on the need to use add_periodic_plan_with_phase here to ensure the report is consistently reporting out at the same time. The rest of my comments are mainly stylistic. I did not review the population_loader in this PR since that is the subject elsewhere.


context
.report_options()
.overwrite(true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think whether to overwrite the report or not should be in the input.json. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, we should use command line args instead. i can do tha

pub max_time: f64,
pub seed: u64,
pub r_0: f64,
pub infection_duration: f64,
pub generation_interval: f64,
pub report_period: f64,
pub synth_population_file: String,
pub output_file: String,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about a more descriptive name for this particular report output file (maybe "population_periodic_report"?) since I assume we'll have multiple output files in the future?

});

context.add_report::<PersonReportItem>(&parameters.output_file)?;
context.add_plan(0.0, move |context| {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you need to use the add_periodic_plan_with_phase where phase = ExecutionPhase::Last here. See https://github.com/CDCgov/ixa/blob/c8d9da5c7863e3e233b1531055db34dfdd38f199/examples/time-varying-infection/periodic_report.rs#L59 for an example. This syntax makes periodic reports easier and ensures that the report is telling you the state of the world at the end of a given time!

context
.report_options()
.overwrite(true)
.directory(PathBuf::from(output_dir));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think I would use a clone when feeding in the output_dir to ensure that the value being fed in is a PathBuf. As I understand, this is basically taking a PathBuf, referencing it so it turns into a Path, and then reconverting it to a PathBuf. I wonder if it is just more parsimonious to use args.output_directory.clone() in the arg to this function and make output_dir a PathBuf.

create_report_trait!(PersonReportItem);

fn send_population_report(context: &mut Context, report_period: f64) {
let population_data = context.get_data_container_mut(PopulationReportPlugin);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be get_data_container without the mutable reference instead? That would also prevent the clone in the next line I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

let population_data = context.get_data_container_mut(PopulationReportPlugin);

let current_census_set = population_data.census_tract_set.clone();
for age_it in 0..100 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worthwhile to try to source the age bounds as an input? Potentially from inputs.json (though I really don't love that) but ideally from the population or the synth pop file? Doesn't have to be addressed or discussed now, just thinking about it for more complicated properties.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't be opposed to hard-coding age as MAXAGE or something like that as a static variable. Not sure that it needs to be in the input, but yeah we can discuss for next iteration.

use std::collections::HashSet;

#[derive(Serialize, Deserialize, Clone, PartialEq)]
struct PersonReportItem {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think this should be called PopulationReportItem or something. I also think the columns should be in the order of time, census_tract, age, population based on the way the iteration happens.

person_record: &PeopleRecord,
) -> Result<PersonId, IxaError> {
let tract: usize = String::from_utf8(person_record.homeId[..11].to_owned())
.expect("Home id should have 11 digits for tract + home id")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Home ID should have 15 digits, the census tract itself is 11 digits and home ID subcomponent is four.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would let this to be handled in the population skeleton branch

@confunguido
Copy link
Collaborator Author

Closing to reopen in population skeleton branch

@confunguido confunguido mentioned this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants