From 7422f1147cb69f6bdf2d2cc97fe718e4bea3103e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Thu, 7 Dec 2023 22:28:05 -0300
Subject: [PATCH 001/244] Initial commit
---
.gitignore | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++
LICENSE | 21 +++++++
README.md | 2 +
3 files changed, 183 insertions(+)
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 README.md
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..68bc17f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,160 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+cover/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# For a library or package, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# .python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# poetry
+# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
+# This is especially recommended for binary packages to ensure reproducibility, and is more
+# commonly ignored for libraries.
+# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
+#poetry.lock
+
+# pdm
+# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
+#pdm.lock
+# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
+# in version control.
+# https://pdm.fming.dev/#use-with-ide
+.pdm.toml
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
+
+# PyCharm
+# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
+# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
+# and can be added to the global gitignore or merged into this file. For a more nuclear
+# option (not recommended) you can uncomment the following to ignore the entire idea folder.
+#.idea/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..25adb03
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 Fabián Abarca
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7655b2b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# gtfs-screens
+Implementación de pantallas con GTFS
From cef08de61523c6f5da039f099a8353387876548c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Fri, 15 Dec 2023 14:30:51 -0300
Subject: [PATCH 002/244] Create ARCHITECTURE.md
Esbozo de la estructura
---
ARCHITECTURE.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
create mode 100644 ARCHITECTURE.md
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
new file mode 100644
index 0000000..f30c833
--- /dev/null
+++ b/ARCHITECTURE.md
@@ -0,0 +1,69 @@
+# Descripción del servidor de aplicaciones para pantallas con información GTFS Realtime
+
+## Tareas esenciales del servidor
+
+1. Periódicamente recopilar los `FeedMessage` de GTFS Realtime (este es el servidor "hermano" `gtfs-realtime`).
+2. Organizar la información contenida para cada pantalla, según sea relevante (ejemplo: clasificar los viajes que van a pasar por esa parada (asumiendo que las pantallas están en o cerca de una parada), o anuncios de alertas que sean relevantes para el servicio en esa pantalla, etc.).
+3. (Opcional) Cargar la plantilla HTML en el navegador de la pantalla cuando se carga el sitio por primera vez (ejemplo: al prender las pantallas).
+4. Actualizar la información desplegada en las pantallas utilizando los WebSockets de Django.
+
+## Aplicaciones y sitios del proyecto de Django
+
+### Django app: `website`
+
+- `/`: Página de bienvenida del sistema
+
+#### Modelos asociados
+
+`class User`: Información de usuarios del sistema
+
+### Django app: `screens`
+
+- `/pantallas/`: Lista de pantallas del sistema
+- `/pantallas/crear`: Página de creación de nueva pantalla
+- `/pantallas//`: Visualización de la pantalla (contenido)
+- `/pantallas//configuracion/`: Sitio de configuración de la pantalla `screen_id`
+
+
+Nota: las pantallas por ahora asumimos que son Raspberry Pi en [modo kiosko](https://www.raspberrypi.com/tutorials/how-to-use-a-raspberry-pi-in-kiosk-mode/) que utilizan [Chromium](https://www.chromium.org/chromium-projects/) para navegar el sitio.
+
+#### Modelos asociados
+
+- `class Screen`: Información de cada pantalla
+ - `screen_id`
+ - `name`
+ - `address`
+ - `location` (ejemplo: 9.93752787687643, -84.04463400265841 con PostGIS y GeoDjango)
+ - `size` (ejemplo: 32")
+ - `ratio` (ejemplo: 16:9)
+ - `orientation` (ejemplo: `VERTICAL`, `HORIZONTAL`)
+ - `has_sound` (ejemplo: `True`, `False`, booleano)
+
+### Django app: `gtfs`
+
+- `gtfs/`:
+- `/gtfs/schedule/`: Información y configuración del *feed* GTFS Schedule utilizado
+- `/gtfs/realtime/`: Información y configuración del *feed* GTFS Realtime utilizado
+
+ #### Modelos asociados
+
+- (Todos los modelos de GTFS Schedule, como `Agency`, `Route`, etc.)
+- (Todos los modelos de GTFS Realtime, como `VehiclePosition`, etc.)
+- `class Company`
+ - `company_id`
+ - `name`
+ - `address`
+ - `phone`
+ - `email`
+ - `website`
+ - `logo`
+- `class Schedule`
+ - `company_id` (ejemplo: "MBTA")
+ - `schedule_url`: *feed* estático
+ - `last_updated`
+- `class Realtime`
+ - `company_id` (ForeignKey) (ejemplo: "MBTA")
+ - `alerts_url`: *feed message* de alertas del servicio
+ - `trip_updates_url`: *feed message* de actualizaciones de los viajes
+ - `vehicle_positions_url`: *feed message* de posición de los vehículos
+ - `alerts_last_updated`
From 347c611aece668795ec7954dae51f228bb56084f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Fri, 15 Dec 2023 14:52:50 -0300
Subject: [PATCH 003/244] Update ARCHITECTURE.md
---
ARCHITECTURE.md | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index f30c833..0aeb51d 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -15,7 +15,8 @@
#### Modelos asociados
-`class User`: Información de usuarios del sistema
+- `class User`: Información de usuarios del sistema
+ - `type`
### Django app: `screens`
@@ -41,9 +42,10 @@ Nota: las pantallas por ahora asumimos que son Raspberry Pi en [modo kiosko](htt
### Django app: `gtfs`
-- `gtfs/`:
+- `/gtfs/`:
- `/gtfs/schedule/`: Información y configuración del *feed* GTFS Schedule utilizado
- `/gtfs/realtime/`: Información y configuración del *feed* GTFS Realtime utilizado
+- `/gtfs/company/`: Las pantallas pueden desplegar información de uno o más *feeds* provenientes de una o más compañías
#### Modelos asociados
From b542f03e05b32643760017a57ec8ee56cccf2b6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Mon, 18 Dec 2023 15:39:39 -0300
Subject: [PATCH 004/244] Update ARCHITECTURE.md
---
ARCHITECTURE.md | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 0aeb51d..2575da2 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -11,7 +11,11 @@
### Django app: `website`
+> Manejo de páginas misceláneas del sitio.
+
- `/`: Página de bienvenida del sistema
+- `/sobre/`: Información del proyecto
+- `/perfil/`: Perfil de usuario registrado
#### Modelos asociados
@@ -20,9 +24,11 @@
### Django app: `screens`
+> Páginas de administración de las pantallas (HTML) y actualización de datos en tiempo real (WebSockets)
+
- `/pantallas/`: Lista de pantallas del sistema
-- `/pantallas/crear`: Página de creación de nueva pantalla
-- `/pantallas//`: Visualización de la pantalla (contenido)
+- `/pantallas/crear/`: Página de creación de nueva pantalla
+- `/pantallas//`: Visualización de la pantalla (**contenido de la pantalla**)
- `/pantallas//configuracion/`: Sitio de configuración de la pantalla `screen_id`
@@ -42,6 +48,8 @@ Nota: las pantallas por ahora asumimos que son Raspberry Pi en [modo kiosko](htt
### Django app: `gtfs`
+> Páginas de administación de información GTFS Schedule y GTFS Realtime.
+
- `/gtfs/`:
- `/gtfs/schedule/`: Información y configuración del *feed* GTFS Schedule utilizado
- `/gtfs/realtime/`: Información y configuración del *feed* GTFS Realtime utilizado
From 168da34add2a6535c1f3d74735524178a4128ae3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Mon, 18 Dec 2023 16:03:00 -0300
Subject: [PATCH 005/244] =?UTF-8?q?Creaci=C3=B3n=20y=20configuraci=C3=B3n?=
=?UTF-8?q?=20b=C3=A1sica=20de=20proyecto=20de=20Django?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 3 +
gtfs/__init__.py | 0
gtfs/admin.py | 3 +
gtfs/apps.py | 6 ++
gtfs/migrations/__init__.py | 0
gtfs/models.py | 3 +
gtfs/tests.py | 3 +
gtfs/views.py | 3 +
gtfs_screens/__init__.py | 0
gtfs_screens/asgi.py | 16 +++++
gtfs_screens/settings.py | 127 +++++++++++++++++++++++++++++++++
gtfs_screens/urls.py | 22 ++++++
gtfs_screens/wsgi.py | 16 +++++
manage.py | 22 ++++++
screens/__init__.py | 0
screens/admin.py | 3 +
screens/apps.py | 6 ++
screens/migrations/__init__.py | 0
screens/models.py | 3 +
screens/tests.py | 3 +
screens/views.py | 3 +
website/__init__.py | 0
website/admin.py | 3 +
website/apps.py | 6 ++
website/migrations/__init__.py | 0
website/models.py | 3 +
website/tests.py | 3 +
website/views.py | 3 +
28 files changed, 260 insertions(+)
create mode 100644 gtfs/__init__.py
create mode 100644 gtfs/admin.py
create mode 100644 gtfs/apps.py
create mode 100644 gtfs/migrations/__init__.py
create mode 100644 gtfs/models.py
create mode 100644 gtfs/tests.py
create mode 100644 gtfs/views.py
create mode 100644 gtfs_screens/__init__.py
create mode 100644 gtfs_screens/asgi.py
create mode 100644 gtfs_screens/settings.py
create mode 100644 gtfs_screens/urls.py
create mode 100644 gtfs_screens/wsgi.py
create mode 100755 manage.py
create mode 100644 screens/__init__.py
create mode 100644 screens/admin.py
create mode 100644 screens/apps.py
create mode 100644 screens/migrations/__init__.py
create mode 100644 screens/models.py
create mode 100644 screens/tests.py
create mode 100644 screens/views.py
create mode 100644 website/__init__.py
create mode 100644 website/admin.py
create mode 100644 website/apps.py
create mode 100644 website/migrations/__init__.py
create mode 100644 website/models.py
create mode 100644 website/tests.py
create mode 100644 website/views.py
diff --git a/.gitignore b/.gitignore
index 68bc17f..d2fd289 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,6 +61,9 @@ local_settings.py
db.sqlite3
db.sqlite3-journal
+# macOS stuff:
+.DS_Store
+
# Flask stuff:
instance/
.webassets-cache
diff --git a/gtfs/__init__.py b/gtfs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/gtfs/admin.py b/gtfs/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/gtfs/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/gtfs/apps.py b/gtfs/apps.py
new file mode 100644
index 0000000..2db4f65
--- /dev/null
+++ b/gtfs/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class GtfsConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "gtfs"
diff --git a/gtfs/migrations/__init__.py b/gtfs/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/gtfs/models.py b/gtfs/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/gtfs/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/gtfs/tests.py b/gtfs/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/gtfs/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/gtfs/views.py b/gtfs/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/gtfs/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/gtfs_screens/__init__.py b/gtfs_screens/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/gtfs_screens/asgi.py b/gtfs_screens/asgi.py
new file mode 100644
index 0000000..e338716
--- /dev/null
+++ b/gtfs_screens/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for gtfs_screens project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gtfs_screens.settings")
+
+application = get_asgi_application()
diff --git a/gtfs_screens/settings.py b/gtfs_screens/settings.py
new file mode 100644
index 0000000..1e090ef
--- /dev/null
+++ b/gtfs_screens/settings.py
@@ -0,0 +1,127 @@
+"""
+Django settings for gtfs_screens project.
+
+Generated by 'django-admin startproject' using Django 5.0.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.0/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/5.0/ref/settings/
+"""
+
+from pathlib import Path
+from decouple import config, Csv
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = config("SECRET_KEY")
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = config("DEBUG", cast=bool)
+
+ALLOWED_HOSTS = config("ALLOWED_HOSTS", cast=Csv())
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ "website.apps.WebsiteConfig",
+ "gtfs.apps.GtfsConfig",
+ "screens.apps.ScreensConfig",
+ "django.contrib.admin",
+ "django.contrib.auth",
+ "django.contrib.contenttypes",
+ "django.contrib.sessions",
+ "django.contrib.messages",
+ "django.contrib.staticfiles",
+]
+
+MIDDLEWARE = [
+ "django.middleware.security.SecurityMiddleware",
+ "django.contrib.sessions.middleware.SessionMiddleware",
+ "django.middleware.common.CommonMiddleware",
+ "django.middleware.csrf.CsrfViewMiddleware",
+ "django.contrib.auth.middleware.AuthenticationMiddleware",
+ "django.contrib.messages.middleware.MessageMiddleware",
+ "django.middleware.clickjacking.XFrameOptionsMiddleware",
+]
+
+ROOT_URLCONF = "gtfs_screens.urls"
+
+TEMPLATES = [
+ {
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ "DIRS": [],
+ "APP_DIRS": True,
+ "OPTIONS": {
+ "context_processors": [
+ "django.template.context_processors.debug",
+ "django.template.context_processors.request",
+ "django.contrib.auth.context_processors.auth",
+ "django.contrib.messages.context_processors.messages",
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = "gtfs_screens.wsgi.application"
+
+
+# Database
+# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
+
+DATABASES = {
+ "default": {
+ "ENGINE": "django.db.backends.sqlite3",
+ "NAME": BASE_DIR / "db.sqlite3",
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
+ },
+ {
+ "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
+ },
+ {
+ "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
+ },
+ {
+ "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/5.0/topics/i18n/
+
+LANGUAGE_CODE = "es-cr"
+
+TIME_ZONE = "America/Costa_Rica"
+
+USE_I18N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/5.0/howto/static-files/
+
+STATIC_URL = "static/"
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
diff --git a/gtfs_screens/urls.py b/gtfs_screens/urls.py
new file mode 100644
index 0000000..f0e9588
--- /dev/null
+++ b/gtfs_screens/urls.py
@@ -0,0 +1,22 @@
+"""
+URL configuration for gtfs_screens project.
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/5.0/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path
+
+urlpatterns = [
+ path("admin/", admin.site.urls),
+]
diff --git a/gtfs_screens/wsgi.py b/gtfs_screens/wsgi.py
new file mode 100644
index 0000000..27a6989
--- /dev/null
+++ b/gtfs_screens/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for gtfs_screens project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gtfs_screens.settings")
+
+application = get_wsgi_application()
diff --git a/manage.py b/manage.py
new file mode 100755
index 0000000..b122dc7
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gtfs_screens.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/screens/__init__.py b/screens/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/screens/admin.py b/screens/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/screens/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/screens/apps.py b/screens/apps.py
new file mode 100644
index 0000000..de60361
--- /dev/null
+++ b/screens/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class ScreensConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "screens"
diff --git a/screens/migrations/__init__.py b/screens/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/screens/models.py b/screens/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/screens/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/screens/tests.py b/screens/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/screens/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/screens/views.py b/screens/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/screens/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/website/__init__.py b/website/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/website/admin.py b/website/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/website/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/website/apps.py b/website/apps.py
new file mode 100644
index 0000000..bc26c09
--- /dev/null
+++ b/website/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class WebsiteConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "website"
diff --git a/website/migrations/__init__.py b/website/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/website/models.py b/website/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/website/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/website/tests.py b/website/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/website/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/website/views.py b/website/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/website/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
From 772951c1b1df8fe223932aee42d4ed668eec1b43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Mon, 18 Dec 2023 17:16:49 -0300
Subject: [PATCH 006/244] =?UTF-8?q?Creaci=C3=B3n=20de=20URLs=20y=20plantil?=
=?UTF-8?q?las=20para=20mapa=20del=20sitio=20en=20cada=20app?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
gtfs/templates/company.html | 1 +
gtfs/templates/gtfs.html | 10 ++++++++++
gtfs/templates/realtime.html | 14 ++++++++++++++
gtfs/templates/schedule.html | 9 +++++++++
gtfs/urls.py | 10 ++++++++++
gtfs/views.py | 16 ++++++++++++++++
gtfs_screens/urls.py | 5 ++++-
screens/templates/create_screen.html | 20 ++++++++++++++++++++
screens/templates/edit_screen.html | 5 +++++
screens/templates/screen.html | 12 ++++++++++++
screens/templates/screens.html | 5 +++++
screens/urls.py | 10 ++++++++++
screens/views.py | 18 ++++++++++++++++++
website/templates/about.html | 1 +
website/templates/index.html | 4 ++++
website/templates/profile.html | 1 +
website/urls.py | 9 +++++++++
website/views.py | 10 ++++++++++
18 files changed, 159 insertions(+), 1 deletion(-)
create mode 100644 gtfs/templates/company.html
create mode 100644 gtfs/templates/gtfs.html
create mode 100644 gtfs/templates/realtime.html
create mode 100644 gtfs/templates/schedule.html
create mode 100644 gtfs/urls.py
create mode 100644 screens/templates/create_screen.html
create mode 100644 screens/templates/edit_screen.html
create mode 100644 screens/templates/screen.html
create mode 100644 screens/templates/screens.html
create mode 100644 screens/urls.py
create mode 100644 website/templates/about.html
create mode 100644 website/templates/index.html
create mode 100644 website/templates/profile.html
create mode 100644 website/urls.py
diff --git a/gtfs/templates/company.html b/gtfs/templates/company.html
new file mode 100644
index 0000000..8a9faae
--- /dev/null
+++ b/gtfs/templates/company.html
@@ -0,0 +1 @@
+
Información sobre la compañía/institución/agencia que publica el GTFS
\ No newline at end of file
diff --git a/gtfs/templates/gtfs.html b/gtfs/templates/gtfs.html
new file mode 100644
index 0000000..a0345a2
--- /dev/null
+++ b/gtfs/templates/gtfs.html
@@ -0,0 +1,10 @@
+
Información general sobre GTFS
+
+
+ El General Transit Feed Specification (GTFS) define un formato común para la representación de información de transporte público.
+ El formato es usado por cientos de agencias de transporte público y aplicaciones de viaje en todo el mundo.
+
+
+
+ Aquí también está la explicación de las versiones Schedule y Realtime de GTFS.
+
\ No newline at end of file
diff --git a/gtfs/templates/realtime.html b/gtfs/templates/realtime.html
new file mode 100644
index 0000000..0af864a
--- /dev/null
+++ b/gtfs/templates/realtime.html
@@ -0,0 +1,14 @@
+
Sitio de configuración de GTFS Realtime
+
+
+ Un formulario con los campos necesarios para configurar el sitio GTFS Realtime.
+
+
+
+ Los más importantes:
+
+
alerts_url
+
trip_updates_url
+
vehicle_positions_url
+
+
\ No newline at end of file
diff --git a/gtfs/templates/schedule.html b/gtfs/templates/schedule.html
new file mode 100644
index 0000000..4167dc7
--- /dev/null
+++ b/gtfs/templates/schedule.html
@@ -0,0 +1,9 @@
+
Sitio de configuración GTFS Schedule
+
+
+ Un formulario con los campos necesarios para configurar el sitio GTFS Schedule.
+
+
+
El más importante: schedule_url
+
+
Cosas para hacer por aquí: validad URL, hacer un request de prueba, también para ver datos históricos del feed, etc.
\ No newline at end of file
diff --git a/gtfs/urls.py b/gtfs/urls.py
new file mode 100644
index 0000000..f11dc8e
--- /dev/null
+++ b/gtfs/urls.py
@@ -0,0 +1,10 @@
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+ path("", views.gtfs),
+ path("schedule/", views.schedule, name="schedule"),
+ path("realtime/", views.realtime, name="realtime"),
+ path("compania/", views.company, name="company"),
+]
\ No newline at end of file
diff --git a/gtfs/views.py b/gtfs/views.py
index 91ea44a..0203f3f 100644
--- a/gtfs/views.py
+++ b/gtfs/views.py
@@ -1,3 +1,19 @@
from django.shortcuts import render
# Create your views here.
+
+
+def gtfs(request):
+ return render(request, "gtfs.html")
+
+
+def schedule(request):
+ return render(request, "schedule.html")
+
+
+def realtime(request):
+ return render(request, "realtime.html")
+
+
+def company(request):
+ return render(request, "company.html")
\ No newline at end of file
diff --git a/gtfs_screens/urls.py b/gtfs_screens/urls.py
index f0e9588..c23322f 100644
--- a/gtfs_screens/urls.py
+++ b/gtfs_screens/urls.py
@@ -15,8 +15,11 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
-from django.urls import path
+from django.urls import path, include
urlpatterns = [
path("admin/", admin.site.urls),
+ path("", include("website.urls"), name="index"),
+ path("gtfs/", include("gtfs.urls"), name="gtfs_page"),
+ path("pantallas/", include("screens.urls"), name="screens_page"),
]
diff --git a/screens/templates/create_screen.html b/screens/templates/create_screen.html
new file mode 100644
index 0000000..e323277
--- /dev/null
+++ b/screens/templates/create_screen.html
@@ -0,0 +1,20 @@
+
Página de creación/registro/configuración de una nueva pantalla
+
+
+ Formulario con toda la información necesaria para la pantalla.
+
+
+
+
screen_id
+
name
+
address
+
location (ejemplo: 9.93752787687643, -84.04463400265841 con PostGIS y GeoDjango)
+
size (ejemplo: 32")
+
ratio (ejemplo: 16:9)
+
orientation (ejemplo: VERTICAL, HORIZONTAL)
+
has_sound
+
+
+
+ Aquí hay que hacer una validación de los datos ingresados por el usuario.
+
\ No newline at end of file
diff --git a/screens/templates/edit_screen.html b/screens/templates/edit_screen.html
new file mode 100644
index 0000000..017e2f1
--- /dev/null
+++ b/screens/templates/edit_screen.html
@@ -0,0 +1,5 @@
+
Página de edición de los datos de configuración de cada pantalla
+
+
+ Pantalla: {{ screen_id }}
+
\ No newline at end of file
diff --git a/screens/templates/screen.html b/screens/templates/screen.html
new file mode 100644
index 0000000..68972da
--- /dev/null
+++ b/screens/templates/screen.html
@@ -0,0 +1,12 @@
+
Ruta UCR
+
+
Faltan 5 minutos para el bus
+
+
+ Pantalla: {{ screen_id }}
+
+
+
\ No newline at end of file
diff --git a/screens/templates/screens.html b/screens/templates/screens.html
new file mode 100644
index 0000000..6e5710c
--- /dev/null
+++ b/screens/templates/screens.html
@@ -0,0 +1,5 @@
+
Lista administrativa de todas las pantallas
+
+
+ Aquí pueden haber tablas con la lista, mapas con la ubicación de las pantallas, etc.
+
\ No newline at end of file
diff --git a/website/templates/index.html b/website/templates/index.html
new file mode 100644
index 0000000..ce693d8
--- /dev/null
+++ b/website/templates/index.html
@@ -0,0 +1,4 @@
+
Esta es la página principal
+
+ Aquí habrá una referencia a la página de inicio de sesión y a la página de registro.
+
\ No newline at end of file
diff --git a/website/templates/profile.html b/website/templates/profile.html
new file mode 100644
index 0000000..b4d5a7d
--- /dev/null
+++ b/website/templates/profile.html
@@ -0,0 +1 @@
+
Página de perfil del usuario
\ No newline at end of file
diff --git a/website/urls.py b/website/urls.py
new file mode 100644
index 0000000..45edc4f
--- /dev/null
+++ b/website/urls.py
@@ -0,0 +1,9 @@
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+ path("", views.index, name="index"),
+ path("sobre/", views.about, name="about"),
+ path("perfil/", views.profile, name="profile"),
+]
diff --git a/website/views.py b/website/views.py
index 91ea44a..7ce0fe1 100644
--- a/website/views.py
+++ b/website/views.py
@@ -1,3 +1,13 @@
from django.shortcuts import render
# Create your views here.
+
+
+def index(request):
+ return render(request, "index.html")
+
+def about(request):
+ return render(request, "about.html")
+
+def profile(request):
+ return render(request, "profile.html")
From c3006a7f30f2507a60f21c2b6820f74c7ffe0e99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Mon, 18 Dec 2023 18:25:57 -0300
Subject: [PATCH 007/244] Create DEVELOPMENT.md
Esbozo de las tareas del sistema.
---
DEVELOPMENT.md | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 DEVELOPMENT.md
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
new file mode 100644
index 0000000..013e259
--- /dev/null
+++ b/DEVELOPMENT.md
@@ -0,0 +1,25 @@
+# Desarrollo funcional
+
+## Recopilación de `FeedMessage` cada $N$ segundos
+ - Opciones: Apache Airflow o como proceso del sistema con paquetes de Python para tareas repetitivas (versión más fácil).
+ - Es necesario usar los paquetes de Google para procesar los `.pb` y convertirlo a un diccionario o un JSON o un DataFrame de Pandas.
+
+## *Script* de clasificación y ordenamiento de GTFS Realtime
+
+Es necesario separar los datos que son relevantes para cada parada (¿tópicos?).
+
+- Es posible trabajarlo con puro Python (sin preocuparse todavía de Django)
+- Aquí es importante la eficiencia computacional (un poco)
+- Herramientas posibles: ¿Pandas? (muy lento), o guardar directamente a la base de datos y ordernarlo desde ahí.
+- Depende del análisis del GTFS del sistema de buses, porque hay que analizar cuáles buses van a pasar o ya pasaron por una parada en particular, etc.
+- También hay que definir el formato de lo datos que serán compartidos (ya no es GTFS Realtime, necesariamente).
+
+## Actualización de la información de cada pantalla
+
+(Django WebSockets)
+
+## Configuración del hardware de las pantallas
+
+(Raspberry Pi)
+
+Ejemplo de primer prototipo: Soda de Ingeniería (no requiere protección).
From 5c76e0e378c9d4d0a8c8a5301501ed75f96a5600 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Thu, 18 Jan 2024 10:35:28 -0300
Subject: [PATCH 008/244] Actualizar con el equipo de trabajo
---
README.md | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/README.md b/README.md
index 7655b2b..6903f0f 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,24 @@
# gtfs-screens
Implementación de pantallas con GTFS
+
+## Equipo de trabajo
+
+### Organización de la información GTFS Realtime
+
+> "La oficina de correos"
+
+Obtener periódicamente la información del _feed_ GTFS Realtime (el servidor del proyecto `gtfs-realtime`), ordenarla según pantallas o servicios y distribuirla.
+
+- David Segura
+- Josué Vargas
+
+### Implementación de pantallas y despliegue de información
+
+> "La entrega de los paquetes de correo"
+
+Con la información asignada a cada pantalla y la plantilla para desplegar información, actualizar las pantallas cada $N$ segundos. Además, claramente, la implementación propiamente de las pantallas.
+
+Primera implementación: soda de la Facultad de Ingeniería, porque: 1. ya existe una pantalla ahí, 2. es más fácil pedir permisos, 3. no requiere protección contra la intemperie, 4. es nuestra Facultad.
+
+- José David Murillo
+- Mateo Ortigoza
From 3aff96992fc10b7574f10d13571fa207e1123b79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Thu, 1 Feb 2024 16:29:43 -0300
Subject: [PATCH 009/244] Create requirements.txt
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 requirements.txt
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..24ce15a
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+numpy
From 8196fc5948460e84ce1db7fa6b3ed312b35c1a59 Mon Sep 17 00:00:00 2001
From: Jose David Murillo
Date: Thu, 1 Feb 2024 13:35:40 -0600
Subject: [PATCH 010/244] chg: dev: prueba
Signed-off-by: Jose David Murillo
---
test.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 test.txt
diff --git a/test.txt b/test.txt
new file mode 100644
index 0000000..5c1b149
--- /dev/null
+++ b/test.txt
@@ -0,0 +1 @@
+hola
From 3d7a6d82b090c24cd5132b53e4bc88d48f0af62b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Thu, 1 Feb 2024 16:42:08 -0300
Subject: [PATCH 011/244] Update requirements.txt
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 24ce15a..fd81a45 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
-numpy
+python-decouple
From 1f89ae0a90cb91092f35aaab6e8921e9821f8157 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Abarca?=
Date: Thu, 1 Feb 2024 17:33:46 -0300
Subject: [PATCH 012/244] Update requirements.txt with Django (of course)
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/requirements.txt b/requirements.txt
index fd81a45..d9f850c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,2 @@
+django
python-decouple
From baec114b1d124c2820e45f0c0e244d079836fcf5 Mon Sep 17 00:00:00 2001
From: Jose David Murillo
Date: Thu, 1 Feb 2024 14:52:13 -0600
Subject: [PATCH 013/244] chg: dev: First update
Signed-off-by: Jose David Murillo
---
gtfs/templates/schedule.html | 8 +++++++-
gtfs/views.py | 8 +++++++-
requirements.txt | 2 +-
test.txt | 1 -
4 files changed, 15 insertions(+), 4 deletions(-)
delete mode 100644 test.txt
diff --git a/gtfs/templates/schedule.html b/gtfs/templates/schedule.html
index 4167dc7..9c7c01c 100644
--- a/gtfs/templates/schedule.html
+++ b/gtfs/templates/schedule.html
@@ -6,4 +6,10 @@
Sitio de configuración GTFS Schedule
El más importante: schedule_url
-
Cosas para hacer por aquí: validad URL, hacer un request de prueba, también para ver datos históricos del feed, etc.
\ No newline at end of file
+
Cosas para hacer por aquí: validad URL, hacer un request de prueba, también para ver datos históricos del feed, etc.