goat-community / goat

This is the home of Geo Open Accessibility Tool (GOAT)
GNU General Public License v3.0
89 stars 47 forks source link

Check to limit POis for multisochrone based on mode #2017

Closed EPajares closed 9 months ago

EPajares commented 1 year ago

Limit this in the client and backend.

EPajares commented 1 year ago

we need a logic that the superuser can compute more

metemaddar commented 1 year ago

According to IsochroneMultiCountPois which is needed to check the POI count: https://github.com/goat-community/goat/blob/fe6d6e2625f99624d6973593786df7997768f419/app/api/src/schemas/isochrone.py#L19-L28

We can extract data from IsochroneDTO and request as following:

IsochroneMultiCountPois IsochroneDTO
user_id from request
scenario_id dto.scenario.id
amenities dto.starting_point.input
minutes dto.settings.travel_time
modus dto.scenario.modus
region dto.starting_point.region
region_type dto.starting_point.region_type
speed dto.settings.speed
active_upload_ids user.active_data_upload_ids

Is this right? And as active_udata_upload_ids can be determined by user_id, we might remove the active_upload_ids from the schema and fetch it from database.

metemaddar commented 1 year ago

by Majk:

@metemaddar I don't think we should remove it. In most of the cases this will be same as user.active_data_upload_ids However there is also an option for admin users to use other upload_ids (from other users)

metemaddar commented 1 year ago

@majkshkurti

I have a question. When we check for data_uploads, it means it is included in calculation. How we send the active_upload_ids by IsochroneDTO?

metemaddar commented 1 year ago

Examples of MultiCountPOIs

Region type: Polygon

{
    "region_type": "draw",
    "region": [
        "POLYGON((11.490978831171034 48.15763631068103,11.504119794590654 48.19385681112024,11.561940033636978 48.18159144269791,11.550113166559319 48.147700413146,11.490978831171034 48.15763631068103))"
    ],
    "scenario_id": 0,
    "modus": "default",
    "routing_profile": "walking_standard",
    "minutes": 10,
    "speed": 5,
    "amenities": [
        "kindergarten"
    ]
}

DTO

{
    "mode": "walking",
    "settings": {
        "travel_time": 20,
        "speed": 5,
        "walking_profile": "standard"
    },
    "starting_point": {
        "input": [
            "kindergarten"
        ],
        "region_type": "draw",
        "region": [
            "POLYGON((11.490978831171034 48.15763631068103,11.504119794590654 48.19385681112024,11.561940033636978 48.18159144269791,11.550113166559319 48.147700413146,11.490978831171034 48.15763631068103))"
        ]
    },
    "scenario": {
        "id": 0,
        "modus": "default"
    },
    "output": {
        "type": "grid",
        "resolution": 13
    }
}

Region type: sub study area

{
    "region_type": "study_area",
    "region": [
        95
    ],
    "scenario_id": 0,
    "modus": "default",
    "routing_profile": "walking_standard",
    "minutes": 10,
    "speed": 5,
    "amenities": [
        "kindergarten"
    ]
}

DTO

{
    "mode": "walking",
    "settings": {
        "travel_time": 20,
        "speed": 5,
        "walking_profile": "standard"
    },
    "starting_point": {
        "input": [
            "kindergarten"
        ],
        "region_type": "study_area",
        "region": [
            "95"
        ]
    },
    "scenario": {
        "id": 0,
        "modus": "default"
    },
    "output": {
        "type": "grid",
        "resolution": 13
    }
}