-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from guivaloz/guivaloz/edictos-listas-de-acuerd…
…os-web Mejoras en todo
- Loading branch information
Showing
54 changed files
with
1,104 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
""" | ||
Edictos, modelos | ||
""" | ||
|
||
from datetime import date, datetime | ||
from typing import Optional | ||
|
||
from sqlalchemy import JSON, ForeignKey, String | ||
from sqlalchemy.orm import Mapped, mapped_column, relationship | ||
|
||
from ..dependencies.database import Base | ||
from ..dependencies.universal_mixin import UniversalMixin | ||
|
||
|
||
class Edicto(Base, UniversalMixin): | ||
"""Edicto""" | ||
|
||
# Nombre de la tabla | ||
__tablename__ = "edictos" | ||
|
||
# Clave primaria | ||
id: Mapped[int] = mapped_column(primary_key=True) | ||
|
||
# Clave foránea | ||
autoridad_id: Mapped[int] = mapped_column(ForeignKey("autoridades.id")) | ||
autoridad: Mapped["Autoridad"] = relationship(back_populates="edictos") | ||
|
||
# Columnas | ||
fecha: Mapped[date] = mapped_column(index=True) | ||
descripcion: Mapped[str] = mapped_column(String(256)) | ||
expediente: Mapped[str] = mapped_column(String(16)) | ||
numero_publicacion: Mapped[str] = mapped_column(String(16)) | ||
archivo: Mapped[str] = mapped_column(String(256), default="") | ||
url: Mapped[str] = mapped_column(String(512), default="") | ||
es_declaracion_de_ausencia: Mapped[bool] = mapped_column(default=False) | ||
|
||
# Columnas para Retrieval-Augmented Generation (RAG) | ||
rag_fue_analizado_tiempo: Mapped[Optional[datetime]] | ||
rag_analisis: Mapped[Optional[dict]] = mapped_column(JSON) | ||
rag_fue_sintetizado_tiempo: Mapped[Optional[datetime]] | ||
rag_sintesis: Mapped[Optional[dict]] = mapped_column(JSON) | ||
rag_fue_categorizado_tiempo: Mapped[Optional[datetime]] | ||
rag_categorias: Mapped[Optional[dict]] = mapped_column(JSON) | ||
|
||
@property | ||
def distrito_clave(self): | ||
"""Distrito clave""" | ||
return self.autoridad.distrito.clave | ||
|
||
@property | ||
def distrito_nombre(self): | ||
"""Distrito nombre""" | ||
return self.autoridad.distrito.nombre | ||
|
||
@property | ||
def distrito_nombre_corto(self): | ||
"""Distrito nombre corto""" | ||
return self.autoridad.distrito.nombre_corto | ||
|
||
@property | ||
def autoridad_clave(self): | ||
"""Autoridad clave""" | ||
return self.autoridad.clave | ||
|
||
@property | ||
def autoridad_descripcion(self): | ||
"""Autoridad descripción""" | ||
return self.autoridad.descripcion | ||
|
||
@property | ||
def autoridad_descripcion_corta(self): | ||
"""Autoridad descripción corta""" | ||
return self.autoridad.descripcion_corta | ||
|
||
def __repr__(self): | ||
"""Representación""" | ||
return f"<Edicto {self.id}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
""" | ||
Listas de Acuerdos, modelos | ||
""" | ||
|
||
from datetime import date, datetime | ||
from typing import Optional | ||
|
||
from sqlalchemy import JSON, ForeignKey, String | ||
from sqlalchemy.orm import Mapped, mapped_column, relationship | ||
|
||
from ..dependencies.database import Base | ||
from ..dependencies.universal_mixin import UniversalMixin | ||
|
||
|
||
class ListaDeAcuerdo(Base, UniversalMixin): | ||
"""ListaDeAcuerdo""" | ||
|
||
# Nombre de la tabla | ||
__tablename__ = "listas_de_acuerdos" | ||
|
||
# Clave primaria | ||
id: Mapped[int] = mapped_column(primary_key=True) | ||
|
||
# Clave foránea | ||
autoridad_id: Mapped[int] = mapped_column(ForeignKey("autoridades.id")) | ||
autoridad: Mapped["Autoridad"] = relationship(back_populates="listas_de_acuerdos") | ||
|
||
# Columnas | ||
fecha: Mapped[date] = mapped_column(index=True) | ||
descripcion: Mapped[str] = mapped_column(String(256)) | ||
archivo: Mapped[str] = mapped_column(String(256), default="") | ||
url: Mapped[str] = mapped_column(String(512), default="") | ||
|
||
# Columnas para Retrieval-Augmented Generation (RAG) | ||
rag_fue_analizado_tiempo: Mapped[Optional[datetime]] | ||
rag_analisis: Mapped[Optional[dict]] = mapped_column(JSON) | ||
rag_fue_sintetizado_tiempo: Mapped[Optional[datetime]] | ||
rag_sintesis: Mapped[Optional[dict]] = mapped_column(JSON) | ||
rag_fue_categorizado_tiempo: Mapped[Optional[datetime]] | ||
rag_categorias: Mapped[Optional[dict]] = mapped_column(JSON) | ||
|
||
@property | ||
def distrito_clave(self): | ||
"""Distrito clave""" | ||
return self.autoridad.distrito.clave | ||
|
||
@property | ||
def distrito_nombre(self): | ||
"""Distrito nombre""" | ||
return self.autoridad.distrito.nombre | ||
|
||
@property | ||
def distrito_nombre_corto(self): | ||
"""Distrito nombre corto""" | ||
return self.autoridad.distrito.nombre_corto | ||
|
||
@property | ||
def autoridad_clave(self): | ||
"""Autoridad clave""" | ||
return self.autoridad.clave | ||
|
||
@property | ||
def autoridad_descripcion(self): | ||
"""Autoridad descripción""" | ||
return self.autoridad.descripcion | ||
|
||
@property | ||
def autoridad_descripcion_corta(self): | ||
"""Autoridad descripción corta""" | ||
return self.autoridad.descripcion_corta | ||
|
||
def __repr__(self): | ||
"""Representación""" | ||
return f"<ListaDeAcuerdo {self.id}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
Web Páginas, modelos | ||
""" | ||
|
||
from datetime import date, datetime | ||
from typing import Optional | ||
|
||
from sqlalchemy import Enum, ForeignKey, String, Text | ||
from sqlalchemy.orm import Mapped, mapped_column, relationship | ||
|
||
from ..dependencies.database import Base | ||
from ..dependencies.universal_mixin import UniversalMixin | ||
|
||
|
||
class WebPagina(Base, UniversalMixin): | ||
"""WebPagina""" | ||
|
||
ESTADOS = { | ||
"BORRADOR": "BORRADOR", | ||
"PUBLICAR": "PUBLICAR", | ||
"ARCHIVAR": "ARCHIVAR", | ||
} | ||
|
||
# Nombre de la tabla | ||
__tablename__ = "web_paginas" | ||
|
||
# Clave primaria | ||
id: Mapped[int] = mapped_column(primary_key=True) | ||
|
||
# Clave foránea | ||
web_rama_id: Mapped[int] = mapped_column(ForeignKey("web_ramas.id")) | ||
web_rama: Mapped["WebRama"] = relationship(back_populates="web_paginas") | ||
|
||
# Columnas | ||
clave: Mapped[str] = mapped_column(String(16), unique=True) | ||
titulo: Mapped[str] = mapped_column(String(256)) | ||
resumen: Mapped[Optional[str]] = mapped_column(String(1024)) | ||
ruta: Mapped[str] = mapped_column(String(256)) | ||
fecha_modificacion: Mapped[date] | ||
responsable: Mapped[Optional[str]] = mapped_column(String(256)) | ||
etiquetas: Mapped[Optional[str]] = mapped_column(String(256)) | ||
vista_previa: Mapped[Optional[str]] = mapped_column(String(256)) | ||
contenido: Mapped[str] = mapped_column(Text) | ||
estado: Mapped[str] = mapped_column(Enum(*ESTADOS, name="web_paginas_estados", native_enum=False), index=True) | ||
tiempo_publicar: Mapped[Optional[datetime]] | ||
tiempo_archivar: Mapped[Optional[datetime]] | ||
|
||
def __repr__(self): | ||
"""Representación""" | ||
return f"<WebPagina clave {self.clave}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Web Ramas, modelos | ||
""" | ||
|
||
from typing import List | ||
|
||
from sqlalchemy import String | ||
from sqlalchemy.orm import Mapped, mapped_column, relationship | ||
|
||
from ..dependencies.database import Base | ||
from ..dependencies.universal_mixin import UniversalMixin | ||
|
||
|
||
class WebRama(Base, UniversalMixin): | ||
"""WebRama""" | ||
|
||
# Nombre de la tabla | ||
__tablename__ = "web_ramas" | ||
|
||
# Clave primaria | ||
id: Mapped[int] = mapped_column(primary_key=True) | ||
|
||
# Columnas | ||
clave: Mapped[str] = mapped_column(String(16), unique=True) | ||
nombre: Mapped[str] = mapped_column(String(256)) | ||
|
||
# Hijos | ||
web_paginas: Mapped[List["WebPagina"]] = relationship("WebPagina", back_populates="web_rama") | ||
|
||
def __repr__(self): | ||
"""Representación""" | ||
return f"<WebUnidad {self.clave}>" |
Oops, something went wrong.