emodpy_hiv.countries.converting.campaign_sort module#

emodpy_hiv.countries.converting.campaign_sort.compare_intervention_name(iv_config_1: dict, iv_config_2: dict) int[source]#

Compare two intervention names. :returns: -1 if iv_config_1 < iv_config_2, 0 if equal, 1 if iv_config_1 > iv_config_2

emodpy_hiv.countries.converting.campaign_sort.convert_DelayedIntervention(iv_config: dict)[source]#

The old code had HIVDelayedIntervention while the new code uses DelayedIntervention with a nested BroadcastEvent class. This converts the DelayedInterventions to be HIVDelayedIntervention.

emodpy_hiv.countries.converting.campaign_sort.compare_intervention_config(iv_config_1: dict, iv_config_2: dict) int[source]#

Compare two intervention configurations by class name and then intervention name.

emodpy_hiv.countries.converting.campaign_sort.compare_sec(event1: dict, event2: dict) int[source]#

Compares the campaign events for two StandardInterventionDistributionEventCoordinators. First sort on the intervention configuration, but have special handling if both SECs have NLHTIV.

emodpy_hiv.countries.converting.campaign_sort.compare_node_set(node_set_1: dict, node_set_2: dict) int[source]#

Sorting by node id is helpful when everything else is similar.

emodpy_hiv.countries.converting.campaign_sort.compare_nchooser(event1: dict, event2: dict) int[source]#

Compares the campaign events for two NChooserEventCoordinators. First sort on the intervention configuration, then sort on the nodeset configuration. Added this logic because the first campaign file for Zambia had an nchooser handing out MaleCircumcisions but were different for each node. This would get them in order by node.

emodpy_hiv.countries.converting.campaign_sort.compare_tracker(event1: dict, event2: dict) int[source]#

Compares the campaign events for two ReferenceTrackingEventCoordinators. First sort on whether the target gender is different and then sort on the intervention configuration.

emodpy_hiv.countries.converting.campaign_sort.compare_event_coordinator(event1: dict, event2: dict) int[source]#

Compare two campaign events by their coordinator

Returns:

-1 if event1 < event2, 0 if equal, 1 if event1 > event2

emodpy_hiv.countries.converting.campaign_sort.compare_campaign_event(event1: dict, event2: dict) int[source]#

Compare two campaign events

Returns:

-1 if event1 < event2, 0 if equal, 1 if event1 > event2

emodpy_hiv.countries.converting.campaign_sort.sort_names_and_probabilities(iv_config: dict)[source]#

Sorting the names and probabilities makes sure that two campaign files have them in the same order. If the numbers are exactly the same, being in the same order will make it obvious.

emodpy_hiv.countries.converting.campaign_sort.remove_defaults_from_intervention(iv_config: dict)[source]#

Remove default values from the intervention configuration.

emodpy_hiv.countries.converting.campaign_sort.remove_defaults_from_xxx_target_demographic(config: dict)[source]#

Remove the defaults that are common to SEC and NLHTIV

emodpy_hiv.countries.converting.campaign_sort.remove_defaults_from_sec(ec_config: dict)[source]#

Remove default values from the StandardInterventionDistributionEventCoordinator configuration and its associated intervention configurations

emodpy_hiv.countries.converting.campaign_sort.fix_nchooser_number_format(ec_config: dict)[source]#

The Nchoosers used for distributing VMMC had lots of places where it was comparing 15 vs 15.0 or 14.999 vs 14.999999. This made comparisons difficult.

emodpy_hiv.countries.converting.campaign_sort.remove_defaults(campaign_json: dict)[source]#

Remove default values from the campaign JSON. This makes the resulting file smaller, easier to read, and easier to compare with other campaign files.

emodpy_hiv.countries.converting.campaign_sort.sort_campaign(campaign_json: dict)[source]#

Sorts the campaign events in the given campaign JSON. The sorting is done based on the event class, start year, and event coordinator configuration.

emodpy_hiv.countries.converting.campaign_sort.sort_campaign_file(existing_filename: str, new_filename: str | None = None)[source]#

Sorts the campaign events in a given JSON file and writes the sorted events back to a file.