laser_measles.demographics package#
- pydantic model GADMShapefile[source]#
- Bases: - AdminShapefile- Show JSON schema- { "title": "GADMShapefile", "type": "object", "properties": { "shapefile": { "format": "path", "title": "Shapefile", "type": "string" }, "admin_level": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Admin Level" }, "dotname_fields": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Dotname Fields" } }, "required": [ "shapefile" ] } - Fields:
- Validators:
- check_dotname_fields»- all fields
 
 - classmethod download(country_code, admin_level, directory=None, timeout=60)[source]#
- Download the GADM shapefile for a given country code and return a GADMShapefile instance. - Parameters:
- country_code ( - str) – The country code to download the shapefile for.
- admin_level ( - int) – The admin level to download the shapefile for.
- directory ( - str|- Path|- None) – The directory to download the shapefile to. If None, uses current directory.
- timeout ( - int) – The timeout for the request.
 
- Return type:
- Returns:
- A GADMShapefile instance for the downloaded shapefile. 
 
 
- pydantic model RasterPatchParams[source]#
- Bases: - BaseModel- Show JSON schema- { "title": "RasterPatchParams", "type": "object", "properties": { "id": { "description": "Unique identifier for the scenario", "title": "Id", "type": "string" }, "region": { "description": "Country identifier (ISO3 code)", "title": "Region", "type": "string" }, "shapefile": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" } ], "description": "Path to the shapefile", "title": "Shapefile" }, "population_raster": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Path to the population raster", "title": "Population Raster" }, "mcv1_raster": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Path to the MCV1 raster", "title": "Mcv1 Raster" }, "mcv2_raster": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Path to the MCV2 raster", "title": "Mcv2 Raster" } }, "required": [ "id", "region", "shapefile" ] } - Fields:
- Validators:
 - 
field id: str[Required]#
- Unique identifier for the scenario 
 - 
field mcv1_raster: str|Path|None= None#
- Path to the MCV1 raster 
 - 
field mcv2_raster: str|Path|None= None#
- Path to the MCV2 raster 
 - 
field population_raster: str|Path|None= None#
- Path to the population raster 
 - 
field region: str[Required]#
- Country identifier (ISO3 code) 
 - 
field shapefile: str|Path[Required]#
- Path to the shapefile - Validated by:
 
 
- get_shapefile_dataframe(shapefile_path)[source]#
- Get a DataFrame containing the shapefile data with DOTNAME and shape columns. - Parameters:
- shapefile_path ( - str|- Path) – The path to the shapefile.
- Return type:
- DataFrame
- Returns:
- A DataFrame with DOTNAME and shape columns. 
 
Submodules#
laser_measles.demographics.admin_shapefile module#
Admin level shapefiles
- pydantic model AdminShapefile[source]#
- Bases: - BaseShapefile- Shapefile of administrative units. - Parameters:
- admin_level (int) – Admin level of the shapefile. 
- dotname_fields (list[str]) – List of fields to use for dotname. e.g., [“ADMIN0”, “ADMIN1”, “ADMIN2”] 
 
 - Show JSON schema- { "title": "AdminShapefile", "description": "Shapefile of administrative units.\n\nArgs:\n admin_level (int): Admin level of the shapefile.\n dotname_fields (list[str]): List of fields to use for dotname. e.g., [\"ADMIN0\", \"ADMIN1\", \"ADMIN2\"]", "type": "object", "properties": { "shapefile": { "format": "path", "title": "Shapefile", "type": "string" }, "admin_level": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Admin Level" }, "dotname_fields": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Dotname Fields" } }, "required": [ "shapefile" ] } - 
field admin_level: int|None= None#
 - 
field dotname_fields: list[str] |None= None#
 
laser_measles.demographics.base module#
- pydantic model BaseShapefile[source]#
- Bases: - BaseModel- Show JSON schema- { "title": "BaseShapefile", "type": "object", "properties": { "shapefile": { "format": "path", "title": "Shapefile", "type": "string" } }, "required": [ "shapefile" ] } - Fields:
 - 
field shapefile: Path[Required]#
 - classmethod convert_to_path(v)[source]#
- Wrap a classmethod, staticmethod, property or unbound function and act as a descriptor that allows us to detect decorated items from the class’ attributes. - This class’ __get__ returns the wrapped item’s __get__ result, which makes it transparent for classmethods and staticmethods. - wrapped#
- The decorator that has to be wrapped. 
 - decorator_info#
- The decorator info. 
 - shim#
- A wrapper function to wrap V1 style function. 
 
 
laser_measles.demographics.cache module#
- load_cache(cache_dir=None)[source]#
- Load the cache for the application. - Parameters:
- cache_dir (str | None) – The cache directory to use. If None, the default cache directory will be used. 
- Return type:
- Cache
- Returns:
- The cache object. 
 
laser_measles.demographics.gadm module#
GADM shapefiles
- pydantic model GADMShapefile[source]#
- Bases: - AdminShapefile- Show JSON schema- { "title": "GADMShapefile", "type": "object", "properties": { "shapefile": { "format": "path", "title": "Shapefile", "type": "string" }, "admin_level": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Admin Level" }, "dotname_fields": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Dotname Fields" } }, "required": [ "shapefile" ] } - Fields:
- Validators:
- check_dotname_fields»- all fields
 
 - classmethod download(country_code, admin_level, directory=None, timeout=60)[source]#
- Download the GADM shapefile for a given country code and return a GADMShapefile instance. - Parameters:
- country_code ( - str) – The country code to download the shapefile for.
- admin_level ( - int) – The admin level to download the shapefile for.
- directory ( - str|- Path|- None) – The directory to download the shapefile to. If None, uses current directory.
- timeout ( - int) – The timeout for the request.
 
- Return type:
- Returns:
- A GADMShapefile instance for the downloaded shapefile. 
 
 
laser_measles.demographics.raster_patch module#
Raster patch generator for demographic data. You can use this to generate initial conditions (e.g, population, MCV1 coverage) for a laser-measles scenario.
- pydantic model RasterPatchParams[source]#
- Bases: - BaseModel- Show JSON schema- { "title": "RasterPatchParams", "type": "object", "properties": { "id": { "description": "Unique identifier for the scenario", "title": "Id", "type": "string" }, "region": { "description": "Country identifier (ISO3 code)", "title": "Region", "type": "string" }, "shapefile": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" } ], "description": "Path to the shapefile", "title": "Shapefile" }, "population_raster": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Path to the population raster", "title": "Population Raster" }, "mcv1_raster": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Path to the MCV1 raster", "title": "Mcv1 Raster" }, "mcv2_raster": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Path to the MCV2 raster", "title": "Mcv2 Raster" } }, "required": [ "id", "region", "shapefile" ] } - Fields:
- Validators:
 - 
field id: str[Required]#
- Unique identifier for the scenario 
 - 
field mcv1_raster: str|Path|None= None#
- Path to the MCV1 raster 
 - 
field mcv2_raster: str|Path|None= None#
- Path to the MCV2 raster 
 - 
field population_raster: str|Path|None= None#
- Path to the population raster 
 - 
field region: str[Required]#
- Country identifier (ISO3 code) 
 - 
field shapefile: str|Path[Required]#
- Path to the shapefile - Validated by:
 
 
laser_measles.demographics.shapefiles module#
- add_dotname(path, dot_name_fields, dotname_symbol=':', append_suffix='dotname', inplace=False, field_name='DOTNAME')[source]#
- Add a DOTNAME to the shapefile. - Return type:
- None
 
