CodeForPhilly / clean-and-green-philly

Dashboard to target Philly vacant properties for anti-gun violence interventions
https://www.cleanandgreenphilly.org/
MIT License
33 stars 64 forks source link

Sort properties by priority #293

Closed thansidwell closed 8 months ago

thansidwell commented 9 months ago

Right now properties aren't sorted in any particular way. https://share.cleanshot.com/DTFJqbJc

Sort the properties by priority, displaying the highest priority properties at the top of the list. Use the underlying numeric priority value to sort.

willonabike commented 9 months ago

This is a really good idea, I just came to file the same issue. the sort should be predictable to users. Recommend sorting by the numeric priority value so that the "best" values in the list come first. Ensure this is done before capping the results at 100.

thansidwell commented 9 months ago

@willonabike Good idea. I'll didn't realize there's an underlying numeric priority value. I'll add that to the instructions above.

paulhchoi commented 8 months ago

@willonabike — I think there may be a misunderstanding — after evaluating the features array, the only priority is the field properties.priority_level which is of strings "High" | "Medium" | "Low". Please inform if theres another way to retrieve a more concrete numerical priority value, or to even derive a general priority based on the available fields?

example feature object:

{
    "type": "Feature",
    "state": {},
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [
                    -75.14859795570374,
                    40.012742869523834
                ],
                [
                    -75.1483404636383,
                    40.012710000590914
                ],
                [
                    -75.14835119247437,
                    40.01266891440247
                ],
                [
                    -75.1486086845398,
                    40.0127017833552
                ],
                [
                    -75.14859795570374,
                    40.012742869523834
                ]
            ]
        ]
    },
    "properties": {
        "OPA_ID": 433174700,
        "access_process": "Private Land Use Agreement",
        "address": "3926 N 13TH ST",
        "all_violations_past_year": 0,
        "building_description": "ROW 2 STY MASONRY",
        "city_owner_agency": "",
        "conservatorship": "No",
        "council_district": "5",
        "drugcrime_density": "Top 50%",
        "guncrime_density": "Top 25%",
        "imm_dang_building": "N",
        "is_actionable": "true",
        "li_complaints": "",
        "llc_owner": "No",
        "market_value": 23200,
        "most_recent_year_owed": 2021,
        "neighborhood": "Hunting Park",
        "num_years_owed": 7,
        "open_violations_past_year": 0,
        "owner_1": "WOOTEN C L",
        "owner_2": "",
        "parcel_type": "Building",
        "payment_agreement": "false",
        "phs_partner_agency": "None",
        "priority_level": "High",
        "rco_info": "Nicetown-Tioga Improvement Team; 3621 N 11th St, Phila PA 19140; nicetowntioga@gmail.com; 2672583111|Hunting Park Connected; 1300 W Hunting Park Avenue \r\nPhiladelphia, PA 19140; gardinerwadia1@gmail.com; 4042546529",
        "sale_date": "2019-09-15T00:00:00Z",
        "sale_price": 11000,
        "sheriff_sale": "N",
        "side_yard_eligible": "No",
        "tactical_urbanism": "No",
        "total_assessment": 23000,
        "total_due": 2344.32,
        "tree_canopy_gap": 0.231499754748575,
        "unsafe_building": "N",
        "zipcode": "19140",
        "zoning_base_district": "RM-1"
    },
    "id": 1161,
    "layer": {
        "id": "vacant_properties_tiles",
        "type": "fill",
        "source": "vacant_properties_tiles",
        "source-layer": "vacant_properties_tiles",
        "metadata": {
            "name": "Priority"
        },
        "paint": {
            "fill-color": {
                "r": 1,
                "g": 0.27058823529411763,
                "b": 0,
                "a": 1
            },
            "fill-opacity": 0.7
        },
        "layout": {}
    },
    "source": "vacant_properties_tiles",
    "sourceLayer": "vacant_properties_tiles"
}
brandonfcohen1 commented 8 months ago

@paulhchoi that's correct, FYI @thansidwell

so maybe sort by priority than just by OPA_ID or something to keep it consistent