augur.curate.apply_geolocation_rules moduleο
Applies user curated geolocation rules to the geolocation fields.
- exception augur.curate.apply_geolocation_rules.CyclicGeolocationRulesErrorο
Bases:
AugurError
- augur.curate.apply_geolocation_rules.get_annotated_geolocation(geolocation_rules, raw_geolocation, rule_traversal=None)ο
Gets the annotated geolocation for the raw_geolocation in the provided geolocation_rules.
Recursively traverses the geolocation_rules until we get the annotated geolocation, which must be a Tuple. Returns None if there are no applicable rules for the provided raw_geolocation.
Rules are applied in the order of region, country, division, location. First checks the provided raw values for geolocation fields, then if there are not matches, tries to use general rules marked with β*β.
- augur.curate.apply_geolocation_rules.load_geolocation_rules(geolocation_rules_file)ο
Loads the geolocation rules from the provided geolocation_rules_file. Returns the rules as a dict:
{ regions: { countries: { divisions: { locations: corrected_geolocations_tuple } } } }
- augur.curate.apply_geolocation_rules.register_parser(parent_subparsers)ο
- augur.curate.apply_geolocation_rules.run(args, records)ο
- augur.curate.apply_geolocation_rules.transform_geolocations(geolocation_rules, geolocation)ο
Transform the provided geolocation by looking it up in the provided geolocation_rules.
This will use all rules that apply to the geolocation and rules will be applied in the order of region, country, division, location.
Returns the original geolocation if no geolocation rules apply.
Raises a CyclicGeolocationRulesError if more than 1000 rules have been applied to the raw geolocation.