diff --git a/.cursor/rules/techstackrule.mdc b/.cursor/rules/techstackrule.mdc index 9dca0ac..b0ccf92 100644 --- a/.cursor/rules/techstackrule.mdc +++ b/.cursor/rules/techstackrule.mdc @@ -5,7 +5,8 @@ alwaysApply: true # Tech Stack - We use Microsoft .Net 8.0 - ASP.NET Web Api for rest API -- Using Postgres database +- Using Postgres database as a primary storage +- We use Dapper .Net as an ORM for SQL storage and we use database migrations for sql database schema - We use OpenAPI and Swagger for documentation - We will be running this service inside a docker container on linux - We use Xunit and Moq for tests \ No newline at end of file diff --git a/goal.md b/goal.md new file mode 100644 index 0000000..5fd97e6 --- /dev/null +++ b/goal.md @@ -0,0 +1,43 @@ +# High level description + +We need to implement a service which will have the following high level functionality: + +1. Download map tiles with from google maps for specific area which is defined by: +- Zoom level (default - maximum zoom in google maps) +- Lattitude (center of square) +- Longitude (center of square) +- Size of the square in meters, minimum 100 meters, maximum 1000 meters + +2. Store downloaded tiles and its metadata +- We should store tiles "as is" just like google maps returns them in folder /tiles (which will be mounted to the docker container where the service is running) +- We should store metadata in Postgres database in table "tiles". We should store the following information: +-- Unique UUID +-- Zoom level +-- Lattitude (center of square) +-- Longitude (center of square) +-- Tile size in meters (per google maps data) +-- Tile size in pixels +-- Composite key - it should be a combination of Lattitude, Longitude and Tile size in meters for fast lookups or search +-- Image type +-- Maps version (google maps can update maps over time) +-- File path relative to the folder where tiles are stored + +3. Request maps for certain region +We should have API endpoint POST /api/satellite/request which will do the following: +- Request map tiles for the region defined by +-- Unique ID (region UUID) +-- Lattitude (center of square) +-- Longitude (center of square) +-- Size of the square in meters, minimum 100 meters, maximum 10000 meters +- Use previously stored tiles and metadata, if tiles are missing it should download them (see above) +- When all tiles are ready, it should create a file region_{id}_ready.csv in folder /ready (which will be mounted to the docker container where the service is running) +-- The file should have comma separated data with coordinates and filenames from /tiles folder covering the region +-- Rows sequence should represent tiles from top left corner to bottom right corner of the region +-- Create file region_{id}_summary.txt where write a summary of how many tiles were downloaded, how many we reused from cache, time taken and othe usefull summary information +- API endpoint GET /api/satellite/region/{id} should return path to file region_{id}_ready.csv when all tiles are ready and the file is created, otherwise it should return response indicating that download is in progress. + +The service will be running in docker container, we also need to run postgres database also in docker container. I also want to use integration tests as a separate app running as a console app in a separate docker container. We would need two docker compose files: +- docker-compose.svc.yml - will run the service and its dependencies +- docker-compose.tests.yml - will run the integration tests, the service and its dependencies + +We have legacy code which already implements downloading tiles using google map, you can use it for reference. But don't directly copy code as we might have different structure and different requirements. You might find there api key for google maps, feel free to use it. Legacy code is here: ../dev/annotator/Azaion.Common/Services/SatelliteDownloader.cs \ No newline at end of file