# Residential building recovery
**Description**
This analysis computes the recovery time needed for each residential building from any damage states
to achieve full restoration. Currently, supported hazards are **tornadoes**.
The methodology incorporates a multi-layer Monte Carlo simulation approach and
determines the two-step recovery time which includes both the delay period and repair
period. The delay model was modified based on the REDi framework and calculated
the end-result outcomes resulting from delay impeding factors such as post-disaster
inspection, insurance claims, and building permit issuance. The repair model followed
the FEMA P-58 approach and ultimately utilized fragility functions from Koliou and
van de Lindt (2020).
The outputs of this analysis is a CSV file with time-stepping recovery probabilities at the building level.
**Contributors**
- Science: Wanting Lisa Wang, John W. van de Lindt
- Implementation: Wanting Lisa Wang, Gowtham Naraharisetty, and NCSA IN-CORE Dev Team
**Related publications**
- Wang, Wanting Lisa, and John W. van de Lindt. "Quantitative Modeling of Residential Building Disaster Recovery and Effects of Pre-and Post-event Policies." *International Journal of Disaster Risk Reduction* (2021): 102259.
- Koliou, M. and J.W. van de Lindt. (2020). “Development of Building Restoration Functions for use in Community Recovery Planning to Tornadoes.”, *ASCE Natural Hazards Review*, Vol **21 (2)** doi.org10.1061/(ASCE)NH.1527-6996.0000361.
**Input parameters**
key name | type | name | description
--- | --- | --- | ---
`result_name` * | `str` | Result name | Name of the result dataset.
`num_samples` * | `int` | Samples number | Number of sample scenarios.
`seed` | `int` | Seed | Initial seed for the probabilistic model.
`repair_key` | `str` | Repair key | A repair key to use in mapping dataset.
**Input datasets**
key name | type | name | description
--- | --- | --- | ---
`buildings` * | [`ergo:buildingInventoryVer4`](https://incore.ncsa.illinois.edu/semantics/api/types/ergo:buildingInventoryVer4)
[`ergo:buildingInventoryVer5`](https://incore.ncsa.illinois.edu/semantics/api/types/ergo:buildingInventoryVer5)
[`ergo:buildingInventoryVer6`](https://incore.ncsa.illinois.edu/semantics/api/types/ergo:buildingInventoryVer6)
[`ergo:buildingInventoryVer7`](https://incore.ncsa.illinois.edu/semantics/api/types/ergo:buildingInventoryVer7) | Building dataset | A building dataset.
`dfr3_mapping_set` * | [`incore:dfr3MappingSet`](https://incore.ncsa.illinois.edu/semantics/api/types/incore:dfr3MappingSet) | DFR3 Mapping Set | DFR3 Mapping Set.
`sample_damage_states` * | [`incore:sampleDamageState`](https://incore.ncsa.illinois.edu/semantics/api/types/incore:sampleDamageState) | Damage states | Sample damage states.
`socio_demographic_data` * | [`incore:socioDemograhicData`](https://incore.ncsa.illinois.edu/semantics/api/types/incore:socioDemograhicData) | Socio demographic | Socio-demographic data with household income group predictions.
`financial_resources` * | [`incore:householdFinancialResources`](https://incore.ncsa.illinois.edu/semantics/api/types/incore:householdFinancialResources) | Financial resources | Financial resources by household income groups.
`delay_factors` * | [`incore:buildingRecoveryFactors`](https://incore.ncsa.illinois.edu/semantics/api/types/incore:buildingRecoveryFactors) | Delay factors | Delay impeding factors such as post-disaster inspection, insurance claim,
and government permit based on building's damage state. Provided by REDi framework.
**Output datasets**
key name | type | parent key | name | description
--- | --- | --- | --- | ---
`residential_building_recovery` * | [`incore:buildingRecovery`](https://incore.ncsa.illinois.edu/semantics/api/types/incore:buildingRecovery) | Results | A dataset containing results (format: CSV)
with percentages of residential building recovery.
(* required)
**Execution**
code snippet:
```
# Create Residential building recovery instance
res_recovery = ResidentialBuildingRecovery(client)
# Load input building infrastructure dataset
res_recovery.load_remote_input_dataset("buildings", buildings)
# Load repair mapping
repair_service = RepairService(client)
mapping_set = MappingSet(repair_service.get_mapping(mapping_id))
res_recovery.set_input_dataset('dfr3_mapping_set', mapping_set)
# Load input datasets
res_recovery.load_remote_input_dataset("sample_damage_states", sample_damage_states)
res_recovery.load_remote_input_dataset("socio_demographic_data", socio_demographic_data)
res_recovery.load_remote_input_dataset("financial_resources", financial_resources)
res_recovery.load_remote_input_dataset("delay_factors", delay_factors)
# Specify the result name
result_name = "joplin_recovery"
# Set analysis parameters
res_recovery.set_parameter("result_name", result_name)
res_recovery.set_parameter("seed", seed)
res_recovery.set_parameter("num_samples", 10)
# Run residential recovery analysis
res_recovery.run_analysis()
```
full analysis: [residential_building_recovery.ipynb](https://github.com/IN-CORE/incore-docs/blob/main/notebooks/residential_building_recovery.ipynb)