-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34695 from dimagi/cs/SC-3593-geo-max-distance-and…
…-travel Implement max distance and travel criteria for geospatial disbursement algorithm.
- Loading branch information
Showing
16 changed files
with
433 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
corehq/apps/geospatial/migrations/0007_geoconfig_max_case_distance_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.11 on 2024-05-31 07:44 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('geospatial', '0006_geoconfig_max_cases_per_user_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='geoconfig', | ||
name='max_case_distance', | ||
field=models.IntegerField(null=True), | ||
), | ||
migrations.AddField( | ||
model_name='geoconfig', | ||
name='max_case_travel_time', | ||
field=models.IntegerField(null=True), | ||
), | ||
migrations.AddField( | ||
model_name='geoconfig', | ||
name='travel_mode', | ||
field=models.CharField(choices=[('walking', 'Walking'), ('cycling', 'Cycling'), ('driving', 'Driving')], default='driving', max_length=50), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 0 additions & 136 deletions
136
corehq/apps/geospatial/routing_solvers/mapbox_optimize.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import jsonschema | ||
|
||
|
||
def validate_routing_request(request_json): | ||
schema = { | ||
"type": "object", | ||
"properties": { | ||
"users": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/location" | ||
} | ||
}, | ||
"cases": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/location" | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"location": { | ||
"type": "object", | ||
"properties": { | ||
"lon": { | ||
"type": ["string", "number"], | ||
"description": "longitude" | ||
}, | ||
"lat": { | ||
"type": ["string", "number"], | ||
"description": "latitude" | ||
}, | ||
"id": { | ||
"type": "string", | ||
"description": "id or pk" | ||
} | ||
}, | ||
"required": ["lon", "lat", "id"] | ||
} | ||
}, | ||
"required": ["users", "cases"] | ||
} | ||
jsonschema.validate(request_json, schema) |
Oops, something went wrong.