VEuPathDB / EdaNewIssues

0 stars 0 forks source link

Map - `standalone-map-distributions/visualizations/histogram` endpoint has two empty-result behaviours (clickable markers-related) #768

Closed bobular closed 4 months ago

bobular commented 4 months ago

This one seems a little odd.

Clicking on a marker with a histogram floater causes an io-ts warning, due to unexpected nulls (in the binSpec/binSlider) being returned from the floating histogram endpoint with the following request. Note that the histogram data returned is an empty array, which is legal.

{
    "config": {
        "barMode": "stack",
        "binSpec": {
            "type": "binWidth",
            "value": 6.67
        },
        "outputEntityId": "OBI_0002732",
        "overlayConfig": {
            "overlayType": "categorical",
            "overlayValues": [
                "Aedes vexans",
                "Culex pipiens morphological group",
                "Anopheles <subgenus>",
                "Culex tarsalis",
                "Culex nigripalpus",
                "Anopheles punctipennis",
                "Culex erraticus",
                "__UNSELECTED__"
            ],
            "overlayVariable": {
                "entityId": "EUPATH_0000609",
                "variableId": "OBI_0001909"
            }
        },
        "valueSpec": "count",
        "xAxisVariable": {
            "entityId": "OBI_0002732",
            "variableId": "OBI_0002993"
        }
    },
    "filters": [
        {
            "entityId": "GAZ_00000448",
            "max": 84.89714695160268,
            "min": -68.9110048456202,
            "type": "numberRange",
            "variableId": "OBI_0001620"
        },
        {
            "entityId": "GAZ_00000448",
            "left": -177.36328124,
            "right": -177.36328125,
            "type": "longitudeRange",
            "variableId": "OBI_0001621"
        },
        {
            "entityId": "GAZ_00000448",
            "stringSet": [
                "t"
            ],
            "type": "stringSet",
            "variableId": "EUPATH_0043203"
        }
    ],
    "studyId": "VBP_MEGA"
}

image

Note the viewport lat/long filters and a third filter on geohash_1 which filters based on one clicked marker.

An almost identical request (below) without the clicked marker/geohash_1 filter, but with a timeslider filter that we know has no data results in the expected 500 containing the "did not contain any data" string that the front end knows what to do with.

I'm sure we can relax the io-ts validation constraints to handle this, but I'm curious why a date filter does one thing, and a string filter does another.

{
    "config": {
        "barMode": "stack",
        "binSpec": {
            "type": "binWidth",
            "value": 6.67
        },
        "outputEntityId": "OBI_0002732",
        "overlayConfig": {
            "overlayType": "categorical",
            "overlayValues": [
                "Aedes vexans",
                "Culex pipiens morphological group",
                "Anopheles <subgenus>",
                "Culex tarsalis",
                "Culex nigripalpus",
                "Anopheles punctipennis",
                "Culex erraticus",
                "__UNSELECTED__"
            ],
            "overlayVariable": {
                "entityId": "EUPATH_0000609",
                "variableId": "OBI_0001909"
            }
        },
        "valueSpec": "count",
        "xAxisVariable": {
            "entityId": "OBI_0002732",
            "variableId": "OBI_0002993"
        }
    },
    "filters": [
        {
            "entityId": "OBI_0000659",
            "max": "1948-11-04T00:00:00Z",
            "min": "1940-07-22T00:00:00Z",
            "type": "dateRange",
            "variableId": "EUPATH_0043256"
        },
        {
            "entityId": "GAZ_00000448",
            "max": 84.89714695160268,
            "min": -68.9110048456202,
            "type": "numberRange",
            "variableId": "OBI_0001620"
        },
        {
            "entityId": "GAZ_00000448",
            "left": -177.36328124,
            "right": -177.36328125,
            "type": "longitudeRange",
            "variableId": "OBI_0001621"
        }
    ],
    "studyId": "VBP_MEGA"
}

I'm pretty sure the requests are identical apart from the filters.