Reference
Read the SINAVE datasets of a vector-borne disease.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Folder with the SINAVE txt files. |
required |
vbd
|
str
|
Text that identifies the files of the disease, e.g. |
required |
complete
|
bool
|
|
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Read one SINAVE txt file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The SINAVE txt file (e.g. |
required |
columns
|
list of str
|
Columns to keep. All the columns by default. |
None
|
encoding
|
str
|
Encoding of the file; SINAVE files are Latin-1. |
'latin-1'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per case. The geographic keys ( |
Read the dengue dataset of SINAVE for the country, a state or a municipality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The dengue txt file ( |
required |
spatial_resolution
|
('country', 'state', 'municipality')
|
|
"country"
|
status_caso
|
int or list of int
|
1 probable, 2 confirmed, 3 discarded. |
(1, 2)
|
des_edo_res
|
str or list of str
|
State(s) of residence in uppercase, as in SINAVE ( |
None
|
des_mpo_res
|
str or list of str
|
Municipality(ies) of residence in uppercase. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The cases of residence in Mexico (foreign residences removed). |
Cases by municipality (AGEM) of report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_vbd
|
str or Path
|
Folder with the SINAVE txt files. |
required |
vbd
|
str
|
Text that identifies the files of the disease, e.g. |
required |
status_case
|
int or list of int
|
1 probable, 2 confirmed, 3 discarded. |
(1, 2)
|
country
|
bool
|
|
True
|
cve_edo
|
str or list of str
|
INEGI state key(s), used when |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
The municipalities (INEGI 2019) with the number of cases |
Arbovirus cases by locality of report.
Counts the probable and confirmed cases by locality of report and joins them to the INEGI 2020 locality catalogue (ITER 2020): one point per locality with cases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The SINAVE txt file ( |
required |
snv_dataset
|
('DENV', 'ZIKV', 'CHIKV')
|
|
"DENV"
|
year
|
int or list of int
|
Year(s) to keep ( |
None
|
week
|
int or list of int
|
Epidemiological weeks to keep ( |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Points (EPSG:4326) with |
Dengue cases by epidemiological week in a municipality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Folder with the SINAVE txt files (the dengue file has |
required |
mpo
|
str or list of str
|
Municipality(ies) of report in uppercase, as in SINAVE
( |
required |
year
|
int
|
Year ( |
required |
plot
|
bool
|
Also draw the figure (matplotlib). |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Effective reproductive number (Rt) of dengue.
Rt for the country, a state, a municipality or a locality, from the daily
incidence of the SINAVE cases and a parametric serial interval (Cori et
al. 2013), as rt_dengue() of densnv in R.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
DataFrame
|
SINAVE dengue dataset (e.g. |
required |
level
|
('country', 'state', 'municipality', 'locality')
|
|
"country"
|
place
|
('REP', 'RES')
|
Place used to select the cases: of report (default; the cases are geocoded with it) or of residence. In non-endemic areas the cases are reported where they were exposed, so the place of report is the place of transmission. |
"REP"
|
cve_edo
|
(str, int or list)
|
INEGI keys of the state, municipality and locality. |
None
|
cve_mpo
|
(str, int or list)
|
INEGI keys of the state, municipality and locality. |
None
|
cve_loc
|
(str, int or list)
|
INEGI keys of the state, municipality and locality. |
None
|
status_caso
|
int or list of int
|
1 probable, 2 confirmed. |
(1, 2)
|
ref_date
|
str or date
|
Reference date; by default the latest date of onset of the cases. |
None
|
period_days
|
int
|
Days, up to |
365
|
window_days
|
int
|
Days, up to |
21
|
mean_si
|
float
|
Mean and standard deviation (days) of the serial interval (21, 6.1). |
21
|
std_si
|
float
|
Mean and standard deviation (days) of the serial interval (21, 6.1). |
21
|
plot
|
bool
|
Draw the Rt curve (matplotlib). |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Notes
The curve uses weekly sliding windows with at least 10 cases that start
at least mean_si + 2 * std_si days after the first date of onset of
the dataset or of the period, whichever is later; before it the infectiousness of the previous cases is
unknown and Rt is overestimated. The last days are usually incomplete
(delay of report), which lowers Rt at the end.
Rt with a parametric serial interval (EpiEstim::estimate_R(),
method "parametric_si").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
incidence
|
array - like
|
Daily incidence (cases per day, consecutive days). As in EpiEstim, the cases of the first day are taken as imported. |
required |
t_start
|
array-like of int
|
Start and end (1-based, inclusive) of each time window. |
required |
t_end
|
array-like of int
|
Start and end (1-based, inclusive) of each time window. |
required |
mean_si
|
float
|
Mean and standard deviation (days) of the serial interval. |
21
|
std_si
|
float
|
Mean and standard deviation (days) of the serial interval. |
21
|
mean_prior
|
float
|
Mean and standard deviation of the gamma prior of Rt. |
5
|
std_prior
|
float
|
Mean and standard deviation of the gamma prior of Rt. |
5
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per window: |
Active dengue transmission foci and diagnosis of the epidemiological scenario.
Python version of mp_active_foci() of densnv (R). It identifies the
active transmission foci of a locality with DBSCAN (window) or ST-DBSCAN,
delimits the transmission and control zones, selects the blocks to treat,
tests the space-time interaction with the Knox test (global and by focus),
estimates Rt with :func:rt_dengue and diagnoses the epidemiological
scenario with the operational strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geocoded_dataset
|
DataFrame
|
Geocoded cases with |
required |
cve_edo
|
str or int
|
INEGI state key of the locality. |
required |
locality
|
str
|
Name of the locality (as in |
required |
status_caso
|
int or list of int
|
1 probable, 2 confirmed. |
(1, 2)
|
spatial_scale
|
float
|
Spatial window in metres (flight range of Aedes aegypti, 400). |
400
|
temporal_scale
|
int
|
Temporal window in days (intrinsic + extrinsic incubation, 21). |
21
|
min_cases
|
int
|
Minimum cases in the space-time window to define a focus (3). |
3
|
buffer_m
|
float
|
Buffer of the control zone around the transmission zone (200 m). |
200
|
ref_date
|
str or date
|
Reference date; by default the latest onset in the locality. |
None
|
method
|
('window', 'st-dbscan')
|
Fixed window or space-time DBSCAN (new and persistent foci). |
"window"
|
n_sim
|
int
|
Permutations of the Knox test (0 skips it). |
999
|
perm_days
|
int
|
Days, up to |
365
|
alpha
|
float
|
Significance level (Holm-adjusted p-value by focus; Poisson test). |
0.05
|
seed
|
int
|
Seed of the permutations. |
None
|
place
|
('REP', 'RES')
|
Place of the cases used for Rt. |
"REP"
|
mean_si
|
float
|
Serial interval for Rt (21, 6.1 days). |
21
|
std_si
|
float
|
Serial interval for Rt (21, 6.1 days). |
21
|
capacity_cases
|
float
|
Operational capacity: cases per week the brigades can work. |
None
|
coverage_min
|
float
|
Coverage of the locality by the recent cases to consider them dispersed; by default 0.40 with 21 days, 0.50 with 28 and linear in between. |
None
|
foci_min
|
float
|
Proportion of the recent cases in foci from which the cases are also considered dispersed (0.9). |
0.9
|
print_map
|
bool
|
Return the interactive map (folium) in |
False
|
save
|
bool
|
Save the selected blocks as a GeoPackage in |
False
|
dir
|
str
|
Folder where the blocks are saved. |
'./'
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Heatmap of the cases by municipality (rows) and epidemiological week.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
DataFrame
|
SINAVE dengue dataset ( |
required |
state
|
str or list
|
State(s) of report, as in |
None
|
year
|
int
|
Year ( |
None
|
status
|
int or list of int
|
Case status (ignored with |
(1, 2)
|
hospitalizados
|
bool
|
Use the hospitalised cases (with date of admission) instead of the status. |
False
|
plot
|
bool
|
Also build the plotly figure. |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Age-sex pyramid of the confirmed cases (ESTATUS_CASO == 2).
Males on the left, females on the right, by five-year age group.
Returns:
| Type | Description |
|---|---|
dict
|
|
Confirmed cases by final diagnosis and by serotype, by state (or by municipality of a state).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
SINAVE dengue dataset. |
required |
year
|
int
|
Year ( |
required |
cve_edo
|
str or int
|
State; with it the bars are the municipalities of the state. |
None
|
inset
|
tuple
|
Position of the serotype plot (left, bottom, width, height, as a
fraction of the figure); replaces |
(0.58, 0.16, 0.38, 0.38)
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Treemap of the cases by final diagnosis, by state (country=True) or
by municipality of a state.
Returns:
| Type | Description |
|---|---|
dict
|
|
Bump map: map of the cases with sigmoid curves to a ranking.
state=True ranks the states of Mexico; state=False the
municipalities of cve_edo (optionally the top_n with most cases).
Returns:
| Type | Description |
|---|---|
dict
|
|
Interactive map (folium) of the cases by locality, with a panel of the
top_n localities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GeoDataFrame
|
Output of :func: |
required |
var
|
str
|
Column to map ( |
'probable'
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Serotypes of the confirmed cases by municipality of a state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_sinave
|
str or Path
|
The dengue txt file ( |
required |
cve_edo
|
str or int
|
State key. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
|