hackoregon / civic

The frontend monorepo for the CIVIC platform.
http://civicplatform.org
MIT License
60 stars 26 forks source link

Disaster Resilience: Card #4 - You and your neighbors in the earthquake #273

Closed PoeStewart closed 5 years ago

PoeStewart commented 6 years ago

Project: Disaster Resilience Card Title: You and your neighbors in the earthquake

Description / Wireframe

card 4 wire

For this card, a user will input their street address and will be presented with an address match (to validate that this is information for their address), below will be some scales regarding the earthquake impact at this address and some specific information regarding their building. Below that is a map of the user’s neighborhood with key points that they should know about when building an earthquake plan.

Below the address will be a list of some address-specific data points and information: Table with potential impacts: There is a scale that shows the full potential impact and then has a marker (circle or star or triangle on the mean and then some sort of a box or marker to show the min and the max) Shaking intensity Ex. of visual:

VII - Very Strong Damage negligible in buildings of good design and construction; slight to moderate in well-built ordinary structures; considerable damage in poorly built or badly designed structures; some chimneys broken. [__\ O\ __]
Low Permanent ground deformation due to landslides [\ O\ __]
High Permanent ground deformation due to liquefaction [__\ O\ ]
Intensity Shaking Description/Damage
I Not felt Not felt except by a very few under especially favorable conditions.
II Weak Felt only by a few persons at rest,especially on upper floors of buildings.
III Weak Felt quite noticeably by persons indoors, especially on upper floors of buildings. Many people do not recognize it as an earthquake. Standing motor cars may rock slightly. Vibrations similar to the passing of a truck. Duration estimated.
IV Light Felt indoors by many, outdoors by few during the day. At night, some awakened. Dishes, windows, doors disturbed; walls make cracking sound. Sensation like heavy truck striking building. Standing motor cars rocked noticeably.
V Moderate Felt by nearly everyone; many awakened. Some dishes, windows broken. Unstable objects overturned. Pendulum clocks may stop.
VI Strong Felt by all, many frightened. Some heavy furniture moved; a few instances of fallen plaster. Damage slight.
VII Very strong Damage negligible in buildings of good design and construction; slight to moderate in well-built ordinary structures; considerable damage in poorly built or badly designed structures; some chimneys broken.
VIII Severe Damage slight in specially designed structures; considerable damage in ordinary substantial buildings with partial collapse. Damage great in poorly built structures. Fall of chimneys, factory stacks, columns, monuments, walls. Heavy furniture overturned.
IX Violent Damage considerable in specially designed structures; well-designed frame structures thrown out of plumb. Damage great in substantial buildings, with partial collapse. Buildings shifted off foundations.
X Extreme Some well-built wooden structures destroyed; most masonry and frame structures destroyed with foundations. Rails bent.

Landslide Potential None Low: Low potential permanent ground deformation due to landslides (0 - 10 cm; 0 - 4 inches) Moderate: Moderate potential permanent ground deformation due to landslides (10 - 30 cm; 4 - 12 inches) High: High potential permanent ground deformation due to landslides (30 - 100 cm; 12 - 39 inches) Very High: Very high potential permanent ground deformation due to landslides (100 - 1180 cm; 39 - 173 inches)

Liquefaction Potential None Low: Low potential permanent ground deformation due to liquefaction (0 - 10 cm; 0 - 4 inches) Moderate: Moderate potential permanent ground deformation due to liquefaction (10 - 30 cm; 4 - 12 inches) High: High potential permanent ground deformation due to liquefaction (30 - 100 cm; 12 - 39 inches) Very High: Very high potential permanent ground deformation due to liquefaction (100 - 1180 cm; 39 - 173 inches)

For this card, a user can input their street address and will be presented with a map that shows their neighborhood and some information about the address they’ve input.

The map will be centered on the input address and zoomed to a level of 1 in = 1000 ft.

Icons on the map will show: The address that the user input Basic Earthquake Emergency Communication Node (BEECN) site Hospitals Fire station Schools

Data Visualization / Design Concerns

We would like a way to navigate outside of the original search area, potentially by navigating by arrows in the various directions. We don’t know what would be most doable or user-friendly.

This color scale for the risk metric (MMI or liquefaction) should be constant across different input addresses and across the different maps in different cards - it should not vary with the range of data specific to that map view (meaning if the specific map only has one color, the full-color scale should still be present).

Context

This information is important to the user because it shows their immediate location’s potential impact from the earthquake. This builds the story that emphasizes the importance of knowing your neighbors.

Data Details (APIs)

API Endpoint: http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodView/ Include fields: Shaking intensity pgv_site_min_MMI pgv_site_mean_MMI pgv_site_max_MMI Landslide PGD_landslide_wet_min_DI PGD_landslide_wet_mean_DI PGD_landslide_wet_max_DI Liquefaction PGD_liquefaction_wet_min_DI PGD_liquefaction_wet_mean_DI PGD_liquefaction_wet_max_DI

Hospital Include fields: name address city zipcode wkb_geometry

Basic_earthquake_emergency_communication_node_beecn_locations Include fields: hub_name site_name location (address) wkb_geometry

Address (may not be in the database yet) Include fields: add_full (address) city zip_code geometry (point) county Filters: county = “MULTNOMAH”

Schools (may not be in the database yet) Include fields: name address city zipcode geometry (point) level_no (1 is elementary, 2 is middle school, 3 is high school) county Filters: level_no in {1,2,3} county = “Multnomah”

API Endpoint: http://service.civicpdx.org/disaster-resilience/sandbox/slides/poi/ fire stations

About this data

How did we calculate this

Get from Fred This will ideally be a “dynamic” calculation done on the backend when someone inputs an address. We have Python code to do this, but a very murky path other than that. Other options would be to build a big table for a finely-spaced grid of lon/lat pairs and then do a table lookup based on the input lon/lat pair and output the results from the table row that is closest to the input lon/lat.

Description or link to GitHub description of data methodology

See the source

Link to API / data documentation on GitHub

Link to original source data

Original data sources: http://rlisdiscovery.oregonmetro.gov/ https://gis-pdx.opendata.arcgis.com/ http://www.oregongeology.org/pubs/ofr/p-O-18-02.htm https://earthquake.usgs.gov/learn/topics/mercalli.php

kursin2 commented 6 years ago

API link: /disaster-resilience/api/DisasterNeighborhoodView/ Sandbox link: /disaster-resilience/sandbox/slides/poi/

PoeStewart commented 6 years ago

for points of interest (POI) the best fields to show are description_txt, type and then description2_txt (But, if there's an icon showing the type (eg: "School") then maybe you don't need the type in the flyover hint) Also, we don't need the captions "Type:" or "Description:" in the flyover hint.

jaronheard commented 6 years ago

Geocoder should use Mapbox geocoder API, but this is still blocked until we have an API endpoint.

jaronheard commented 6 years ago

To make this more clear - in order for anyone to build this, the API endpoint needs to be able to be queried based on Lat/Long, and return the information needed for the address-specific data points and information to be shown below the map.

Additionally, I haven't fully investigated whether all of the endpoints for the different layers to be shown on the map are in the correct format, but if we have sandbox endpoints for each of them we should be able to use those.

nam20485 commented 6 years ago

@jaronheard The API endpoint to fetch statistics based on lat/long has been implemented here:

http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.592&long=-122.836

Which returns:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/0/?format=api",
            "centroidx": "-122.8359998",
            "centroidy": "45.59199993",
            "x_simple": "-122.836",
            "y_simple": "45.592",
            "wkb_geometry": {
                "type": "Polygon",
                "coordinates": [
                    [
                        [
                            -122.8321551738488,
                            45.5946991515664
                        ],
                        [
                            -122.8321551738488,
                            45.58930071776364
                        ],
                        [
                            -122.8398444575596,
                            45.58930071776364
                        ],
                        [
                            -122.8398444575596,
                            45.5946991515664
                        ],
                        [
                            -122.8321551738488,
                            45.5946991515664
                        ]
                    ]
                ]
            },
            "pgv_site_count": "4303",
            "pgv_site_max": "44.27544785",
            "pgv_site_mean": "30.91515367",
            "pgv_site_min": "28.81088638",
            "pgv_site_std": "5.225560132",
            "pgd_landslide_dry_count": "38740",
            "pgd_landslide_dry_max": "109",
            "pgd_landslide_dry_mean": "2.630795044",
            "pgd_landslide_dry_min": "0",
            "pgd_landslide_dry_std": "15.60695795",
            "pgd_landslide_wet_count": "38743",
            "pgd_landslide_wet_max": "819",
            "pgd_landslide_wet_mean": "100.9481971",
            "pgd_landslide_wet_min": "0",
            "pgd_landslide_wet_std": "165.718681",
            "pgd_liquefaction_wet_count": "38743",
            "pgd_liquefaction_wet_max": "346",
            "pgd_liquefaction_wet_mean": "55.71631004",
            "pgd_liquefaction_wet_min": "31",
            "pgd_liquefaction_wet_std": "66.85914515",
            "pgd_total_wet_mean": "156.6645071",
            "pgv_site_min_mmi": 7,
            "pgv_site_max_mmi": 8,
            "pgv_site_mean_mmi": 7,
            "pgd_landslide_dry_min_di": "None",
            "pgd_landslide_dry_max_di": "Very High",
            "pgd_landslide_dry_mean_di": "Low",
            "pgd_landslide_wet_min_di": "None",
            "pgd_landslide_wet_max_di": "Very High",
            "pgd_landslide_wet_mean_di": "Very High",
            "pgd_liquefaction_wet_min_di": "High",
            "pgd_liquefaction_wet_max_di": "Very High",
            "pgd_liquefaction_wet_mean_di": "High",
            "pgd_total_wet_mean_di": "Very High"
        }
    ]
}
jaronheard commented 6 years ago

@nam20485 I'm blocked on this again. The example API query you gave me works, but I can't get it to work with other coordinates that should be valid and within the study area.

Working example: http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.592&long=-122.836

Examples that don't work: Location of CENTRL office: http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.523628&long=-122.656646

Points .001 lat/long units in each direction from the example point: http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.592&long=-122.835 http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.592&long=-122.837 http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.591&long=-122.836 http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.593&long=-122.836

nam20485 commented 6 years ago

Ok thanks for looking into it. I will take a look and remedy the problem and then move it back to your court.

Sounds good?

On Wed, Jul 11, 2018, 1:46 PM Jaron Heard notifications@github.com wrote:

@nam20485 https://github.com/nam20485 I'm blocked on this again. The example API query you gave me works, but I can't get it to work with other coordinates that should be valid and within the study area.

Working example:

http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.592&long=-122.836

Examples that don't work: Location of CENTRL office:

http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.523628&long=-122.656646

Points .001 lat/long units in each direction from the example point:

http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.592&long=-122.835

http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.592&long=-122.837

http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.591&long=-122.836

http://service.civicpdx.org/disaster-resilience/api/DisasterNeighborhoodGrid/?format=api&lat=45.593&long=-122.836

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hackoregon/civic/issues/273#issuecomment-404303950, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvqFHWPFvEFZHueD_yHjYNcwIFAX93qks5uFmQpgaJpZM4UqwoU .

nam20485 commented 6 years ago

OK I now round the given lat and long coordinates to the nearest multiple of 0.002, which is what the lookup values in the database table are provided in. If you enter a lat/long pair that is not a multiple of 0.002, it will round it and give you the stats for the nearest square centered there that we have.

All of you provided examples now work.

jaronheard commented 5 years ago

363 implemented, new issues should be created for other improvements