campaign_sort
compare_campaign_event(event1, event2)
Compare two campaign events
Returns:
| Type | Description |
|---|---|
int
|
-1 if event1 < event2, 0 if equal, 1 if event1 > event2 |
Source code in emodpy_hiv/countries/converting/campaign_sort.py
compare_event_coordinator(event1, event2)
Compare two campaign events by their coordinator
Returns:
| Type | Description |
|---|---|
int
|
-1 if event1 < event2, 0 if equal, 1 if event1 > event2 |
Source code in emodpy_hiv/countries/converting/campaign_sort.py
compare_intervention_config(iv_config_1, iv_config_2)
Compare two intervention configurations by class name and then intervention name.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
compare_intervention_name(iv_config_1, iv_config_2)
Compare two intervention names. Returns: -1 if iv_config_1 < iv_config_2, 0 if equal, 1 if iv_config_1 > iv_config_2
Source code in emodpy_hiv/countries/converting/campaign_sort.py
compare_nchooser(event1, event2)
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.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
compare_node_set(node_set_1, node_set_2)
Sorting by node id is helpful when everything else is similar.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
compare_sec(event1, event2)
Compares the campaign events for two StandardInterventionDistributionEventCoordinators. First sort on the intervention configuration, but have special handling if both SECs have NLHTIV.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
compare_tracker(event1, event2)
Compares the campaign events for two ReferenceTrackingEventCoordinators. First sort on whether the target gender is different and then sort on the intervention configuration.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
convert_DelayedIntervention(iv_config)
The old code had HIVDelayedIntervention while the new code uses DelayedIntervention with a nested BroadcastEvent class. This converts the DelayedInterventions to be HIVDelayedIntervention.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
fix_nchooser_number_format(ec_config)
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.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
remove_defaults(campaign_json)
Remove default values from the campaign JSON. This makes the resulting file smaller, easier to read, and easier to compare with other campaign files.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
remove_defaults_from_intervention(iv_config)
Remove default values from the intervention configuration.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
remove_defaults_from_sec(ec_config)
Remove default values from the StandardInterventionDistributionEventCoordinator configuration and its associated intervention configurations
Source code in emodpy_hiv/countries/converting/campaign_sort.py
remove_defaults_from_xxx_target_demographic(config)
Remove the defaults that are common to SEC and NLHTIV
Source code in emodpy_hiv/countries/converting/campaign_sort.py
sort_campaign(campaign_json)
Sorts the campaign events in the given campaign JSON. The sorting is done based on the event class, start year, and event coordinator configuration.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
sort_campaign_file(existing_filename, new_filename=None)
Sorts the campaign events in a given JSON file and writes the sorted events back to a file.
Source code in emodpy_hiv/countries/converting/campaign_sort.py
sort_names_and_probabilities(iv_config)
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.