Subject: "DiseΓ±o de sistemas"
This is a mirrored repository of the project I did for "ProgramaciΓ³n I" (Programming) at Universidad de Mendoza. For more information, go to https://github.com/estebanarivasv/Seismology-Flask
The aim of this repository is emphasize software design patterns and best software practices.
Given the task, I've designed my project structure with the Modelβviewβcontroller (MVC) software design pattern.
.
βββ app.py -- App instance
βββ database -- SQLite db
βΒ Β βββ data.db
βββ insomnia_requests.json
βββ main
βΒ Β βββ __init__.py
βΒ Β βββ controllers -- HTTP Requests jsons handling
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ seism.py
βΒ Β βΒ Β βββ sensor.py
βΒ Β βΒ Β βββ user.py
βΒ Β βββ extensions -- Main components initialization
βΒ Β βΒ Β βββ __init__.py
βΒ Β βββ mapping -- JSON dictionaries mapping for db
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ seism.py
βΒ Β βΒ Β βββ sensor.py
βΒ Β βΒ Β βββ user.py
βΒ Β βββ models -- Database models
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ seism.py
βΒ Β βΒ Β βββ sensor.py
βΒ Β βΒ Β βββ user.py
βΒ Β βββ repositories -- CRUD Methods for the controllers interacting with the db
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ main.py
βΒ Β βΒ Β βββ seism.py
βΒ Β βΒ Β βββ sensor.py
βΒ Β βΒ Β βββ user.py
βΒ Β βββ resources
βΒ Β βΒ Β βββ authentication
βΒ Β βΒ Β βΒ Β βββ decorators.py -- Controllers restriction
βΒ Β βΒ Β βΒ Β βββ routes.py -- Auth routes
βΒ Β βΒ Β βββ functions.py -- get_near_seisms() - Pandas
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ pagination.py -- Model used in repositories
βΒ Β βΒ Β βββ validators.py -- Objects validation used in repositories
βΒ Β βββ services
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ jobs
βΒ Β βΒ Β βΒ Β βββ functions.py -- get_seisms_from_api(), get_ids_to_delete()
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ tasks.py -- seisms_achiever, data_persistance
βΒ Β βΒ Β βββ mail_sending -- Email admins of not working sensors
βΒ Β βΒ Β Β Β βββ controller.py
βΒ Β βΒ Β Β Β βββ resources.py
βΒ Β βββ templates -- Email templates
βΒ Β βββ mail
βΒ Β βββ sensors_status.html
βΒ Β βββ sensors_status.txt
βββ requirements.txt
.
βββ app
βΒ Β βββ app.component.html -- ROUTER IMPLEMENTATION, Bootstrap CDN
βΒ Β βββ app.constants.ts -- API URL
βΒ Β βββ app.module.ts -- Dependencies, Bootstrap CDN
βΒ Β βββ app-routing.module.ts -- ROUTING, Bootstrap CDN
βΒ Β βββ app-sorting.directive.ts
βΒ Β βββ alerts
βΒ Β βΒ Β βββ alerts.service.ts
βΒ Β βββ authentication
βΒ Β βΒ Β βββ authentication.component.html -- Login template
βΒ Β βΒ Β βββ authentication.component.ts
βΒ Β βΒ Β βββ authentication.service.ts -- Api authentication interaction
βΒ Β βΒ Β βββ guards -- Limit routing
βΒ Β βΒ Β βββ interceptors
βΒ Β βββ guards
βΒ Β βββ header
βΒ Β βΒ Β βββ header.component.html
βΒ Β βββ home
βΒ Β βΒ Β βββ home.component.html
βΒ Β βββ pagination.model.ts
βΒ Β βββ seisms
βΒ Β βΒ Β βββ seisms-filter.model.ts -- Seisms pagination, sorting and filter model
βΒ Β βΒ Β βββ seisms.model.ts -- Seisms model for requests mapping
βΒ Β βΒ Β βββ seisms.service.ts -- Seisms components interaction with HTTP requests
βΒ Β βΒ Β βββ unverified-seisms
βΒ Β βΒ Β βΒ Β βββ edit-unverified
βΒ Β βΒ Β βΒ Β βββ unverified-seisms.component.html
βΒ Β βΒ Β βΒ Β βββ unverified-seisms.component.ts
βΒ Β βΒ Β βΒ Β βββ view-unverified
βΒ Β βΒ Β βββ verified-seisms
βΒ Β βΒ Β βββ verified-seisms.component.html
βΒ Β βΒ Β βββ verified-seisms.component.ts
βΒ Β βΒ Β βββ view-verified
βΒ Β βββ sensors
βΒ Β βΒ Β βββ add-sensor
βΒ Β βΒ Β βββ check-sensor
βΒ Β βΒ Β βββ delete-sensor
βΒ Β βΒ Β βββ edit-sensor
βΒ Β βΒ Β βββ sensors.component.html
βΒ Β βΒ Β βββ sensors.component.ts
βΒ Β βΒ Β βββ sensors-filter.model.ts -- Sensors pagination, sorting and filter model
βΒ Β βΒ Β βββ sensors.model.ts -- Sensors model for requests mapping
βΒ Β βΒ Β βββ sensors.service.ts -- Sensors component interaction with HTTP requests
βΒ Β βΒ Β βββ view-sensor
βΒ Β βββ upper-body -- BREADCRUMBS, TITLE
βΒ Β βΒ Β βββ upper-body.component.html
βΒ Β βΒ Β βββ upper-body.component.ts
βΒ Β βΒ Β βββ upper-body.interfaces.ts
βΒ Β βββ users
βΒ Β βββ add-user
βΒ Β βββ delete-user
βΒ Β βββ edit-user
βΒ Β βββ users.component.html
βΒ Β βββ users.component.ts
βΒ Β βββ users.model.ts -- Users model for requests mapping
βΒ Β βββ users.service.ts -- Users component interaction with HTTP requests
βββ assets
βΒ Β βββ img
βΒ Β βββ videos
βββ environments
βββ favicon.ico
βββ index.html
βββ main.ts
βββ polyfills.ts
βββ styles.scss
βββ test.ts
- DRY, KISS, SOLID
- Command -> Repositories
- Observer -> .suscribe() Angular services (async)
At the beginning, I had the REST Api from the base repository from where I started. Here it is the full description of what I did:
DB Models Schemas creation (flask-marshmallow). to_json(), from_json() deletion.
Modularity. Controllers -> HTTP Requests
General Pagination class
Modularity. Repositories -> DB interaction
Modularity. Reorganizing: auth, various functions for services, validators, pagination
Jobs: data persistance, data obtention
Views design: home, seisms, sensors, users
HTTP Requests
Reactive forms on add and edit views
Service that displays alerts
Template-driven forms. Filter models, NgbdSortableHeader, ngb-pagination
Auth service, HttpRequestsInterceptor, Guard
- CSV download
- Email sending integration
- Near seisms from input location
- Api validation
- Guards
- New framework, new languaje
- Time
Steps to follow in order to get the Flask app and Angular client up and running
You can rename the .env-example file to .env
β Remember you need to declare all the variables including the database path.
To begin the instalation of libraries and the frameworks needed: ./install.sh
and npm install
To get the app running: ./boot.sh
and ng serve