This project simulates a leptospirosis outbreak in Eastport, Maine following a hurricane event. It implements a spatially-explicit SEIR (Susceptible-Exposed-Infectious-Recovered) model to simulate disease spread through a population and evaluates the impact of different intervention timelines.
- Geospatial modeling of leptospirosis spread based on property locations
- Integration with flood risk data to model environmental exposure
- Demographic factors affecting disease vulnerability:
- Age (young, adult, senior, elderly)
- Disability status
- Household size
- Population density
- Housing factors:
- Vacancy rates
- Property locations
- Comparison of intervention scenarios at different time points (Day 10, 20, 30, 40)
- Spatial and temporal visualization of outbreak progression
- Statistical analysis of outbreak patterns and intervention effectiveness
- Geographic transmission patterns influenced by proximity and flood conditions
- Python 3.8+
- GeoPandas
- Pandas
- NumPy
- Matplotlib
- SciPy
- Joblib
- Clone this repository
git clone https://github.com/b0id/leptospirosis-model.git cd leptospirosis-model - Create a virtual environment:
conda create -n epi_model python=3.9 conda activate epi_model - Install the required packages:
pip install geopandas pandas numpy matplotlib scipy joblib
The model requires the following input files in the input directory:
raw_centroids.geojson: Property centroids with the following attributes:density_no: Normalized population densityFloodRisk: Flood risk score (0-5)
grid.geojson: Hexagonal census grid for aggregating results
Run the main simulation:
python main.py
This will:
- Prepare the statistical data for centroids
- Run the SEIR model simulations for different response times
- Create visualizations and statistical reports
- Generate distribution maps showing the spatial patterns of infection
The simulation generates the following outputs in the outputs directory:
- Statistical visualizations in
statistics/- Household size distribution
- Age category distribution
- Vacancy rates by density
- Leptospirosis risk distribution
- Spatial risk distribution
- Risk by flood zone
- Simulation results in
simulations/- SEIR curves for each response scenario
- Cumulative impact charts
- Comparison charts in
comparisons/- Cases comparison across scenarios
- Deaths comparison across scenarios
- Deaths prevented analysis
- Risk factor analysis in
risk_factors/- Flood risk impact
- Age impact
- Disability impact
- Combined risk factor analysis
- Report data in
report/- Summary statistics
- Outbreak statistics by response day
- Leptospirosis distribution maps in
distributions/response_X/- Spatial distribution maps for days 0, 10, 20, 30, 40, 50, 60
- Animation data in
animations/response_X/- GeoJSON files for animation frames
The model implements a spatially-explicit SEIR framework with the following components:
- Incubation period: 10 days (σ = 1/10)
- Infectious period: 14 days (γ = 1/14)
- Base transmission rate: 0.4
- Flood-enhanced transmission rate: 1.0
- Case fatality rates varying by demographic:
- Young: 2%
- Adult: 4%
- Senior: 7%
- Elderly: 12%
- Increased by 25% for individuals with disabilities
- Flood risk amplifies transmission probability
- Geographic location affects transmission patterns
- Neighbor proximity within 150 meters affects transmission
- Population density modifies transmission rate
- Day 10 response: 85% reduction in transmission
- Day 20 response: 65% reduction in transmission
- Day 30 response: 45% reduction in transmission
- Day 40 response: 25% reduction in transmission
- Gradual implementation of interventions over 7 days
- Location-based variations in intervention effectiveness
- Early responses also reduce mortality through better treatment
main.py: Main execution scriptdata_preparation.py: Prepares statistical data for centroidslepto_model.py: Implements the SEIR modeldistribution_visualization.py: Creates visualization mapsresults_visualization.py: Generates comparative visualizations and reports
The model can be extended by:
- Modifying disease parameters in
lepto_model.py - Adding new risk factors in
data_preparation.py - Creating new visualization types in
distribution_visualization.py - Implementing additional intervention scenarios
- Adding socioeconomic factors to influence intervention access
- Incorporating more detailed environmental data
- Interactive web visualization using Flask
- Integration with real-time weather data
- More sophisticated intervention modeling including:
- Resource constraints
- Behavioral factors affecting compliance
- Vaccination campaigns
- Enhanced visualization showing SEIR transitions with death markers
- Socioeconomic factors affecting intervention access
- Multi-pathogen modeling for post-disaster scenarios
MIT License
Copyright (c) 2025 b0id
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This project was developed as a case study for demonstrating epidemiological modeling techniques in a spatial context following hurricane events. The model structure and parameters are based on established leptospirosis literature and post-disaster outbreak patterns.




