API and database schema are documented in the docs directory.
cp .env.example .envedit .env
Install dependencies using Poetry. Poetry will create a dedicated virtual environment for the project when installing packages.
pip install poetry
poetry install
`poetry env activate`Run server from within the Poetry shell
set -a; . <(grep -v '^#' .env | grep -v '^$' | sed -e "s/=/='/" -e "s/$/'/")
python3 -m app.mainRun tests from the Poetry shell
python tests/test_analytics.pyBuild image
docker build -t llm-analytics:latest . Run server
docker run --rm -it --network=host --env-file .env --name llm-analytics llm-analytics--network=host is needed to access local db
You can use health check to detect if an application is running. It is available via the /health route, which responds
with HTTP code 200.
get auth token from keycloak and then do POST:
curl http://localhost:8000/llm-analytics \
-H 'Authorization: Bearer your_long_auth_token' \
-H 'Content-Type: application/json' \
-d '{
"appId": "9043acf9-2cf3-48ac-9656-a5d7c4b7593d",
"features": {
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-77.034084142948, 38.909671288923],
[-77.034084142948, 38.919671288923],
[-77.014084142948, 38.919671288923],
[-77.014084142948, 38.909671288923],
[-77.034084142948, 38.909671288923]
]
]
},
"properties": {
"name": "Area name"
}
}
}'also works with FeatureCollection:
curl http://localhost:8000/llm-analytics \
-H 'Authorization: Bearer your_long_auth_token' \
-H 'Content-Type: application/json' \
-d '{
"appId": "9043acf9-2cf3-48ac-9656-a5d7c4b7593d",
"features": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-77.034084142948, 38.909671288923],
[-77.034084142948, 38.919671288923],
[-77.014084142948, 38.919671288923],
[-77.014084142948, 38.909671288923],
[-77.034084142948, 38.909671288923]
]
]
}
}
]
}
}'