Note: The server will automatically check database connectivity at startup and will exit if the PostgreSQL database is not responding.
If you encounter permission errors when accessing the API (such as "permission denied for table events"), run the setup script again to ensure proper permissions:
```
./setup_db.sh
```
You can also test database permissions with:
```
./test_permissions.sh
```
Or specifically test permissions on the events table:
```
./test_table_permissions.sh
```
### Environment Variables
-`DB_NAME`: Database name (default: "oedb")
-`DB_HOST`: Database host (default: localhost)
-`DB_USER`: Database user (default: postgres)
-`POSTGRES_PASSWORD`: Database password
-`NEW_USER`: New PostgreSQL user to create with full permissions (default: "oedb_user")
-`NEW_PASSWORD`: Password for the new PostgreSQL user (default: "oedb_password")
### Mock Data
The repository includes scripts to create and check mock events in the database:
1. Create mock events:
```
./create_mock_events.py
```
This script creates 18 mock events (3 for each category: traffic, nature, weather, sport, conference, party) with start dates slightly before the current date and end dates far in the future.
2. Check mock events:
```
./check_mock_events.py
```
This script checks the mock events in the database, showing counts by category and date ranges for each event.
### API Documentation
The OpenEventDatabase API allows you to search for events using various query parameters. You can filter events by:
For detailed information about the available query parameters, examples, and response format, see the [API Query Parameters Documentation](API_QUERY_PARAMS.md).
The API includes a dedicated search endpoint (`/event/search`) that allows you to search for events using a GeoJSON geometry in the request body. This is particularly useful for complex spatial queries. For more information, see the [Search Endpoint Documentation](SEARCH_ENDPOINT.md).
#### Anti-Spam and Caching Measures
The API implements caching and rate limiting to improve performance and prevent abuse. For more information about these measures, see the [Anti-Spam and Caching Measures Documentation](ANTI_SPAM_MEASURES.md).
#### Testing
A comprehensive test plan is available for verifying the functionality of the API, including caching, rate limiting, and search features. See the [Test Plan](TEST_PLAN.md) for details.
#### Swagger Documentation
Have a look at the swagger file for a complete API reference:
`swagger.json`
# Todo
page de démo listant les évènements selon leur type, les afficher sur une carte.
créer une page de démo qui permet de modifier un évènement, faire un lien vers cette page quand on ouvre une popup d'évènement sur la page de /demo. et afficher une icone pour les marqueurs de carte selon le type d'évènement, définis en quelques uns et utilise les icones de bulma css.
vérifier le fonctionnement des endpoints de recherche avec les queryparameters, les mettre dans la page de démo.