Skip to content

An application for the management and use of the Master Plan of a municipality of Fano with ~250,000 inhabitants.

License

Notifications You must be signed in to change notification settings

fuzsh/UNIPD_GIS_MASTER_PLAN

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Table of Contents
  1. About The Project
  2. License

About The Project

The primary objective of this project is to develop an advanced Geographic Information System (GIS) application tailored for the management and uti- lization of the Master Plan of the Italian province of Fano with a population of approximately 250,000 inhabitants, Fano’s Master Plan serves as a crucial blueprint for urban and territorial development. This project seeks to address the specific needs of planners and the general public, offering them a platform that facilitates the creation, maintenance, and accessibility of plan variants, thus fostering efficient urban planning and informed decision-making.

Project Structure

Main Structure

Agora
├── backend
│   ├── app
│   ├── Dockerfile
│   ├── Dockerfile.without_k8s
├── environment.env
├── docker-compose.yml
├── README.md

Inside the app folder we have the main application + the initial_data.py script that fetch the data from sitemap and fill the db with it, and the pyproject.toml file that contains the dependencies of the project.

App Structure

App
├── app
│   ├── api
│   │   ├── v1 -> endpoint to get the data (content)
│   ├── core (contains config)
│   ├── crud (contains crud operations)
│   ├── db (used for init database & session management)
│   ├── models
│   ├── schemas
│   ├── utils
│   ├── initial_data.py (script to fetch data from sitemap and fill the db)
│   ├── main.py (main application)
├── pyproject.toml
├── poetry.lock

Components Schema

Models

After adding models to the models folder you should create crud and schema for them in the crud and schemas folder respectively.

Database Schema

Crud & Schemas

We have base_crud.py that contains the base crud operations that we can use for all models like get_all, get_by_id, create, update, delete and ... . And if you need some specific crud operations for a model you can define the function in a crud file related to that model.

In schemas folder for each model we have three different schemas for each model:

  • IModelRead that contains the fields that we can read from the model
  • IModelCreate that contains the fields that we can create the model with
  • IModelUpdate that contains the fields that we can update the model with, this one can use with decorator @optional to make the fields optional
  • IModel... that match your needs

API

In the api folder we have the endpoints that we can use to get the data from the db.

Define your endpoint as route under router = APIRouter() and write your function under it.

main.py

Set up the application and add the routers to it. Also, we add middleware to the application to handle CORS and add the db to the application, this way we can use db in our endpoints without initializing session each time in each endpoint.


How to run

Docker

This command will build the image and run the container

docker-compose up --build

In command section of docker-compose.yml we have two commands:

  • python app/initial_data.py to create the db and fill it with initial data that fetch from sitemap
  • uvicorn app.main:app --workers 5 --host 0.0.0.0 --port 8000 to run the server

Debugging and adding new code

For debugging or add new code to the project you can add --reload to the command to reload the server when you change the code in the command section of docker-compose.yml

command: bash -c "python app/initial_data.py && uvicorn app.main:app --reload --workers 5 --host --host 0.0.0.0 --port 8000`

But consider that when you add --reload to the command the --workers parameter will be ignored and the server will run with one worker.

Environment Variables

For adding environment variables to the docker-compose.yml or your application you can add them to the environment.env file in the root of the project.

Built With

FastApi OpenJump GeoServer Docker PostgreSQL Leaflet

(back to top)

Contributors

  • Farzad Shami

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)


Part of Geographic Information Systems 2022-2023 course of University of Padova

About

An application for the management and use of the Master Plan of a municipality of Fano with ~250,000 inhabitants.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published