From f1a47c962181dee72be1bc0a1b55f263bb7cc1dd Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 22 Dec 2023 10:59:44 +0100 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=93=9D=20First=20try=20to=20embed=20a?= =?UTF-8?q?=20video=20in=20the=20readme=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/README.md b/backend/README.md index e69de29..c3791ac 100644 --- a/backend/README.md +++ b/backend/README.md @@ -0,0 +1,9 @@ + + +# Architecture + + + +The following schema shows the components used to satisfy the `api` service: + +![API](./docs/medias/hubble-ui_api.png) From b7ed3f83b84f36c683b5143c3e2a1fa1fbcf5b47 Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 22 Dec 2023 11:03:29 +0100 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=93=9D=20Add=20main=20readme=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..579307c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Carrramba-encore-rate + +[![Presentation]](https://git.adrien.run/Adrien/carrramba-encore-rate/src/branch/develop/medias/presentation.mp4) From 93625f12b1d9e53feeaa0904e9021274d52f98a8 Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 22 Dec 2023 11:27:30 +0100 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=93=9D=20Add=20thumbnail=20to=20the?= =?UTF-8?q?=20presentation=20video?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 3 ++- README.md | 2 +- medias/presentation.png | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 medias/presentation.png diff --git a/.gitattributes b/.gitattributes index f8ff2b5..84e8f47 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -*.mp4 filter=lfs diff=lfs merge=lfs -text +medias/presentation.png filter=lfs diff=lfs merge=lfs -text +medias/presentation.mp4 filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index 579307c..8f4e07f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Carrramba-encore-rate -[![Presentation]](https://git.adrien.run/Adrien/carrramba-encore-rate/src/branch/develop/medias/presentation.mp4) +[![Presentation](medias/presentation.png)](medias/presentation.mp4) diff --git a/medias/presentation.png b/medias/presentation.png new file mode 100644 index 0000000..1f34b48 --- /dev/null +++ b/medias/presentation.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d80c5d49bb2bfe87e01bad8fc10b7e4510d2d3abe838b18b0e0f65acdf44d1a9 +size 1650857 From e9a13c662e624f0dddb09919f81b8b0468077ead Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 22 Dec 2023 11:36:01 +0100 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=93=9D=20Change=20the=20presentation?= =?UTF-8?q?=20video=20chroma=20subsampling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cf. https://bugzilla.mozilla.org/show_bug.cgi?id=1368063 --- medias/presentation.mp4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/medias/presentation.mp4 b/medias/presentation.mp4 index caeafe3..9bf05b4 100644 --- a/medias/presentation.mp4 +++ b/medias/presentation.mp4 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fb3ff8bc94dac81d3647171e2a56abf3913c84eac0b7f379d811aa4429a516cc -size 3954325 +oid sha256:3e6b18766b07bf3c968dd622e057d033cff13fb7b74bea60b20442f1b8b9ab1e +size 3896072 From c52fc6956082a89bdfab76801ccee975c6437a5d Mon Sep 17 00:00:00 2001 From: Adrien Date: Sat, 6 Jan 2024 13:32:17 +0100 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=9A=A7=20Add=20plantuml=20block=20to?= =?UTF-8?q?=20the=20README=20to=20test=20gitea=20rendering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 8f4e07f..b1d0601 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ # Carrramba-encore-rate +# 🚧 Carrramba-encore-rate 🚧 + [![Presentation](medias/presentation.png)](medias/presentation.mp4) +```plantuml +@startuml +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml + +AddElementTag("v1.0", $borderColor="#d73027") +AddElementTag("v1.1", $fontColor="#d73027") +AddElementTag("backup", $fontColor="orange") + +AddRelTag("backup", $textColor="orange", $lineColor="orange", $lineStyle = DashedLine()) + +Person(user, "Customer", "People that need products") +Person(admin, "Administrator", "People that administrates the products via the new v1.1 components", $tags="v1.1") +Container(spa, "SPA", "angular", "The main interface that the customer interacts with via v1.0", $tags="v1.0") +Container(spaAdmin, "Admin SPA", "angular", "The administrator interface that the customer interacts with via new v1.1", $tags="v1.1") +Container(api, "API", "java", "Handles all business logic (incl. new v1.1 extensions)", $tags="v1.0+v1.1") +ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information") +Container(archive, "Archive", "Audit logging", "Stores 5 years", $tags="backup") + +Rel(user, spa, "Uses", "https") +Rel(spa, api, "Uses", "https") +Rel_R(api, db, "Reads/Writes") +Rel(admin, spaAdmin, "Uses", "https") +Rel(spaAdmin, api, "Uses", "https") +Rel_L(api, archive, "Writes", "messages", $tags="backup") + +SHOW_LEGEND() +@enduml +``` From 60ce90b633f5539e9df625e075a5ff8bf87bf98d Mon Sep 17 00:00:00 2001 From: Adrien Date: Sat, 6 Jan 2024 17:45:58 +0100 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=9A=A7=20Add=20C4=20Container=20diagr?= =?UTF-8?q?am?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 54 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b1d0601..781fb3d 100644 --- a/README.md +++ b/README.md @@ -5,29 +5,45 @@ [![Presentation](medias/presentation.png)](medias/presentation.mp4) ```plantuml @startuml -!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml +!include -AddElementTag("v1.0", $borderColor="#d73027") -AddElementTag("v1.1", $fontColor="#d73027") -AddElementTag("backup", $fontColor="orange") +!define ICONURL https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/v2.4.0 +!includeurl ICONURL/common.puml -AddRelTag("backup", $textColor="orange", $lineColor="orange", $lineStyle = DashedLine()) +!includeurl ICONURL/font-awesome-5/users.puml +!includeurl ICONURL/devicons2/redis.puml +!includeurl ICONURL/devicons2/sqlalchemy.puml +!includeurl ICONURL/devicons2/postgresql.puml -Person(user, "Customer", "People that need products") -Person(admin, "Administrator", "People that administrates the products via the new v1.1 components", $tags="v1.1") -Container(spa, "SPA", "angular", "The main interface that the customer interacts with via v1.0", $tags="v1.0") -Container(spaAdmin, "Admin SPA", "angular", "The administrator interface that the customer interacts with via new v1.1", $tags="v1.1") -Container(api, "API", "java", "Handles all business logic (incl. new v1.1 extensions)", $tags="v1.0+v1.1") -ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information") -Container(archive, "Archive", "Audit logging", "Stores 5 years", $tags="backup") +title Carrramba-encore-rate - Back-end -Rel(user, spa, "Uses", "https") -Rel(spa, api, "Uses", "https") -Rel_R(api, db, "Reads/Writes") -Rel(admin, spaAdmin, "Uses", "https") -Rel(spaAdmin, api, "Uses", "https") -Rel_L(api, archive, "Writes", "messages", $tags="backup") +LAYOUT_WITH_LEGEND() -SHOW_LEGEND() +Person(user, "User", "The service user", $sprite="users") + +System_Boundary(cb1, "carrramba-encore-rate") { + Container(app, "SPA", "SolidJS", "The graphical interface used by users to consume services provided") + Container(api, "carrramba-encore-rate-api", "FastAPI / SQLAlchemy", "Provides the functionalities serving API endpoints", $sprite="sqlalchemy") + ContainerDb(db, "Postgres", "PostgreSQL database", "Stores stops/stop areas/lines/shapes and associations information.", $sprite="postgresql") + ContainerDb(cache, "In-Memory cache", "Redis", "Store previously computed results (stop, line, destination, next passages, shapes).", $sprite="redis") + + Container(db_updater, "db-updater", "Sync the service static data with the IDFM ones") +} + +System_Boundary(idfm, "IDFM") { + Container_Ext(static_, "Static data") + Container_Ext(dynamic_, "Dynamic data") +} + +Rel(user, app, "Uses") + +Rel(app, api, "Uses", "JSON/HTTPS") + +Rel_R(api, db, "Reads from", "sync, PSQL") +Rel_L(api, cache, "Reads from and writes to", "sync, REdis Serialization Protocol") +Rel(api, dynamic_, "Get next passages", "JSON/HTTPS") + +Rel_L(db_updater, db, "Writes to", "sync, PSQL") +Rel(db_updater, static_, "Get stops, lines andshapes") @enduml ``` From 4236f33cb96b4d2cc24ef23594ddc136c2877f7a Mon Sep 17 00:00:00 2001 From: Adrien Date: Sun, 7 Jan 2024 11:19:14 +0100 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=93=9D=20Add=20technical=20stack=20de?= =?UTF-8?q?scription=20to=20the=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 781fb3d..6838319 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,18 @@ -# Carrramba-encore-rate -# 🚧 Carrramba-encore-rate 🚧 +Resident of the Ile-de-France, + +- Tired of missing your bus/train/metro ? +- Tired of having to walk to know where your bus/train/metro will stop ? +- Are you looking to display its next passages in the same way as Ile De France Mobilité ? + +**Visit [carrramba.adrien.run](https://carrramba.adrien.run/)** [![Presentation](medias/presentation.png)](medias/presentation.mp4) + +# Technical stack + +The following figure list the building blocks (docker images) and their interactions to provide the service: + ```plantuml @startuml !include @@ -23,7 +33,7 @@ Person(user, "User", "The service user", $sprite="users") System_Boundary(cb1, "carrramba-encore-rate") { Container(app, "SPA", "SolidJS", "The graphical interface used by users to consume services provided") - Container(api, "carrramba-encore-rate-api", "FastAPI / SQLAlchemy", "Provides the functionalities serving API endpoints", $sprite="sqlalchemy") + Container(api, "carrramba-encore-rate-api", "FastAPI / Pydantic 2 / SQLAlchemy 2", "Provides the functionalities serving API endpoints", $sprite="sqlalchemy") ContainerDb(db, "Postgres", "PostgreSQL database", "Stores stops/stop areas/lines/shapes and associations information.", $sprite="postgresql") ContainerDb(cache, "In-Memory cache", "Redis", "Store previously computed results (stop, line, destination, next passages, shapes).", $sprite="redis") @@ -47,3 +57,57 @@ Rel_L(db_updater, db, "Writes to", "sync, PSQL") Rel(db_updater, static_, "Get stops, lines andshapes") @enduml ``` + +## Back-end + +Conventional but efficient: + +- [FastAPI](https://fastapi.tiangolo.com/): _FastAPI is a modern, fast (high-performance), web framework for building + APIs with Python 3.8+ based on standard Python type hints._ +- [Pydantic 2](https://docs.pydantic.dev/latest/): _Pydantic is the most widely used data validation library for + Python._ +- [Sqlalchemy 2](https://www.sqlalchemy.org/): _SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that + gives application developers the full power and flexibility of SQL._ + +The [Msgspec](https://github.com/jcrist/msgspec) library is used to serialize JSON objects collected from IDFM API +endpoints, this library being faster than Pydantic. + +## Front-end + +The component is developed using the [SolidJS](https://www.solidjs.com/) library. It brings the following interesting specificities: + +- Share with React the same programmatic structures and support for component. +- Fine-grained reactivity architecture: no virtual DOM used to update the components, the browser DOM is directly + updated by SolidJS. + +The front-end tries to be as close as possible to the design defined by the IDFM for the displays deployed by the +transport operators in Ile-de-France. These specifications are public and available here: +[PRIM-IDFM](https://prim.iledefrance-mobilites.fr/en/chartes-et-prescriptions). + + +# TODO + +## Features + +- [ ] Integration with [Matrix.org](https://matrix.org/ecosystem/integrations/) ecosystem: make the app able to send message to a room when a bus/train/metro will + arriving in X minutes. +- [ ] Add the capability for the users to pin his/her favorite stops. +- [ ] Add the address to the stop location. + +## Front-end + +- [ ] Add unit tests. +- [ ] Make the StopNameInput component liquid. +- [ ] Liquid to responsive Design. + +## Back-end + +- [ ] Add unit tests. +- [ ] Use [alembic](https://alembic.sqlalchemy.org/en/latest/) to manage the future updates of the database schemas. +- [ ] Add the capability to reload the application configuration on configuration file update (e.g.: credential update by the vault). +- [ ] Rework how the database is updated with the IDFM data: For now the database is cleaned before refilling. It could + be useful to avoid to empty the database and only apply deltas (update/add/remove rows). +- [ ] Could be nice to compare FastAPI with [Litestar](https://litestar.dev/). + +