Examples
========

Explore a series of introductory examples to learn how to use |app| effectively. These examples are organized progressively, building on concepts introduced in previous examples to deepen understanding step-by-step. Each example presents one or more Python scripts, explaining their inputs and discussing the outputs generated by running the scripts. While the examples focus on key outputs, they represent only a subset of the information produced. Since |app| primarily focuses on creating regional inventories, several Jupyter notebooks are included to display interactive maps, providing insights into the larger inventories generated.

Introductory Examples
---------------------

.. grid:: 1
   :gutter: 1

   .. grid-item-card:: Load BRAILS++ modules dynamically
      :link: importer/importer.html
      :text-align: left

      Learn how to dynamically import |app| modules for use in your pipeline.

   .. grid-item-card:: Get building footprint data
      :link: footprint/footprint.html
      :text-align: left

      Use |app| to extract building footprint data across broad geographic areas.

   .. grid-item-card:: Extract baseline building data from NSI
      :link: nsi_integration/nsi_integration.html
      :text-align: left

      Retrieve baseline building attributes from the National Structure Inventory (NSI) using |app|.

   .. grid-item-card:: Download satellite and street-level imagery for buildings
      :link: image_downloads/image_downloads.html
      :text-align: left

      Acquire satellite and street-level imagery for buildings using |app|’s automated tools.

   .. grid-item-card:: Filter out low-quality building images with minimal visual cues
      :link: image_filters/image_filters.html
      :text-align: left

      Automatically filter out images with poor quality or limited visual detail using |app|.

   .. grid-item-card:: Fill missing building data using statistical imputation
      :link: imputation/imputation.html
      :text-align: left

      Fill in missing building information by applying statistical imputation methods available in |app|.
   
Examples Gallery
----------------

The examples above give you a glimpse of how |app| can generate inventories for the built environment. But that is just the beginning, |app| has many more ways to capture and work with data. Below, you will find a gallery of hands-on examples that let you explore these capabilities in action.

Create Regional-Scale Inventories 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. grid:: 2 2 2 2
   :gutter: 2

   .. grid-item-card:: Create Building Inventories for Seismic Analysis
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/inventory_creation/brails_eq_building_inventory_creation.ipynb
      :text-align: center
     
      Generate comprehensive building inventories by fusing multiple data sources and imagery to support seismic damage assessment and loss analysis.
     
   .. grid-item-card:: Create Building Inventories for Hurricane Analysis
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/inventory_creation/brails_hu_building_inventory_creation.ipynb
      :text-align: center
     
      Create detailed building inventories by combining multiple data sources and imagery, enabling accurate hurricane damage assessment and loss analysis.     

   .. grid-item-card:: Get Inventories of Power Networks
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/inventory_creation/brails_power_network.ipynb
      :text-align: center
     
      Generate comprehensive inventories of power networks.

Data Scraping
^^^^^^^^^^^^^

.. grid:: 2 2 2 2
   :gutter: 2

   .. grid-item-card:: Get Footprints by Region Name
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/footprint/brails_footprint_name_input.ipynb
      :text-align: center

      Learn how to quickly fetch footprint data for any region by simply providing its name.

   .. grid-item-card:: Get Footprints by Bounding Polygon
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/footprint/brails_footprint_name_input.ipynb
      :text-align: center

      Learn how to extract footprint data for a region by specifying the coordinates of its bounding polygon.
      
   .. grid-item-card:: Download Aerial and Street-Level Imagery
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_downloads/brails_imagery_pipeline.ipynb
      :text-align: center

      Use |app| to easily access and download both aerial and street-level imagery for any region of interest. These datasets can be combined with computer vision models to extract attributes that are otherwise not available in standard databases.
      
   .. grid-item-card:: Downloading NSI data
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/nsi_integration/brails_nsi_integration.ipynb
      :text-align: center
     
      Retrieve baseline building data from the NSI database to support inventory creation.      
  
   .. grid-item-card:: Get USGS Elevation Data
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/scrapers/usgs_elevation_scraper.ipynb
      :text-align: center
     
      Access USGS 3DEP elevation data.
 
   .. grid-item-card:: Parse RAPID datasets
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/rapid_tools/aerial_from_raster.ipynb
      :text-align: center
     
      Prepare RAPID datasets for seamless integration with |app|’s computer vision models, enabling automated analysis of building and infrastructure imagery.
 
     
Attribute Extraction from Imagery
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. grid:: 2 2 2 2
   :gutter: 2

   .. grid-item-card:: Classify Building Construction Type
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/construction_type_classifier.ipynb
      :text-align: center

      Classify building construction types using street-level imagery.  

   .. grid-item-card:: Classify Building Construction Type (VLM)
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/construction_type_classifier.ipynb
      :text-align: center

      Use CLIP to identify the construction type of buildings from street-level imagery.

   .. grid-item-card:: Parse Building Facades
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/facade_parser.ipynb
      :text-align: center

      Analyze building facades to automatically predict window areas, building height, roof height, and roof pitch angle from street-level imagery.

   .. grid-item-card:: Detect Garages
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/garage_detector.ipynb
      :text-align: center

      Automatically detect the presence of garages in buildings using street-level imagery.

   .. grid-item-card:: Detect Chimneys
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/chimney_detector.ipynb
      :text-align: center

      Easily spot chimneys in buildings using street-level imagery.

   .. grid-item-card:: Classify Foundation Type
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/foundation_type_classifier.ipynb
      :text-align: center

      Identify the type of building foundation from street-level images to support damage and loss predictions.

   .. grid-item-card:: Detect Building Number of Floors
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/nfloor_detector.ipynb
      :text-align: center

      Automatically detect the number of floors in a building from street-level images using a custom object detection model.

   .. grid-item-card:: Classify Building Number of Floors (GPT)
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/NFloorsGPT.ipynb
      :text-align: center

      Use GPT-powered models to predict the number of floors in buildings from street-level images.

   .. grid-item-card:: Classify Building Number of Floors (VLM)
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/NFloorsVLM.ipynb
      :text-align: center

      Leverage CLIP (VLM) to classify the number of floors in buildings from street-level for automated regional studies.

   .. grid-item-card:: Classify Building Occupancy
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/occupancy_classifier.ipynb
      :text-align: center

      Predict building occupancy types from street-level images to understand how individual spaces are used in a region.

   .. grid-item-card:: Classify Building Roof Shape
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/roof_shape_classifier.ipynb
      :text-align: center

      Quickly identify building roof shapes from aerial imagery using a custom image classification model.

   .. grid-item-card:: Classify Roof Shape (GPT)
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/roof_shape_classification_GPT.ipynb
      :text-align: center

      Use a GPT-powered model to classify roof shapes from aerial images for urban analysis and design studies.

   .. grid-item-card:: Classify Roof Shape (VLM)
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/roof_shape_classification_VLM.ipynb
      :text-align: center

      Leverage CLIP (VLM) to classify roof shapes in aerial imagery of buildings for large-scale rooftop analysis.

   .. grid-item-card:: Segment Building Images (VLM)
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/VLM_segmenter.ipynb
      :text-align: center

      Segment building images into meaningful regions using SAM for detailed attribute extraction.

   .. grid-item-card:: Predict Year Built
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/image_processor/year_built_classifier.ipynb
      :text-align: center

      Estimate the construction year of buildings from street-level images to provide temporal context in datasets.

Completing Datasets with Imputation and Ruleset-Based Logic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. grid:: 2 2 2 2
   :gutter: 2

   .. grid-item-card:: Predict Missing Values with Statistical Imputation
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/imputation/imputation_example.ipynb
      :text-align: center

      Fill in missing data automatically using statistical imputation techniques, ensuring your datasets are complete and ready for damage and loss analysis.
      
   .. grid-item-card:: Predict Required Attributes for HAZUS Flood Analysis
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/inference/FloodFeatureInference(Hazus).ipynb
      :text-align: center

      Automatically predict the building attributes needed for HAZUS flood analysis from a known set of attributes to prepare complete datasets for damage and loss assessments. These rulesets were developed by Prof. Kijewski-Correa and her team at the University of Notre Dame.
      
   .. grid-item-card:: Predict Required Attributes for HAZUS Wind Analysis
      :link: https://colab.research.google.com/github/NHERI-SimCenter/BrailsPlusPlus/blob/master/examples/inference/WindFeatureInference(HazusHU).ipynb
      :text-align: center

      Easily predict the building attributes needed for HAZUS wind analysis using a known set of input data to quickly prepare complete datasets for damage and loss assessment studies. These rulesets were developed by Prof. Kijewski-Correa and her team at the University of Notre Dame.     
