Spaces:
Sleeping
Sleeping
Commit ·
89ecf2e
1
Parent(s): 0138acf
integration Mkdocs au lieu de pydocs
Browse files- app/api.py +179 -1
- app/database.py +55 -0
- app/models.py +214 -15
- app/security.py +60 -0
- docs/api_reference/app_api.md +3 -0
- docs/api_reference/app_models.md +3 -0
- docs/api_reference/domain.md +3 -0
- docs/api_reference/technova_service.md +3 -0
- docs/app.api.html +0 -47
- docs/app.models.html +0 -712
- docs/domain.domain.html +0 -1225
- docs/index.md +17 -0
- docs/init_base/database.md +3 -0
- docs/securite/security.md +3 -0
- docs/service.technova_service.html +0 -66
- domain/domain.py +67 -0
- mkdocs.yml +33 -0
- poetry.lock +356 -11
- pyproject.toml +4 -0
- scripts/generate_docs.py +32 -20
- service/technova_service.py +226 -4
app/api.py
CHANGED
|
@@ -1,5 +1,24 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from time import perf_counter
|
| 4 |
|
| 5 |
from fastapi import FastAPI, HTTPException, Depends
|
|
@@ -22,6 +41,20 @@ service_singleton: TechNovaService | None = None
|
|
| 22 |
|
| 23 |
@asynccontextmanager
|
| 24 |
async def lifespan(app: FastAPI):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
global service_singleton
|
| 26 |
service_singleton = TechNovaService() # charge modèle + seuil une seule fois
|
| 27 |
yield
|
|
@@ -36,11 +69,33 @@ def get_service() -> TechNovaService:
|
|
| 36 |
#accessible via "/" pour rediriger vers la doc interactive, mais pas dans la doc elle-même
|
| 37 |
@app.get("/", include_in_schema=False)
|
| 38 |
def root():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return RedirectResponse(url="/docs")
|
| 40 |
|
| 41 |
# endpoint de santé pour monitoring
|
| 42 |
@app.get("/health", dependencies=[Depends(verify_api_key)])
|
| 43 |
def health():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
return {"status": "ok"}
|
| 45 |
from sqlalchemy import text
|
| 46 |
|
|
@@ -50,6 +105,37 @@ def ready(
|
|
| 50 |
db: Session = Depends(get_db),
|
| 51 |
service: TechNovaService = Depends(get_service),
|
| 52 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
if service.model is None:
|
| 54 |
raise HTTPException(status_code=503, detail="Model not loaded")
|
| 55 |
try:
|
|
@@ -70,6 +156,40 @@ def predict_by_employee_id(
|
|
| 70 |
db: Session = Depends(get_db),
|
| 71 |
service: TechNovaService = Depends(get_service),
|
| 72 |
) -> ModelResponse:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
try:
|
| 74 |
t0 = perf_counter()
|
| 75 |
response = service.predict_from_clean(db=db, employee_id=employee_id)
|
|
@@ -109,6 +229,40 @@ def predict_by_features(
|
|
| 109 |
db: Session = Depends(get_db),
|
| 110 |
service: TechNovaService = Depends(get_service),
|
| 111 |
) -> ModelResponse:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
try:
|
| 113 |
t0 = perf_counter()
|
| 114 |
response = service.predict_from_payload(request=payload)
|
|
@@ -143,6 +297,30 @@ def latest_predictions(
|
|
| 143 |
limit: int = 20,
|
| 144 |
db: Session = Depends(get_db),
|
| 145 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
rows = (
|
| 147 |
db.query(Prediction, PredictionRequest)
|
| 148 |
.join(PredictionRequest, Prediction.request_id == PredictionRequest.id)
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
TechNova Partners – API FastAPI (Turnover Prediction)
|
| 3 |
+
|
| 4 |
+
Ce module expose l'API HTTP du projet TechNova Partners. L'API permet :
|
| 5 |
+
- de prédire le risque de départ (turnover) d'un employé via un modèle ML,
|
| 6 |
+
- de consulter l'état de santé du service (health / ready),
|
| 7 |
+
- de journaliser (logguer) les requêtes et prédictions en base de données.
|
| 8 |
+
|
| 9 |
+
Principes d'architecture (MLOps)
|
| 10 |
+
- Le modèle ML est chargé une seule fois au démarrage (lifespan).
|
| 11 |
+
- La prédiction "production" se fait via les features déjà préparées en base (tables `clean.*`).
|
| 12 |
+
- Les appels de prédiction sont enregistrés (request + prediction) afin d'assurer la traçabilité.
|
| 13 |
|
| 14 |
+
Sécurité
|
| 15 |
+
Tous les endpoints (sauf la racine `/`) sont protégés par une API Key via le header :
|
| 16 |
+
`X-API-Key: <API_KEY>`
|
| 17 |
+
|
| 18 |
+
Version du modèle
|
| 19 |
+
`MODEL_VERSION` est renvoyé dans `/ready` et stocké dans les logs de prédiction.
|
| 20 |
+
"""
|
| 21 |
+
from __future__ import annotations
|
| 22 |
from time import perf_counter
|
| 23 |
|
| 24 |
from fastapi import FastAPI, HTTPException, Depends
|
|
|
|
| 41 |
|
| 42 |
@asynccontextmanager
|
| 43 |
async def lifespan(app: FastAPI):
|
| 44 |
+
"""
|
| 45 |
+
Gestion du cycle de vie de l'application (startup / shutdown).
|
| 46 |
+
|
| 47 |
+
Au démarrage :
|
| 48 |
+
- Instancie `TechNovaService` une seule fois (singleton)
|
| 49 |
+
- Charge le modèle ML et le seuil de décision (threshold)
|
| 50 |
+
|
| 51 |
+
À l'arrêt :
|
| 52 |
+
- Libère la référence du service (bonne pratique pour un clean shutdown)
|
| 53 |
+
|
| 54 |
+
Pourquoi ?
|
| 55 |
+
Charger le modèle à chaque requête serait trop coûteux et non scalable.
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
global service_singleton
|
| 59 |
service_singleton = TechNovaService() # charge modèle + seuil une seule fois
|
| 60 |
yield
|
|
|
|
| 69 |
#accessible via "/" pour rediriger vers la doc interactive, mais pas dans la doc elle-même
|
| 70 |
@app.get("/", include_in_schema=False)
|
| 71 |
def root():
|
| 72 |
+
"""
|
| 73 |
+
Route racine.
|
| 74 |
+
|
| 75 |
+
Redirige vers la documentation interactive Swagger (`/docs`).
|
| 76 |
+
Cette route n'apparaît pas dans le schéma OpenAPI (`include_in_schema=False`).
|
| 77 |
+
"""
|
| 78 |
return RedirectResponse(url="/docs")
|
| 79 |
|
| 80 |
# endpoint de santé pour monitoring
|
| 81 |
@app.get("/health", dependencies=[Depends(verify_api_key)])
|
| 82 |
def health():
|
| 83 |
+
"""
|
| 84 |
+
Endpoint de santé (healthcheck).
|
| 85 |
+
|
| 86 |
+
Objectif :
|
| 87 |
+
- Vérifier que l'API répond (service up)
|
| 88 |
+
- Utilisé pour monitoring simple
|
| 89 |
+
|
| 90 |
+
Sécurité :
|
| 91 |
+
- Protégé par API Key
|
| 92 |
+
|
| 93 |
+
Returns
|
| 94 |
+
-------
|
| 95 |
+
dict
|
| 96 |
+
Statut minimal indiquant que l'API est disponible.
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
return {"status": "ok"}
|
| 100 |
from sqlalchemy import text
|
| 101 |
|
|
|
|
| 105 |
db: Session = Depends(get_db),
|
| 106 |
service: TechNovaService = Depends(get_service),
|
| 107 |
):
|
| 108 |
+
"""
|
| 109 |
+
Endpoint de readiness (prêt à servir).
|
| 110 |
+
|
| 111 |
+
Vérifie :
|
| 112 |
+
1) que le modèle ML est chargé (service.model non nul)
|
| 113 |
+
2) que la base de données est accessible (SELECT 1)
|
| 114 |
+
3) que la table `clean.ml_features_employees` existe et est requêtable
|
| 115 |
+
|
| 116 |
+
Pourquoi ?
|
| 117 |
+
Un service peut être "up" (health ok) sans être "ready" :
|
| 118 |
+
- DB non accessible
|
| 119 |
+
- table clean non présente
|
| 120 |
+
- modèle non chargé
|
| 121 |
+
|
| 122 |
+
Parameters
|
| 123 |
+
----------
|
| 124 |
+
db : sqlalchemy.orm.Session
|
| 125 |
+
Session de base de données injectée par FastAPI.
|
| 126 |
+
service : TechNovaService
|
| 127 |
+
Service ML (singleton) injecté par FastAPI.
|
| 128 |
+
|
| 129 |
+
Returns
|
| 130 |
+
-------
|
| 131 |
+
dict
|
| 132 |
+
Informations de readiness + version du modèle.
|
| 133 |
+
|
| 134 |
+
Raises
|
| 135 |
+
------
|
| 136 |
+
fastapi.HTTPException
|
| 137 |
+
503 si DB non prête, table clean absente, ou modèle non chargé.
|
| 138 |
+
"""
|
| 139 |
if service.model is None:
|
| 140 |
raise HTTPException(status_code=503, detail="Model not loaded")
|
| 141 |
try:
|
|
|
|
| 156 |
db: Session = Depends(get_db),
|
| 157 |
service: TechNovaService = Depends(get_service),
|
| 158 |
) -> ModelResponse:
|
| 159 |
+
"""
|
| 160 |
+
Prédiction par identifiant employé (mode production).
|
| 161 |
+
|
| 162 |
+
Fonctionnement :
|
| 163 |
+
- L'API récupère les features déjà préparées depuis `clean.ml_features_employees`
|
| 164 |
+
- Le modèle calcule une probabilité de départ
|
| 165 |
+
- La réponse inclut :
|
| 166 |
+
- la probabilité
|
| 167 |
+
- la décision binaire (will_leave) basée sur un seuil `threshold`
|
| 168 |
+
|
| 169 |
+
Traçabilité :
|
| 170 |
+
- Enregistre un `PredictionRequest` (contexte de requête)
|
| 171 |
+
- Enregistre un `Prediction` (résultat, proba, seuil, latence, version modèle)
|
| 172 |
+
|
| 173 |
+
Parameters
|
| 174 |
+
----------
|
| 175 |
+
employee_id : int
|
| 176 |
+
Identifiant de l'employé utilisé pour rechercher la ligne "clean" la plus récente.
|
| 177 |
+
db : sqlalchemy.orm.Session
|
| 178 |
+
Session SQLAlchemy.
|
| 179 |
+
service : TechNovaService
|
| 180 |
+
Service ML déjà initialisé (modèle chargé).
|
| 181 |
+
|
| 182 |
+
Returns
|
| 183 |
+
-------
|
| 184 |
+
ModelResponse
|
| 185 |
+
Résultat de prédiction.
|
| 186 |
+
|
| 187 |
+
Raises
|
| 188 |
+
------
|
| 189 |
+
fastapi.HTTPException
|
| 190 |
+
- 404 si aucune ligne clean n'existe pour cet employee_id
|
| 191 |
+
- 500 pour toute autre erreur inattendue
|
| 192 |
+
"""
|
| 193 |
try:
|
| 194 |
t0 = perf_counter()
|
| 195 |
response = service.predict_from_clean(db=db, employee_id=employee_id)
|
|
|
|
| 229 |
db: Session = Depends(get_db),
|
| 230 |
service: TechNovaService = Depends(get_service),
|
| 231 |
) -> ModelResponse:
|
| 232 |
+
"""
|
| 233 |
+
Prédiction par payload de features (mode debug / scoring direct).
|
| 234 |
+
|
| 235 |
+
Cas d'usage :
|
| 236 |
+
- Tests automatisés
|
| 237 |
+
- Démonstration
|
| 238 |
+
- Scoring d'un nouvel employé lorsque les features sont déjà au format attendu
|
| 239 |
+
|
| 240 |
+
Important :
|
| 241 |
+
- Ce endpoint ne fait pas de preprocessing (les features doivent être prêtes)
|
| 242 |
+
- Il est moins "production-ready" que la prédiction par ID si un pipeline clean existe
|
| 243 |
+
|
| 244 |
+
Traçabilité :
|
| 245 |
+
- Enregistre la requête et le résultat en base (comme le mode by-id)
|
| 246 |
+
|
| 247 |
+
Parameters
|
| 248 |
+
----------
|
| 249 |
+
payload : ModelRequest
|
| 250 |
+
Ensemble complet des features attendues par le modèle.
|
| 251 |
+
db : sqlalchemy.orm.Session
|
| 252 |
+
Session SQLAlchemy.
|
| 253 |
+
service : TechNovaService
|
| 254 |
+
Service ML initialisé.
|
| 255 |
+
|
| 256 |
+
Returns
|
| 257 |
+
-------
|
| 258 |
+
ModelResponse
|
| 259 |
+
Résultat de prédiction.
|
| 260 |
+
|
| 261 |
+
Raises
|
| 262 |
+
------
|
| 263 |
+
fastapi.HTTPException
|
| 264 |
+
422 si les features sont manquantes / inattendues / invalides.
|
| 265 |
+
"""
|
| 266 |
try:
|
| 267 |
t0 = perf_counter()
|
| 268 |
response = service.predict_from_payload(request=payload)
|
|
|
|
| 297 |
limit: int = 20,
|
| 298 |
db: Session = Depends(get_db),
|
| 299 |
):
|
| 300 |
+
"""
|
| 301 |
+
Retourne les dernières prédictions enregistrées en base.
|
| 302 |
+
|
| 303 |
+
L'endpoint récupère :
|
| 304 |
+
- `Prediction` : résultat ML (classe, proba, seuil, latence, version)
|
| 305 |
+
- `PredictionRequest` : contexte / payload de la requête
|
| 306 |
+
|
| 307 |
+
Pourquoi ?:
|
| 308 |
+
- audit / traçabilité
|
| 309 |
+
- monitoring simple
|
| 310 |
+
- affichage dans un dashboard
|
| 311 |
+
|
| 312 |
+
Parameters
|
| 313 |
+
----------
|
| 314 |
+
limit : int, default=20
|
| 315 |
+
Nombre maximal de prédictions retournées (tri par date décroissante).
|
| 316 |
+
db : sqlalchemy.orm.Session
|
| 317 |
+
Session SQLAlchemy.
|
| 318 |
+
|
| 319 |
+
Returns
|
| 320 |
+
-------
|
| 321 |
+
list[dict]
|
| 322 |
+
Liste des prédictions récentes, avec métadonnées utiles (timestamps, proba, payload, etc.).
|
| 323 |
+
"""
|
| 324 |
rows = (
|
| 325 |
db.query(Prediction, PredictionRequest)
|
| 326 |
.join(PredictionRequest, Prediction.request_id == PredictionRequest.id)
|
app/database.py
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
import os
|
|
@@ -40,6 +74,27 @@ SessionLocal = sessionmaker(
|
|
| 40 |
# Dependency pour obtenir une session de base de données dans les endpoints FastAPI,
|
| 41 |
# avec gestion automatique de la fermeture de la session après usage
|
| 42 |
def get_db() -> Generator[Session, None, None]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
db = SessionLocal()
|
| 44 |
try:
|
| 45 |
yield db
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Gestion de la connexion à la base de données pour l’API TechNova Partners.
|
| 3 |
+
|
| 4 |
+
Ce module centralise :
|
| 5 |
+
- le chargement de la configuration de connexion à la base (DATABASE_URL),
|
| 6 |
+
- la création de l’engine SQLAlchemy,
|
| 7 |
+
- la configuration des sessions,
|
| 8 |
+
- la dépendance FastAPI permettant d’injecter une session DB dans les endpoints.
|
| 9 |
+
|
| 10 |
+
Objectif
|
| 11 |
+
---------------------------------------
|
| 12 |
+
Séparer clairement la logique "base de données" du reste de l’application permet :
|
| 13 |
+
- d’éviter les duplications de code,
|
| 14 |
+
- de faciliter les tests (SQLite en mémoire),
|
| 15 |
+
- de rendre le projet plus lisible et plus professionnel.
|
| 16 |
+
|
| 17 |
+
Comportement selon l’environnement
|
| 18 |
+
----------------------------------
|
| 19 |
+
- En développement / production :
|
| 20 |
+
- les variables sont chargées depuis un fichier `.env`
|
| 21 |
+
- DATABASE_URL pointe généralement vers PostgreSQL
|
| 22 |
+
|
| 23 |
+
- En tests (pytest) :
|
| 24 |
+
- pytest définit automatiquement `PYTEST_CURRENT_TEST`
|
| 25 |
+
- le chargement du `.env` est désactivé
|
| 26 |
+
- les tests peuvent fournir leur propre DATABASE_URL (ex: SQLite en mémoire)
|
| 27 |
+
|
| 28 |
+
Base supportée
|
| 29 |
+
--------------
|
| 30 |
+
- PostgreSQL (recommandé en production)
|
| 31 |
+
- SQLite (utilisé pour les tests et le développement rapide)
|
| 32 |
+
|
| 33 |
+
Le code est compatible SQLAlchemy 2.x.
|
| 34 |
+
"""
|
| 35 |
from __future__ import annotations
|
| 36 |
|
| 37 |
import os
|
|
|
|
| 74 |
# Dependency pour obtenir une session de base de données dans les endpoints FastAPI,
|
| 75 |
# avec gestion automatique de la fermeture de la session après usage
|
| 76 |
def get_db() -> Generator[Session, None, None]:
|
| 77 |
+
"""
|
| 78 |
+
Fournit une session de base de données à un endpoint FastAPI.
|
| 79 |
+
|
| 80 |
+
Cette fonction est utilisée comme dépendance (`Depends(get_db)`).
|
| 81 |
+
|
| 82 |
+
Fonctionnement :
|
| 83 |
+
- ouvre une session SQLAlchemy,
|
| 84 |
+
- la met à disposition de l’endpoint,
|
| 85 |
+
- garantit sa fermeture après la requête (même en cas d’erreur).
|
| 86 |
+
|
| 87 |
+
Pourquoi ?
|
| 88 |
+
---------------------------
|
| 89 |
+
- évite les fuites de connexions,
|
| 90 |
+
- garantit une gestion propre du cycle de vie des sessions,
|
| 91 |
+
- respecte les bonnes pratiques FastAPI + SQLAlchemy.
|
| 92 |
+
|
| 93 |
+
Yields
|
| 94 |
+
------
|
| 95 |
+
sqlalchemy.orm.Session
|
| 96 |
+
Session active connectée à la base de données.
|
| 97 |
+
"""
|
| 98 |
db = SessionLocal()
|
| 99 |
try:
|
| 100 |
yield db
|
app/models.py
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
from datetime import datetime, timezone
|
|
@@ -15,21 +44,77 @@ from sqlalchemy import (
|
|
| 15 |
from sqlalchemy import JSON
|
| 16 |
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
|
| 17 |
|
| 18 |
-
|
| 19 |
def utcnow() -> datetime:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
return datetime.now(timezone.utc)
|
| 21 |
|
| 22 |
-
|
| 23 |
class Base(DeclarativeBase):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
pass
|
| 25 |
|
| 26 |
-
|
|
|
|
| 27 |
ID_PK = BigInteger().with_variant(Integer, "sqlite")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
ID_FK = BigInteger().with_variant(Integer, "sqlite")
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
-
# Modèles SQLAlchemy représentant les tables de la base de données, organisés par schéma (raw, clean, app)
|
| 32 |
class RawEmployee(Base):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
__tablename__ = "employees"
|
| 34 |
__table_args__ = (
|
| 35 |
Index("ix_raw_employees_employee_external_id", "employee_external_id"),
|
|
@@ -40,27 +125,83 @@ class RawEmployee(Base):
|
|
| 40 |
employee_external_id: Mapped[int] = mapped_column(Integer, nullable=False, unique=True)
|
| 41 |
|
| 42 |
|
| 43 |
-
# Les autres champs de la table raw.employees peuvent être ajoutés ici si nécessaire,
|
| 44 |
-
# mais ne sont pas indispensables pour les prédictions basées sur employee_id
|
| 45 |
class RawEmployeeSnapshot(Base):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
__tablename__ = "employee_snapshots"
|
| 47 |
__table_args__ = ({"schema": "raw"},)
|
| 48 |
|
| 49 |
id: Mapped[int] = mapped_column(ID_PK, primary_key=True, autoincrement=True)
|
| 50 |
|
| 51 |
|
| 52 |
-
# Les champs de la table raw.employee_snapshots peuvent être ajoutés ici si nécessaire,
|
| 53 |
-
# mais ne sont pas indispensables pour les prédictions basées sur employee_id
|
| 54 |
class RawSurvey(Base):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
__tablename__ = "surveys"
|
| 56 |
__table_args__ = ({"schema": "raw"},)
|
| 57 |
|
| 58 |
id: Mapped[int] = mapped_column(ID_PK, primary_key=True, autoincrement=True)
|
| 59 |
|
| 60 |
|
| 61 |
-
# Les champs de la table raw.surveys peuvent être ajoutés ici si nécessaire,
|
| 62 |
-
# mais ne sont pas indispensables pour les prédictions basées sur employee_id
|
| 63 |
class MLFeaturesEmployee(Base):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
__tablename__ = "ml_features_employees"
|
| 65 |
__table_args__ = (
|
| 66 |
Index("idx_clean_employee_id_created_at", "employee_id", "created_at"),
|
|
@@ -85,6 +226,7 @@ class MLFeaturesEmployee(Base):
|
|
| 85 |
|
| 86 |
employee: Mapped["RawEmployee"] = relationship("RawEmployee")
|
| 87 |
|
|
|
|
| 88 |
note_evaluation_precedente: Mapped[int] = mapped_column(Integer, nullable=False)
|
| 89 |
niveau_hierarchique_poste: Mapped[int] = mapped_column(Integer, nullable=False)
|
| 90 |
note_evaluation_actuelle: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
@@ -130,9 +272,36 @@ class MLFeaturesEmployee(Base):
|
|
| 130 |
a_quitte_l_entreprise: Mapped[int] = mapped_column(Integer, nullable=False)
|
| 131 |
|
| 132 |
|
| 133 |
-
# Les champs de la table app.prediction_requests peuvent être ajustés en fonction des besoins,
|
| 134 |
-
# mais les champs essentiels pour le suivi des prédictions sont employee_id, payload_json, et created_at
|
| 135 |
class PredictionRequest(Base):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
__tablename__ = "prediction_requests"
|
| 137 |
__table_args__ = (
|
| 138 |
Index("ix_prediction_requests_created_at", "created_at"),
|
|
@@ -165,15 +334,45 @@ class PredictionRequest(Base):
|
|
| 165 |
cascade="all, delete-orphan",
|
| 166 |
)
|
| 167 |
|
| 168 |
-
# Relations optionnelles vers les données brutes associées à la prédiction, si disponibles.
|
| 169 |
employee: Mapped[Optional["RawEmployee"]] = relationship("RawEmployee", foreign_keys=[employee_id])
|
| 170 |
snapshot: Mapped[Optional["RawEmployeeSnapshot"]] = relationship("RawEmployeeSnapshot", foreign_keys=[snapshot_id])
|
| 171 |
survey: Mapped[Optional["RawSurvey"]] = relationship("RawSurvey", foreign_keys=[survey_id])
|
| 172 |
|
| 173 |
|
| 174 |
-
# Les champs de la table app.predictions peuvent être ajustés en fonction des besoins,
|
| 175 |
-
# mais les champs essentiels pour le suivi des prédictions sont request_id, predicted_proba, et created_at
|
| 176 |
class Prediction(Base):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
__tablename__ = "predictions"
|
| 178 |
__table_args__ = (
|
| 179 |
Index("ix_predictions_request_id_created_at", "request_id", "created_at"),
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Modèles ORM SQLAlchemy du projet TechNova Partners.
|
| 3 |
+
|
| 4 |
+
Ce module définit les classes Python qui représentent les tables SQL de la base,
|
| 5 |
+
en suivant une organisation en 3 schémas :
|
| 6 |
+
|
| 7 |
+
- raw.* : données brutes (ingestion / stockage initial)
|
| 8 |
+
- clean.* : données nettoyées + features prêtes pour le modèle ML
|
| 9 |
+
- app.* : logs applicatifs (requêtes de prédiction + prédictions)
|
| 10 |
+
|
| 11 |
+
Pourquoi c'est utile ?
|
| 12 |
+
- On sépare clairement les responsabilités :
|
| 13 |
+
- raw = ce qu'on reçoit
|
| 14 |
+
- clean = ce qu'on donne au modèle
|
| 15 |
+
- app = ce qu'on trace (audit / monitoring)
|
| 16 |
+
|
| 17 |
+
Compatibilité SQLite / PostgreSQL
|
| 18 |
+
- En local dev / prod : PostgreSQL
|
| 19 |
+
- En tests : SQLite
|
| 20 |
+
SQLite gère moins bien certains types (ex: BigInteger), donc on utilise
|
| 21 |
+
`with_variant(Integer, "sqlite")` pour que les mêmes modèles fonctionnent
|
| 22 |
+
dans les deux environnements.
|
| 23 |
+
|
| 24 |
+
Contenu principal
|
| 25 |
+
- RawEmployee, RawEmployeeSnapshot, RawSurvey : tables brutes (raw)
|
| 26 |
+
- MLFeaturesEmployee : features prêtes (clean)
|
| 27 |
+
- PredictionRequest, Prediction : traçabilité des appels (app)
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
from __future__ import annotations
|
| 31 |
|
| 32 |
from datetime import datetime, timezone
|
|
|
|
| 44 |
from sqlalchemy import JSON
|
| 45 |
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
|
| 46 |
|
| 47 |
+
|
| 48 |
def utcnow() -> datetime:
|
| 49 |
+
"""
|
| 50 |
+
Retourne l'heure actuelle en UTC.
|
| 51 |
+
|
| 52 |
+
Cette fonction sert de valeur par défaut pour les champs `created_at`,
|
| 53 |
+
afin que toutes les dates stockées soient cohérentes (UTC) quel que soit
|
| 54 |
+
le serveur ou le pays où l'application tourne.
|
| 55 |
+
|
| 56 |
+
Returns
|
| 57 |
+
-------
|
| 58 |
+
datetime
|
| 59 |
+
Date et heure courantes avec timezone UTC.
|
| 60 |
+
"""
|
| 61 |
return datetime.now(timezone.utc)
|
| 62 |
|
| 63 |
+
|
| 64 |
class Base(DeclarativeBase):
|
| 65 |
+
"""
|
| 66 |
+
Classe de base SQLAlchemy pour tous les modèles ORM.
|
| 67 |
+
|
| 68 |
+
Tous les modèles (tables) héritent de `Base`. SQLAlchemy utilise cette base
|
| 69 |
+
pour :
|
| 70 |
+
- enregistrer les classes déclarées,
|
| 71 |
+
- générer le schéma (create_all),
|
| 72 |
+
- mapper les objets Python vers les lignes SQL.
|
| 73 |
+
"""
|
| 74 |
pass
|
| 75 |
|
| 76 |
+
|
| 77 |
+
# Identifiants compatibles Postgres / SQLite
|
| 78 |
ID_PK = BigInteger().with_variant(Integer, "sqlite")
|
| 79 |
+
"""
|
| 80 |
+
Type de colonne pour une clé primaire (Primary Key).
|
| 81 |
+
|
| 82 |
+
- Sur PostgreSQL : BigInteger (supporte de grands ids)
|
| 83 |
+
- Sur SQLite : Integer (BigInteger n'est pas géré pareil)
|
| 84 |
+
|
| 85 |
+
Cela garantit que les mêmes modèles fonctionnent :
|
| 86 |
+
- en production (PostgreSQL)
|
| 87 |
+
- en tests (SQLite)
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
ID_FK = BigInteger().with_variant(Integer, "sqlite")
|
| 91 |
+
"""
|
| 92 |
+
Type de colonne pour une clé étrangère (Foreign Key), même logique que ID_PK.
|
| 93 |
+
"""
|
| 94 |
|
| 95 |
|
|
|
|
| 96 |
class RawEmployee(Base):
|
| 97 |
+
"""
|
| 98 |
+
Table `raw.employees` : employés (données brutes).
|
| 99 |
+
|
| 100 |
+
Rôle
|
| 101 |
+
----
|
| 102 |
+
Cette table représente l'identité "de base" d'un employé.
|
| 103 |
+
Dans ton projet, elle sert surtout à fournir un identifiant interne (`id`)
|
| 104 |
+
qui peut être référencé par d'autres tables.
|
| 105 |
+
|
| 106 |
+
Champs principaux
|
| 107 |
+
-----------------
|
| 108 |
+
id : int
|
| 109 |
+
Clé primaire interne.
|
| 110 |
+
employee_external_id : int
|
| 111 |
+
Identifiant provenant du dataset (id d'origine).
|
| 112 |
+
|
| 113 |
+
Index
|
| 114 |
+
-----
|
| 115 |
+
Un index est défini sur `employee_external_id` pour accélérer les recherches
|
| 116 |
+
(utile si on mappe un id externe vers l'id interne).
|
| 117 |
+
"""
|
| 118 |
__tablename__ = "employees"
|
| 119 |
__table_args__ = (
|
| 120 |
Index("ix_raw_employees_employee_external_id", "employee_external_id"),
|
|
|
|
| 125 |
employee_external_id: Mapped[int] = mapped_column(Integer, nullable=False, unique=True)
|
| 126 |
|
| 127 |
|
|
|
|
|
|
|
| 128 |
class RawEmployeeSnapshot(Base):
|
| 129 |
+
"""
|
| 130 |
+
Table `raw.employee_snapshots` : snapshots bruts (optionnel).
|
| 131 |
+
|
| 132 |
+
Idée
|
| 133 |
+
----
|
| 134 |
+
Un snapshot peut représenter un état de l'employé à un instant T
|
| 135 |
+
(ex: poste, salaire, département à une date).
|
| 136 |
+
|
| 137 |
+
Dans V1
|
| 138 |
+
-----------
|
| 139 |
+
le champ `id` pour pouvoir relier des logs de prédiction à un snapshot.
|
| 140 |
+
"""
|
| 141 |
__tablename__ = "employee_snapshots"
|
| 142 |
__table_args__ = ({"schema": "raw"},)
|
| 143 |
|
| 144 |
id: Mapped[int] = mapped_column(ID_PK, primary_key=True, autoincrement=True)
|
| 145 |
|
| 146 |
|
|
|
|
|
|
|
| 147 |
class RawSurvey(Base):
|
| 148 |
+
"""
|
| 149 |
+
Table `raw.surveys` : enquêtes / questionnaires bruts (optionnel).
|
| 150 |
+
|
| 151 |
+
Idée
|
| 152 |
+
----
|
| 153 |
+
Certaines features peuvent venir d'enquêtes internes (satisfaction, etc.).
|
| 154 |
+
Cette table permet de stocker ces données "raw" si tu les ajoutes plus tard.
|
| 155 |
+
|
| 156 |
+
Dans V1
|
| 157 |
+
-----------
|
| 158 |
+
Seul `id` est nécessaire pour conserver une structure évolutive.
|
| 159 |
+
"""
|
| 160 |
__tablename__ = "surveys"
|
| 161 |
__table_args__ = ({"schema": "raw"},)
|
| 162 |
|
| 163 |
id: Mapped[int] = mapped_column(ID_PK, primary_key=True, autoincrement=True)
|
| 164 |
|
| 165 |
|
|
|
|
|
|
|
| 166 |
class MLFeaturesEmployee(Base):
|
| 167 |
+
"""
|
| 168 |
+
Table `clean.ml_features_employees` : features ML prêtes pour l'inférence.
|
| 169 |
+
|
| 170 |
+
Rôle
|
| 171 |
+
---------------------
|
| 172 |
+
Cette table contient les variables déjà nettoyées et transformées
|
| 173 |
+
(feature engineering terminé). Elle est directement compatible avec le
|
| 174 |
+
pipeline du modèle ML.
|
| 175 |
+
|
| 176 |
+
MLOps-friendly ?
|
| 177 |
+
-------------------------------
|
| 178 |
+
- L'API ne fait PAS de preprocessing.
|
| 179 |
+
- Elle lit la dernière ligne "clean" et prédit.
|
| 180 |
+
- Le pipeline de préparation tourne séparément (scripts ETL).
|
| 181 |
+
|
| 182 |
+
Organisation
|
| 183 |
+
------------
|
| 184 |
+
- Une ligne = un jeu de features à un instant donné (created_at).
|
| 185 |
+
- Pour un employee_id, on peut avoir plusieurs lignes au fil du temps.
|
| 186 |
+
L'API récupère généralement la plus récente.
|
| 187 |
+
|
| 188 |
+
Champs
|
| 189 |
+
------
|
| 190 |
+
employee_id : int
|
| 191 |
+
Référence vers `raw.employees.id`.
|
| 192 |
+
created_at : datetime
|
| 193 |
+
Date de création du snapshot de features.
|
| 194 |
+
a_quitte_l_entreprise : int
|
| 195 |
+
Target (0/1). Utile pour entraînement / audit.
|
| 196 |
+
En production, peut être null (selon ta stratégie),
|
| 197 |
+
mais ici il est requis.
|
| 198 |
+
|
| 199 |
+
Index
|
| 200 |
+
-----
|
| 201 |
+
Plusieurs index pour accélérer :
|
| 202 |
+
- récupération du dernier snapshot par employee_id
|
| 203 |
+
- requêtes d'analyse sur la target
|
| 204 |
+
"""
|
| 205 |
__tablename__ = "ml_features_employees"
|
| 206 |
__table_args__ = (
|
| 207 |
Index("idx_clean_employee_id_created_at", "employee_id", "created_at"),
|
|
|
|
| 226 |
|
| 227 |
employee: Mapped["RawEmployee"] = relationship("RawEmployee")
|
| 228 |
|
| 229 |
+
# (Ensuite: tes features, inchangées)
|
| 230 |
note_evaluation_precedente: Mapped[int] = mapped_column(Integer, nullable=False)
|
| 231 |
niveau_hierarchique_poste: Mapped[int] = mapped_column(Integer, nullable=False)
|
| 232 |
note_evaluation_actuelle: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
|
|
| 272 |
a_quitte_l_entreprise: Mapped[int] = mapped_column(Integer, nullable=False)
|
| 273 |
|
| 274 |
|
|
|
|
|
|
|
| 275 |
class PredictionRequest(Base):
|
| 276 |
+
"""
|
| 277 |
+
Table `app.prediction_requests` : journal des requêtes de prédiction.
|
| 278 |
+
|
| 279 |
+
Rôle
|
| 280 |
+
----
|
| 281 |
+
Chaque appel à l'API de prédiction crée une "request" :
|
| 282 |
+
- qui a fait l'appel (via le contexte)
|
| 283 |
+
- pour quel employé (si applicable)
|
| 284 |
+
- et/ou quel payload a été envoyé
|
| 285 |
+
|
| 286 |
+
Pourquoi ?
|
| 287 |
+
----------
|
| 288 |
+
- Traçabilité (audit)
|
| 289 |
+
- Débogage (retrouver quel payload a produit une prédiction)
|
| 290 |
+
- Monitoring (volume d'appels dans le temps)
|
| 291 |
+
|
| 292 |
+
Champs importants
|
| 293 |
+
-----------------
|
| 294 |
+
payload_json : dict
|
| 295 |
+
Contenu de la requête (mode, employee_id ou features).
|
| 296 |
+
created_at : datetime
|
| 297 |
+
Timestamp UTC de la requête.
|
| 298 |
+
|
| 299 |
+
Relations
|
| 300 |
+
---------
|
| 301 |
+
predictions : list[Prediction]
|
| 302 |
+
Une request peut avoir une ou plusieurs prédictions associées
|
| 303 |
+
(dans ton cas, en général une seule).
|
| 304 |
+
"""
|
| 305 |
__tablename__ = "prediction_requests"
|
| 306 |
__table_args__ = (
|
| 307 |
Index("ix_prediction_requests_created_at", "created_at"),
|
|
|
|
| 334 |
cascade="all, delete-orphan",
|
| 335 |
)
|
| 336 |
|
|
|
|
| 337 |
employee: Mapped[Optional["RawEmployee"]] = relationship("RawEmployee", foreign_keys=[employee_id])
|
| 338 |
snapshot: Mapped[Optional["RawEmployeeSnapshot"]] = relationship("RawEmployeeSnapshot", foreign_keys=[snapshot_id])
|
| 339 |
survey: Mapped[Optional["RawSurvey"]] = relationship("RawSurvey", foreign_keys=[survey_id])
|
| 340 |
|
| 341 |
|
|
|
|
|
|
|
| 342 |
class Prediction(Base):
|
| 343 |
+
"""
|
| 344 |
+
Table `app.predictions` : journal des résultats de prédiction.
|
| 345 |
+
|
| 346 |
+
Rôle
|
| 347 |
+
----
|
| 348 |
+
Stocke le résultat d'une prédiction ML, lié à une `PredictionRequest`.
|
| 349 |
+
|
| 350 |
+
Pourquoi ?
|
| 351 |
+
----------
|
| 352 |
+
- Conserver l'historique de scoring
|
| 353 |
+
- Auditer les décisions (classe / probabilité / seuil)
|
| 354 |
+
- Comparer des versions de modèles (model_version)
|
| 355 |
+
|
| 356 |
+
Champs importants
|
| 357 |
+
-----------------
|
| 358 |
+
model_version : str
|
| 359 |
+
Identifiant de version du modèle (ex: "xgb_v1").
|
| 360 |
+
predicted_class : int
|
| 361 |
+
Classe binaire prédite (0/1).
|
| 362 |
+
predicted_proba : float
|
| 363 |
+
Probabilité prédite d'appartenir à la classe positive (turnover=1).
|
| 364 |
+
threshold_used : float
|
| 365 |
+
Seuil appliqué pour transformer proba -> classe.
|
| 366 |
+
latency_ms : int | None
|
| 367 |
+
Temps de réponse de la prédiction côté API (utile monitoring).
|
| 368 |
+
created_at : datetime
|
| 369 |
+
Timestamp UTC de la prédiction.
|
| 370 |
+
|
| 371 |
+
Relation
|
| 372 |
+
--------
|
| 373 |
+
request : PredictionRequest
|
| 374 |
+
La requête associée à cette prédiction.
|
| 375 |
+
"""
|
| 376 |
__tablename__ = "predictions"
|
| 377 |
__table_args__ = (
|
| 378 |
Index("ix_predictions_request_id_created_at", "request_id", "created_at"),
|
app/security.py
CHANGED
|
@@ -1,8 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import Header, HTTPException, status
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Sécurité : vérification de la clé API dans les requêtes entrantes
|
| 5 |
def verify_api_key(x_api_key: str | None = Header(default=None, alias="X-API-Key")):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
api_key = os.getenv("API_KEY") # lu à chaque requête (robuste)
|
| 7 |
|
| 8 |
if not api_key:
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Gestion de la sécurité de l’API TechNova Partners via une clé API (API Key).
|
| 3 |
+
|
| 4 |
+
Ce module contient la logique de protection des endpoints FastAPI à l’aide
|
| 5 |
+
d’un mécanisme simple mais efficace basé sur un header HTTP personnalisé.
|
| 6 |
+
|
| 7 |
+
Principe de sécurité
|
| 8 |
+
--------------------
|
| 9 |
+
- Chaque requête vers l’API doit inclure le header :
|
| 10 |
+
|
| 11 |
+
X-API-Key: <API_KEY>
|
| 12 |
+
|
| 13 |
+
- La valeur attendue est définie côté serveur via la variable
|
| 14 |
+
d’environnement `API_KEY`.
|
| 15 |
+
|
| 16 |
+
- Si la clé est absente, incorrecte ou si le serveur n’est pas configuré,
|
| 17 |
+
l’accès est refusé.
|
| 18 |
+
|
| 19 |
+
Objectif
|
| 20 |
+
---------------------------------------
|
| 21 |
+
Ce mécanisme illustre :
|
| 22 |
+
- une première couche de sécurité côté API,
|
| 23 |
+
- l’utilisation des dépendances FastAPI (`Depends`) pour centraliser la logique,
|
| 24 |
+
- la différence entre :
|
| 25 |
+
- une erreur de configuration serveur (500),
|
| 26 |
+
- une erreur d’authentification client (401).
|
| 27 |
+
|
| 28 |
+
"""
|
| 29 |
from fastapi import Header, HTTPException, status
|
| 30 |
import os
|
| 31 |
|
| 32 |
# Sécurité : vérification de la clé API dans les requêtes entrantes
|
| 33 |
def verify_api_key(x_api_key: str | None = Header(default=None, alias="X-API-Key")):
|
| 34 |
+
"""
|
| 35 |
+
Vérifie la présence et la validité de la clé API dans une requête HTTP.
|
| 36 |
+
|
| 37 |
+
Cette fonction est utilisée comme dépendance FastAPI
|
| 38 |
+
(`Depends(verify_api_key)`) sur les endpoints protégés.
|
| 39 |
+
|
| 40 |
+
Fonctionnement :
|
| 41 |
+
---------------
|
| 42 |
+
1) Lit la clé API attendue depuis la variable d’environnement `API_KEY`
|
| 43 |
+
2) Compare cette valeur avec celle fournie dans le header `X-API-Key`
|
| 44 |
+
3) Refuse l’accès si :
|
| 45 |
+
- la clé serveur n’est pas configurée,
|
| 46 |
+
- la clé est absente,
|
| 47 |
+
- la clé est incorrecte
|
| 48 |
+
|
| 49 |
+
Paramètres
|
| 50 |
+
----------
|
| 51 |
+
x_api_key : str | None
|
| 52 |
+
Valeur du header HTTP `X-API-Key` envoyé par le client.
|
| 53 |
+
|
| 54 |
+
Raises
|
| 55 |
+
------
|
| 56 |
+
fastapi.HTTPException
|
| 57 |
+
- 500 si la variable d’environnement API_KEY n’est pas définie côté serveur
|
| 58 |
+
- 401 si la clé est absente ou invalide
|
| 59 |
+
|
| 60 |
+
Returns
|
| 61 |
+
-------
|
| 62 |
+
None
|
| 63 |
+
Ne retourne rien si l’authentification réussit.
|
| 64 |
+
La requête peut alors continuer normalement.
|
| 65 |
+
"""
|
| 66 |
api_key = os.getenv("API_KEY") # lu à chaque requête (robuste)
|
| 67 |
|
| 68 |
if not api_key:
|
docs/api_reference/app_api.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.api
|
| 2 |
+
|
| 3 |
+
::: app.api
|
docs/api_reference/app_models.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.models
|
| 2 |
+
|
| 3 |
+
::: app.models
|
docs/api_reference/domain.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# domain.domain
|
| 2 |
+
|
| 3 |
+
::: domain.domain
|
docs/api_reference/technova_service.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# service.technova_service
|
| 2 |
+
|
| 3 |
+
::: service.technova_service
|
docs/app.api.html
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="utf-8">
|
| 5 |
-
<title>Python: module app.api</title>
|
| 6 |
-
</head><body>
|
| 7 |
-
|
| 8 |
-
<table class="heading">
|
| 9 |
-
<tr class="heading-text decor">
|
| 10 |
-
<td class="title"> <br><strong class="title"><a href="app.html" class="white">app</a>.api</strong></td>
|
| 11 |
-
<td class="extra"><a href=".">index</a><br><a href="file:c%3A%5Cusers%5Cgonza%5Copenclassroom%5Cprojet_4_classification%5Cprojet_technova_partners%5Capp%5Capi.py">c:\users\gonza\openclassroom\projet_4_classification\projet_technova_partners\app\api.py</a></td></tr></table>
|
| 12 |
-
<p></p>
|
| 13 |
-
<p>
|
| 14 |
-
<table class="section">
|
| 15 |
-
<tr class="decor functions-decor heading-text">
|
| 16 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Functions</strong></td></tr>
|
| 17 |
-
|
| 18 |
-
<tr><td class="decor functions-decor"><span class="code"> </span></td><td> </td>
|
| 19 |
-
<td class="singlecolumn"><dl><dt><a name="-get_service"><strong>get_service</strong></a>() -> 'TechNovaService'</dt><dd><span class="code"># Dependency pour obtenir une instance du service métier dans les endpoints FastAPI</span></dd></dl>
|
| 20 |
-
<dl><dt><a name="-health"><strong>health</strong></a>()</dt><dd><span class="code"># endpoint de santé pour monitoring</span></dd></dl>
|
| 21 |
-
<dl><dt><a name="-latest_predictions"><strong>latest_predictions</strong></a>(
|
| 22 |
-
limit: 'int' = 20,
|
| 23 |
-
db: 'Session' = Depends(dependency=<function get_db at 0x00000224C1C0E7A0>, use_cache=True, scope=None)
|
| 24 |
-
)</dt><dd><span class="code">#endpoint pour récupérer les dernières prédictions stockées en base, avec pagination</span></dd></dl>
|
| 25 |
-
<dl><dt><a name="-perf_counter"><strong>perf_counter</strong></a>()</dt><dd><span class="code"><a href="#-perf_counter">perf_counter</a>() -> float<br>
|
| 26 |
-
<br>
|
| 27 |
-
Performance counter for benchmarking.</span></dd></dl>
|
| 28 |
-
<dl><dt><a name="-predict_by_employee_id"><strong>predict_by_employee_id</strong></a>(
|
| 29 |
-
employee_id: 'int',
|
| 30 |
-
db: 'Session' = Depends(dependency=<function get_db at 0x00000224C1C0E7A0>, use_cache=True, scope=None),
|
| 31 |
-
service: 'TechNovaService' = Depends(dependency=<function get_service at 0x00000224C1C5EDE0>, use_cache=True, scope=None)
|
| 32 |
-
) -> 'ModelResponse'</dt><dd><span class="code">#prédiction via ID employé — mode recommandé pour la production</span></dd></dl>
|
| 33 |
-
<dl><dt><a name="-predict_by_features"><strong>predict_by_features</strong></a>(
|
| 34 |
-
payload: 'ModelRequest',
|
| 35 |
-
db: 'Session' = Depends(dependency=<function get_db at 0x00000224C1C0E7A0>, use_cache=True, scope=None),
|
| 36 |
-
service: 'TechNovaService' = Depends(dependency=<function get_service at 0x00000224C1C5EDE0>, use_cache=True, scope=None)
|
| 37 |
-
) -> 'ModelResponse'</dt><dd><span class="code">#endpoint de prédiction via features brutes — utile pour tests et debug, mais pas recommandé pour la production</span></dd></dl>
|
| 38 |
-
<dl><dt><a name="-root"><strong>root</strong></a>()</dt><dd><span class="code">#accessible via "/" pour rediriger vers la doc interactive, mais pas dans la doc elle-même</span></dd></dl>
|
| 39 |
-
</td></tr></table><p>
|
| 40 |
-
<table class="section">
|
| 41 |
-
<tr class="decor data-decor heading-text">
|
| 42 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Data</strong></td></tr>
|
| 43 |
-
|
| 44 |
-
<tr><td class="decor data-decor"><span class="code"> </span></td><td> </td>
|
| 45 |
-
<td class="singlecolumn"><strong>MODEL_VERSION</strong> = 'xgb_v1'<br>
|
| 46 |
-
<strong>app</strong> = <fastapi.applications.FastAPI object></td></tr></table>
|
| 47 |
-
</body></html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/app.models.html
DELETED
|
@@ -1,712 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="utf-8">
|
| 5 |
-
<title>Python: module app.models</title>
|
| 6 |
-
</head><body>
|
| 7 |
-
|
| 8 |
-
<table class="heading">
|
| 9 |
-
<tr class="heading-text decor">
|
| 10 |
-
<td class="title"> <br><strong class="title"><a href="app.html" class="white">app</a>.models</strong></td>
|
| 11 |
-
<td class="extra"><a href=".">index</a><br><a href="file:c%3A%5Cusers%5Cgonza%5Copenclassroom%5Cprojet_4_classification%5Cprojet_technova_partners%5Capp%5Cmodels.py">c:\users\gonza\openclassroom\projet_4_classification\projet_technova_partners\app\models.py</a></td></tr></table>
|
| 12 |
-
<p></p>
|
| 13 |
-
<p>
|
| 14 |
-
<table class="section">
|
| 15 |
-
<tr class="decor index-decor heading-text">
|
| 16 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Classes</strong></td></tr>
|
| 17 |
-
|
| 18 |
-
<tr><td class="decor index-decor"><span class="code"> </span></td><td> </td>
|
| 19 |
-
<td class="singlecolumn"><dl>
|
| 20 |
-
<dt class="heading-text"><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>(<a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a>)
|
| 21 |
-
</dt><dd>
|
| 22 |
-
<dl>
|
| 23 |
-
<dt class="heading-text"><a href="app.models.html#Base">Base</a>
|
| 24 |
-
</dt><dd>
|
| 25 |
-
<dl>
|
| 26 |
-
<dt class="heading-text"><a href="app.models.html#MLFeaturesEmployee">MLFeaturesEmployee</a>
|
| 27 |
-
</dt><dt class="heading-text"><a href="app.models.html#Prediction">Prediction</a>
|
| 28 |
-
</dt><dt class="heading-text"><a href="app.models.html#PredictionRequest">PredictionRequest</a>
|
| 29 |
-
</dt><dt class="heading-text"><a href="app.models.html#RawEmployee">RawEmployee</a>
|
| 30 |
-
</dt><dt class="heading-text"><a href="app.models.html#RawEmployeeSnapshot">RawEmployeeSnapshot</a>
|
| 31 |
-
</dt><dt class="heading-text"><a href="app.models.html#RawSurvey">RawSurvey</a>
|
| 32 |
-
</dt></dl>
|
| 33 |
-
</dd>
|
| 34 |
-
</dl>
|
| 35 |
-
</dd>
|
| 36 |
-
</dl>
|
| 37 |
-
<p>
|
| 38 |
-
<table class="section">
|
| 39 |
-
<tr class="decor title-decor heading-text">
|
| 40 |
-
<td class="section-title" colspan=3> <br><a name="Base">class <strong>Base</strong></a>(<a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>)</td></tr>
|
| 41 |
-
|
| 42 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 43 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#Base">Base</a>(**kwargs: 'Any') -&gt; 'None'<br>
|
| 44 |
-
<br>
|
| 45 |
-
# <a href="#Base">Base</a> de données SQLAlchemy pour les modèles ORM<br> </span></td></tr>
|
| 46 |
-
<tr><td> </td>
|
| 47 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 48 |
-
<dd><a href="app.models.html#Base">Base</a></dd>
|
| 49 |
-
<dd><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a></dd>
|
| 50 |
-
<dd><a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a></dd>
|
| 51 |
-
<dd><a href="typing.html#Generic">typing.Generic</a></dd>
|
| 52 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 53 |
-
</dl>
|
| 54 |
-
<hr>
|
| 55 |
-
Methods defined here:<br>
|
| 56 |
-
<dl><dt><a name="Base-__init__"><strong>__init__</strong></a>(self: 'Any', **kwargs: 'Any') -> 'None'<span class="grey"><span class="heading-text"> from sqlalchemy.orm.decl_base</span></span></dt><dd><span class="code">A simple constructor that allows initialization from kwargs.<br>
|
| 57 |
-
<br>
|
| 58 |
-
Sets attributes on the constructed instance using the names and<br>
|
| 59 |
-
values in ``kwargs``.<br>
|
| 60 |
-
<br>
|
| 61 |
-
Only keys that are present as<br>
|
| 62 |
-
attributes of the instance's class are allowed. These could be,<br>
|
| 63 |
-
for example, any mapped columns or relationships.</span></dd></dl>
|
| 64 |
-
|
| 65 |
-
<hr>
|
| 66 |
-
Data and other attributes defined here:<br>
|
| 67 |
-
<dl><dt><strong>__annotations__</strong> = {}</dl>
|
| 68 |
-
|
| 69 |
-
<dl><dt><strong>__parameters__</strong> = ()</dl>
|
| 70 |
-
|
| 71 |
-
<dl><dt><strong>metadata</strong> = MetaData()</dl>
|
| 72 |
-
|
| 73 |
-
<dl><dt><strong>registry</strong> = <sqlalchemy.orm.decl_api.registry object></dl>
|
| 74 |
-
|
| 75 |
-
<hr>
|
| 76 |
-
Class methods inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 77 |
-
<dl><dt><a name="Base-__init_subclass__"><strong>__init_subclass__</strong></a>(**kw: 'Any') -> 'None'</dt><dd><span class="code">Function to initialize subclasses.</span></dd></dl>
|
| 78 |
-
|
| 79 |
-
<hr>
|
| 80 |
-
Data descriptors inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 81 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 82 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 83 |
-
</dl>
|
| 84 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 85 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 86 |
-
</dl>
|
| 87 |
-
<hr>
|
| 88 |
-
Data and other attributes inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 89 |
-
<dl><dt><strong>__orig_bases__</strong> = (sqlalchemy.inspection.Inspectable[sqlalchemy.orm.state.InstanceState[typing.Any]],)</dl>
|
| 90 |
-
|
| 91 |
-
<hr>
|
| 92 |
-
Class methods inherited from <a href="typing.html#Generic">typing.Generic</a>:<br>
|
| 93 |
-
<dl><dt><a name="Base-__class_getitem__"><strong>__class_getitem__</strong></a>(...)</dt><dd><span class="code">Parameterizes a generic class.<br>
|
| 94 |
-
<br>
|
| 95 |
-
At least, parameterizing a generic class is the *main* thing this<br>
|
| 96 |
-
method does. For example, for some generic class `Foo`, this is called<br>
|
| 97 |
-
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.<br>
|
| 98 |
-
<br>
|
| 99 |
-
However, note that this method is also called when defining generic<br>
|
| 100 |
-
classes in the first place with `class Foo[T]: ...`.</span></dd></dl>
|
| 101 |
-
|
| 102 |
-
</td></tr></table> <p>
|
| 103 |
-
<table class="section">
|
| 104 |
-
<tr class="decor title-decor heading-text">
|
| 105 |
-
<td class="section-title" colspan=3> <br><a name="MLFeaturesEmployee">class <strong>MLFeaturesEmployee</strong></a>(<a href="app.models.html#Base">Base</a>)</td></tr>
|
| 106 |
-
|
| 107 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 108 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#MLFeaturesEmployee">MLFeaturesEmployee</a>(**kwargs)<br>
|
| 109 |
-
<br>
|
| 110 |
-
# Les champs de la table raw.surveys peuvent être ajoutés ici si nécessaire,<br>
|
| 111 |
-
# mais ne sont pas indispensables pour les prédictions basées sur employee_id<br> </span></td></tr>
|
| 112 |
-
<tr><td> </td>
|
| 113 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 114 |
-
<dd><a href="app.models.html#MLFeaturesEmployee">MLFeaturesEmployee</a></dd>
|
| 115 |
-
<dd><a href="app.models.html#Base">Base</a></dd>
|
| 116 |
-
<dd><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a></dd>
|
| 117 |
-
<dd><a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a></dd>
|
| 118 |
-
<dd><a href="typing.html#Generic">typing.Generic</a></dd>
|
| 119 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 120 |
-
</dl>
|
| 121 |
-
<hr>
|
| 122 |
-
Methods defined here:<br>
|
| 123 |
-
<dl><dt><a name="MLFeaturesEmployee-__init__"><strong>__init__</strong></a>(self, **kwargs)<span class="grey"><span class="heading-text"> from sqlalchemy.orm.instrumentation</span></span></dt><dd><span class="code">A simple constructor that allows initialization from kwargs.<br>
|
| 124 |
-
<br>
|
| 125 |
-
Sets attributes on the constructed instance using the names and<br>
|
| 126 |
-
values in ``kwargs``.<br>
|
| 127 |
-
<br>
|
| 128 |
-
Only keys that are present as<br>
|
| 129 |
-
attributes of the instance's class are allowed. These could be,<br>
|
| 130 |
-
for example, any mapped columns or relationships.</span></dd></dl>
|
| 131 |
-
|
| 132 |
-
<hr>
|
| 133 |
-
Data descriptors defined here:<br>
|
| 134 |
-
<dl><dt><strong>a_quitte_l_entreprise</strong></dt>
|
| 135 |
-
</dl>
|
| 136 |
-
<dl><dt><strong>age</strong></dt>
|
| 137 |
-
</dl>
|
| 138 |
-
<dl><dt><strong>anciennete_sans_promotion</strong></dt>
|
| 139 |
-
</dl>
|
| 140 |
-
<dl><dt><strong>annee_experience_totale</strong></dt>
|
| 141 |
-
</dl>
|
| 142 |
-
<dl><dt><strong>annees_dans_l_entreprise</strong></dt>
|
| 143 |
-
</dl>
|
| 144 |
-
<dl><dt><strong>annees_dans_le_poste_actuel</strong></dt>
|
| 145 |
-
</dl>
|
| 146 |
-
<dl><dt><strong>annees_depuis_la_derniere_promotion</strong></dt>
|
| 147 |
-
</dl>
|
| 148 |
-
<dl><dt><strong>annees_sous_responsable_actuel</strong></dt>
|
| 149 |
-
</dl>
|
| 150 |
-
<dl><dt><strong>augmentation_salaire_precedente</strong></dt>
|
| 151 |
-
</dl>
|
| 152 |
-
<dl><dt><strong>created_at</strong></dt>
|
| 153 |
-
</dl>
|
| 154 |
-
<dl><dt><strong>departement</strong></dt>
|
| 155 |
-
</dl>
|
| 156 |
-
<dl><dt><strong>distance_domicile_travail</strong></dt>
|
| 157 |
-
</dl>
|
| 158 |
-
<dl><dt><strong>domaine_etude</strong></dt>
|
| 159 |
-
</dl>
|
| 160 |
-
<dl><dt><strong>employee</strong></dt>
|
| 161 |
-
</dl>
|
| 162 |
-
<dl><dt><strong>employee_id</strong></dt>
|
| 163 |
-
</dl>
|
| 164 |
-
<dl><dt><strong>frequence_deplacement</strong></dt>
|
| 165 |
-
</dl>
|
| 166 |
-
<dl><dt><strong>genre</strong></dt>
|
| 167 |
-
</dl>
|
| 168 |
-
<dl><dt><strong>heures_supplementaires</strong></dt>
|
| 169 |
-
</dl>
|
| 170 |
-
<dl><dt><strong>id</strong></dt>
|
| 171 |
-
</dl>
|
| 172 |
-
<dl><dt><strong>jeune_surcharge</strong></dt>
|
| 173 |
-
</dl>
|
| 174 |
-
<dl><dt><strong>mobilite_carriere</strong></dt>
|
| 175 |
-
</dl>
|
| 176 |
-
<dl><dt><strong>nb_formations_suivies</strong></dt>
|
| 177 |
-
</dl>
|
| 178 |
-
<dl><dt><strong>niveau_education</strong></dt>
|
| 179 |
-
</dl>
|
| 180 |
-
<dl><dt><strong>niveau_hierarchique_poste</strong></dt>
|
| 181 |
-
</dl>
|
| 182 |
-
<dl><dt><strong>nombre_experiences_precedentes</strong></dt>
|
| 183 |
-
</dl>
|
| 184 |
-
<dl><dt><strong>nombre_participation_pee</strong></dt>
|
| 185 |
-
</dl>
|
| 186 |
-
<dl><dt><strong>nonlinaire_charge_contrainte</strong></dt>
|
| 187 |
-
</dl>
|
| 188 |
-
<dl><dt><strong>nonlinaire_surmenage_insatisfaction</strong></dt>
|
| 189 |
-
</dl>
|
| 190 |
-
<dl><dt><strong>nonlineaire_participation_pee</strong></dt>
|
| 191 |
-
</dl>
|
| 192 |
-
<dl><dt><strong>note_evaluation_actuelle</strong></dt>
|
| 193 |
-
</dl>
|
| 194 |
-
<dl><dt><strong>note_evaluation_precedente</strong></dt>
|
| 195 |
-
</dl>
|
| 196 |
-
<dl><dt><strong>poste</strong></dt>
|
| 197 |
-
</dl>
|
| 198 |
-
<dl><dt><strong>ratio_heures_sup_salaire</strong></dt>
|
| 199 |
-
</dl>
|
| 200 |
-
<dl><dt><strong>revenu_mensuel</strong></dt>
|
| 201 |
-
</dl>
|
| 202 |
-
<dl><dt><strong>risque_global</strong></dt>
|
| 203 |
-
</dl>
|
| 204 |
-
<dl><dt><strong>satisfaction_moyenne</strong></dt>
|
| 205 |
-
</dl>
|
| 206 |
-
<dl><dt><strong>statut_marital</strong></dt>
|
| 207 |
-
</dl>
|
| 208 |
-
<hr>
|
| 209 |
-
Data and other attributes defined here:<br>
|
| 210 |
-
<dl><dt><strong>__annotations__</strong> = {'a_quitte_l_entreprise': 'Mapped[int]', 'age': 'Mapped[int]', 'anciennete_sans_promotion': 'Mapped[float]', 'annee_experience_totale': 'Mapped[int]', 'annees_dans_l_entreprise': 'Mapped[int]', 'annees_dans_le_poste_actuel': 'Mapped[int]', 'annees_depuis_la_derniere_promotion': 'Mapped[int]', 'annees_sous_responsable_actuel': 'Mapped[int]', 'augmentation_salaire_precedente': 'Mapped[float]', 'created_at': 'Mapped[datetime]', ...}</dl>
|
| 211 |
-
|
| 212 |
-
<dl><dt><strong>__mapper__</strong> = <Mapper at 0x28b5d075310; MLFeaturesEmployee></dl>
|
| 213 |
-
|
| 214 |
-
<dl><dt><strong>__parameters__</strong> = ()</dl>
|
| 215 |
-
|
| 216 |
-
<dl><dt><strong>__table__</strong> = Table('ml_features_employees', MetaData(), Colum...ures_employees>, nullable=False), schema='clean')</dl>
|
| 217 |
-
|
| 218 |
-
<dl><dt><strong>__table_args__</strong> = (Index('idx_clean_employee_id_created_at', Column...efault(<function utcnow at 0x0000028B5D04ACA0>))), Index('idx_ml_features_target', Column('a_quitte..., table=<ml_features_employees>, nullable=False)), Index('idx_ml_features_target_created_at', Colum...efault(<function utcnow at 0x0000028B5D04ACA0>))), {'schema': 'clean'})</dl>
|
| 219 |
-
|
| 220 |
-
<dl><dt><strong>__tablename__</strong> = 'ml_features_employees'</dl>
|
| 221 |
-
|
| 222 |
-
<hr>
|
| 223 |
-
Data and other attributes inherited from <a href="app.models.html#Base">Base</a>:<br>
|
| 224 |
-
<dl><dt><strong>metadata</strong> = MetaData()</dl>
|
| 225 |
-
|
| 226 |
-
<dl><dt><strong>registry</strong> = <sqlalchemy.orm.decl_api.registry object></dl>
|
| 227 |
-
|
| 228 |
-
<hr>
|
| 229 |
-
Class methods inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 230 |
-
<dl><dt><a name="MLFeaturesEmployee-__init_subclass__"><strong>__init_subclass__</strong></a>(**kw: 'Any') -> 'None'</dt><dd><span class="code">Function to initialize subclasses.</span></dd></dl>
|
| 231 |
-
|
| 232 |
-
<hr>
|
| 233 |
-
Data descriptors inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 234 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 235 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 236 |
-
</dl>
|
| 237 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 238 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 239 |
-
</dl>
|
| 240 |
-
<hr>
|
| 241 |
-
Data and other attributes inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 242 |
-
<dl><dt><strong>__orig_bases__</strong> = (sqlalchemy.inspection.Inspectable[sqlalchemy.orm.state.InstanceState[typing.Any]],)</dl>
|
| 243 |
-
|
| 244 |
-
<hr>
|
| 245 |
-
Class methods inherited from <a href="typing.html#Generic">typing.Generic</a>:<br>
|
| 246 |
-
<dl><dt><a name="MLFeaturesEmployee-__class_getitem__"><strong>__class_getitem__</strong></a>(...)</dt><dd><span class="code">Parameterizes a generic class.<br>
|
| 247 |
-
<br>
|
| 248 |
-
At least, parameterizing a generic class is the *main* thing this<br>
|
| 249 |
-
method does. For example, for some generic class `Foo`, this is called<br>
|
| 250 |
-
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.<br>
|
| 251 |
-
<br>
|
| 252 |
-
However, note that this method is also called when defining generic<br>
|
| 253 |
-
classes in the first place with `class Foo[T]: ...`.</span></dd></dl>
|
| 254 |
-
|
| 255 |
-
</td></tr></table> <p>
|
| 256 |
-
<table class="section">
|
| 257 |
-
<tr class="decor title-decor heading-text">
|
| 258 |
-
<td class="section-title" colspan=3> <br><a name="Prediction">class <strong>Prediction</strong></a>(<a href="app.models.html#Base">Base</a>)</td></tr>
|
| 259 |
-
|
| 260 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 261 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#Prediction">Prediction</a>(**kwargs)<br>
|
| 262 |
-
<br>
|
| 263 |
-
# Les champs de la table app.predictions peuvent être ajustés en fonction des besoins,<br>
|
| 264 |
-
# mais les champs essentiels pour le suivi des prédictions sont request_id, predicted_proba, et created_at<br> </span></td></tr>
|
| 265 |
-
<tr><td> </td>
|
| 266 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 267 |
-
<dd><a href="app.models.html#Prediction">Prediction</a></dd>
|
| 268 |
-
<dd><a href="app.models.html#Base">Base</a></dd>
|
| 269 |
-
<dd><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a></dd>
|
| 270 |
-
<dd><a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a></dd>
|
| 271 |
-
<dd><a href="typing.html#Generic">typing.Generic</a></dd>
|
| 272 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 273 |
-
</dl>
|
| 274 |
-
<hr>
|
| 275 |
-
Methods defined here:<br>
|
| 276 |
-
<dl><dt><a name="Prediction-__init__"><strong>__init__</strong></a>(self, **kwargs)<span class="grey"><span class="heading-text"> from sqlalchemy.orm.instrumentation</span></span></dt><dd><span class="code">A simple constructor that allows initialization from kwargs.<br>
|
| 277 |
-
<br>
|
| 278 |
-
Sets attributes on the constructed instance using the names and<br>
|
| 279 |
-
values in ``kwargs``.<br>
|
| 280 |
-
<br>
|
| 281 |
-
Only keys that are present as<br>
|
| 282 |
-
attributes of the instance's class are allowed. These could be,<br>
|
| 283 |
-
for example, any mapped columns or relationships.</span></dd></dl>
|
| 284 |
-
|
| 285 |
-
<hr>
|
| 286 |
-
Data descriptors defined here:<br>
|
| 287 |
-
<dl><dt><strong>created_at</strong></dt>
|
| 288 |
-
</dl>
|
| 289 |
-
<dl><dt><strong>id</strong></dt>
|
| 290 |
-
</dl>
|
| 291 |
-
<dl><dt><strong>latency_ms</strong></dt>
|
| 292 |
-
</dl>
|
| 293 |
-
<dl><dt><strong>model_version</strong></dt>
|
| 294 |
-
</dl>
|
| 295 |
-
<dl><dt><strong>predicted_class</strong></dt>
|
| 296 |
-
</dl>
|
| 297 |
-
<dl><dt><strong>predicted_proba</strong></dt>
|
| 298 |
-
</dl>
|
| 299 |
-
<dl><dt><strong>request</strong></dt>
|
| 300 |
-
</dl>
|
| 301 |
-
<dl><dt><strong>request_id</strong></dt>
|
| 302 |
-
</dl>
|
| 303 |
-
<dl><dt><strong>threshold_used</strong></dt>
|
| 304 |
-
</dl>
|
| 305 |
-
<hr>
|
| 306 |
-
Data and other attributes defined here:<br>
|
| 307 |
-
<dl><dt><strong>__annotations__</strong> = {'created_at': 'Mapped[datetime]', 'id': 'Mapped[int]', 'latency_ms': 'Mapped[Optional[int]]', 'model_version': 'Mapped[str]', 'predicted_class': 'Mapped[int]', 'predicted_proba': 'Mapped[float]', 'request': "Mapped['PredictionRequest']", 'request_id': 'Mapped[int]', 'threshold_used': 'Mapped[float]'}</dl>
|
| 308 |
-
|
| 309 |
-
<dl><dt><strong>__mapper__</strong> = <Mapper at 0x28b5d077250; Prediction></dl>
|
| 310 |
-
|
| 311 |
-
<dl><dt><strong>__parameters__</strong> = ()</dl>
|
| 312 |
-
|
| 313 |
-
<dl><dt><strong>__table__</strong> = Table('predictions', MetaData(), Column('id', Bi...on utcnow at 0x0000028B5D0A0900>)), schema='app')</dl>
|
| 314 |
-
|
| 315 |
-
<dl><dt><strong>__table_args__</strong> = (Index('ix_predictions_request_id_created_at', Co...efault(<function utcnow at 0x0000028B5D0A0900>))), Index('ix_predictions_created_at', Column('creat...efault(<function utcnow at 0x0000028B5D0A0900>))), Index('ix_predictions_model_version', Column('mo...length=50), table=<predictions>, nullable=False)), {'schema': 'app'})</dl>
|
| 316 |
-
|
| 317 |
-
<dl><dt><strong>__tablename__</strong> = 'predictions'</dl>
|
| 318 |
-
|
| 319 |
-
<hr>
|
| 320 |
-
Data and other attributes inherited from <a href="app.models.html#Base">Base</a>:<br>
|
| 321 |
-
<dl><dt><strong>metadata</strong> = MetaData()</dl>
|
| 322 |
-
|
| 323 |
-
<dl><dt><strong>registry</strong> = <sqlalchemy.orm.decl_api.registry object></dl>
|
| 324 |
-
|
| 325 |
-
<hr>
|
| 326 |
-
Class methods inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 327 |
-
<dl><dt><a name="Prediction-__init_subclass__"><strong>__init_subclass__</strong></a>(**kw: 'Any') -> 'None'</dt><dd><span class="code">Function to initialize subclasses.</span></dd></dl>
|
| 328 |
-
|
| 329 |
-
<hr>
|
| 330 |
-
Data descriptors inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 331 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 332 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 333 |
-
</dl>
|
| 334 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 335 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 336 |
-
</dl>
|
| 337 |
-
<hr>
|
| 338 |
-
Data and other attributes inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 339 |
-
<dl><dt><strong>__orig_bases__</strong> = (sqlalchemy.inspection.Inspectable[sqlalchemy.orm.state.InstanceState[typing.Any]],)</dl>
|
| 340 |
-
|
| 341 |
-
<hr>
|
| 342 |
-
Class methods inherited from <a href="typing.html#Generic">typing.Generic</a>:<br>
|
| 343 |
-
<dl><dt><a name="Prediction-__class_getitem__"><strong>__class_getitem__</strong></a>(...)</dt><dd><span class="code">Parameterizes a generic class.<br>
|
| 344 |
-
<br>
|
| 345 |
-
At least, parameterizing a generic class is the *main* thing this<br>
|
| 346 |
-
method does. For example, for some generic class `Foo`, this is called<br>
|
| 347 |
-
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.<br>
|
| 348 |
-
<br>
|
| 349 |
-
However, note that this method is also called when defining generic<br>
|
| 350 |
-
classes in the first place with `class Foo[T]: ...`.</span></dd></dl>
|
| 351 |
-
|
| 352 |
-
</td></tr></table> <p>
|
| 353 |
-
<table class="section">
|
| 354 |
-
<tr class="decor title-decor heading-text">
|
| 355 |
-
<td class="section-title" colspan=3> <br><a name="PredictionRequest">class <strong>PredictionRequest</strong></a>(<a href="app.models.html#Base">Base</a>)</td></tr>
|
| 356 |
-
|
| 357 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 358 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#PredictionRequest">PredictionRequest</a>(**kwargs)<br>
|
| 359 |
-
<br>
|
| 360 |
-
# Les champs de la table app.prediction_requests peuvent être ajustés en fonction des besoins,<br>
|
| 361 |
-
# mais les champs essentiels pour le suivi des prédictions sont employee_id, payload_json, et created_at<br> </span></td></tr>
|
| 362 |
-
<tr><td> </td>
|
| 363 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 364 |
-
<dd><a href="app.models.html#PredictionRequest">PredictionRequest</a></dd>
|
| 365 |
-
<dd><a href="app.models.html#Base">Base</a></dd>
|
| 366 |
-
<dd><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a></dd>
|
| 367 |
-
<dd><a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a></dd>
|
| 368 |
-
<dd><a href="typing.html#Generic">typing.Generic</a></dd>
|
| 369 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 370 |
-
</dl>
|
| 371 |
-
<hr>
|
| 372 |
-
Methods defined here:<br>
|
| 373 |
-
<dl><dt><a name="PredictionRequest-__init__"><strong>__init__</strong></a>(self, **kwargs)<span class="grey"><span class="heading-text"> from sqlalchemy.orm.instrumentation</span></span></dt><dd><span class="code">A simple constructor that allows initialization from kwargs.<br>
|
| 374 |
-
<br>
|
| 375 |
-
Sets attributes on the constructed instance using the names and<br>
|
| 376 |
-
values in ``kwargs``.<br>
|
| 377 |
-
<br>
|
| 378 |
-
Only keys that are present as<br>
|
| 379 |
-
attributes of the instance's class are allowed. These could be,<br>
|
| 380 |
-
for example, any mapped columns or relationships.</span></dd></dl>
|
| 381 |
-
|
| 382 |
-
<hr>
|
| 383 |
-
Data descriptors defined here:<br>
|
| 384 |
-
<dl><dt><strong>created_at</strong></dt>
|
| 385 |
-
</dl>
|
| 386 |
-
<dl><dt><strong>employee</strong></dt>
|
| 387 |
-
</dl>
|
| 388 |
-
<dl><dt><strong>employee_id</strong></dt>
|
| 389 |
-
</dl>
|
| 390 |
-
<dl><dt><strong>id</strong></dt>
|
| 391 |
-
</dl>
|
| 392 |
-
<dl><dt><strong>payload_json</strong></dt>
|
| 393 |
-
</dl>
|
| 394 |
-
<dl><dt><strong>predictions</strong></dt>
|
| 395 |
-
</dl>
|
| 396 |
-
<dl><dt><strong>snapshot</strong></dt>
|
| 397 |
-
</dl>
|
| 398 |
-
<dl><dt><strong>snapshot_id</strong></dt>
|
| 399 |
-
</dl>
|
| 400 |
-
<dl><dt><strong>survey</strong></dt>
|
| 401 |
-
</dl>
|
| 402 |
-
<dl><dt><strong>survey_id</strong></dt>
|
| 403 |
-
</dl>
|
| 404 |
-
<hr>
|
| 405 |
-
Data and other attributes defined here:<br>
|
| 406 |
-
<dl><dt><strong>__annotations__</strong> = {'created_at': 'Mapped[datetime]', 'employee': "Mapped[Optional['RawEmployee']]", 'employee_id': 'Mapped[Optional[int]]', 'id': 'Mapped[int]', 'payload_json': 'Mapped[Dict[str, Any]]', 'predictions': "Mapped[list['Prediction']]", 'snapshot': "Mapped[Optional['RawEmployeeSnapshot']]", 'snapshot_id': 'Mapped[Optional[int]]', 'survey': "Mapped[Optional['RawSurvey']]", 'survey_id': 'Mapped[Optional[int]]'}</dl>
|
| 407 |
-
|
| 408 |
-
<dl><dt><strong>__mapper__</strong> = <Mapper at 0x28b5d076490; PredictionRequest></dl>
|
| 409 |
-
|
| 410 |
-
<dl><dt><strong>__parameters__</strong> = ()</dl>
|
| 411 |
-
|
| 412 |
-
<dl><dt><strong>__table__</strong> = Table('prediction_requests', MetaData(), Column(...on utcnow at 0x0000028B5D06B240>)), schema='app')</dl>
|
| 413 |
-
|
| 414 |
-
<dl><dt><strong>__table_args__</strong> = (Index('ix_prediction_requests_created_at', Colum...efault(<function utcnow at 0x0000028B5D06B240>))), {'schema': 'app'})</dl>
|
| 415 |
-
|
| 416 |
-
<dl><dt><strong>__tablename__</strong> = 'prediction_requests'</dl>
|
| 417 |
-
|
| 418 |
-
<hr>
|
| 419 |
-
Data and other attributes inherited from <a href="app.models.html#Base">Base</a>:<br>
|
| 420 |
-
<dl><dt><strong>metadata</strong> = MetaData()</dl>
|
| 421 |
-
|
| 422 |
-
<dl><dt><strong>registry</strong> = <sqlalchemy.orm.decl_api.registry object></dl>
|
| 423 |
-
|
| 424 |
-
<hr>
|
| 425 |
-
Class methods inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 426 |
-
<dl><dt><a name="PredictionRequest-__init_subclass__"><strong>__init_subclass__</strong></a>(**kw: 'Any') -> 'None'</dt><dd><span class="code">Function to initialize subclasses.</span></dd></dl>
|
| 427 |
-
|
| 428 |
-
<hr>
|
| 429 |
-
Data descriptors inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 430 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 431 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 432 |
-
</dl>
|
| 433 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 434 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 435 |
-
</dl>
|
| 436 |
-
<hr>
|
| 437 |
-
Data and other attributes inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 438 |
-
<dl><dt><strong>__orig_bases__</strong> = (sqlalchemy.inspection.Inspectable[sqlalchemy.orm.state.InstanceState[typing.Any]],)</dl>
|
| 439 |
-
|
| 440 |
-
<hr>
|
| 441 |
-
Class methods inherited from <a href="typing.html#Generic">typing.Generic</a>:<br>
|
| 442 |
-
<dl><dt><a name="PredictionRequest-__class_getitem__"><strong>__class_getitem__</strong></a>(...)</dt><dd><span class="code">Parameterizes a generic class.<br>
|
| 443 |
-
<br>
|
| 444 |
-
At least, parameterizing a generic class is the *main* thing this<br>
|
| 445 |
-
method does. For example, for some generic class `Foo`, this is called<br>
|
| 446 |
-
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.<br>
|
| 447 |
-
<br>
|
| 448 |
-
However, note that this method is also called when defining generic<br>
|
| 449 |
-
classes in the first place with `class Foo[T]: ...`.</span></dd></dl>
|
| 450 |
-
|
| 451 |
-
</td></tr></table> <p>
|
| 452 |
-
<table class="section">
|
| 453 |
-
<tr class="decor title-decor heading-text">
|
| 454 |
-
<td class="section-title" colspan=3> <br><a name="RawEmployee">class <strong>RawEmployee</strong></a>(<a href="app.models.html#Base">Base</a>)</td></tr>
|
| 455 |
-
|
| 456 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 457 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#RawEmployee">RawEmployee</a>(**kwargs)<br>
|
| 458 |
-
<br>
|
| 459 |
-
# Modèles SQLAlchemy représentant les tables de la base de données, organisés par schéma (raw, clean, app)<br> </span></td></tr>
|
| 460 |
-
<tr><td> </td>
|
| 461 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 462 |
-
<dd><a href="app.models.html#RawEmployee">RawEmployee</a></dd>
|
| 463 |
-
<dd><a href="app.models.html#Base">Base</a></dd>
|
| 464 |
-
<dd><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a></dd>
|
| 465 |
-
<dd><a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a></dd>
|
| 466 |
-
<dd><a href="typing.html#Generic">typing.Generic</a></dd>
|
| 467 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 468 |
-
</dl>
|
| 469 |
-
<hr>
|
| 470 |
-
Methods defined here:<br>
|
| 471 |
-
<dl><dt><a name="RawEmployee-__init__"><strong>__init__</strong></a>(self, **kwargs)<span class="grey"><span class="heading-text"> from sqlalchemy.orm.instrumentation</span></span></dt><dd><span class="code">A simple constructor that allows initialization from kwargs.<br>
|
| 472 |
-
<br>
|
| 473 |
-
Sets attributes on the constructed instance using the names and<br>
|
| 474 |
-
values in ``kwargs``.<br>
|
| 475 |
-
<br>
|
| 476 |
-
Only keys that are present as<br>
|
| 477 |
-
attributes of the instance's class are allowed. These could be,<br>
|
| 478 |
-
for example, any mapped columns or relationships.</span></dd></dl>
|
| 479 |
-
|
| 480 |
-
<hr>
|
| 481 |
-
Data descriptors defined here:<br>
|
| 482 |
-
<dl><dt><strong>employee_external_id</strong></dt>
|
| 483 |
-
</dl>
|
| 484 |
-
<dl><dt><strong>id</strong></dt>
|
| 485 |
-
</dl>
|
| 486 |
-
<hr>
|
| 487 |
-
Data and other attributes defined here:<br>
|
| 488 |
-
<dl><dt><strong>__annotations__</strong> = {'employee_external_id': 'Mapped[int]', 'id': 'Mapped[int]'}</dl>
|
| 489 |
-
|
| 490 |
-
<dl><dt><strong>__mapper__</strong> = <Mapper at 0x28b5cf4f230; RawEmployee></dl>
|
| 491 |
-
|
| 492 |
-
<dl><dt><strong>__parameters__</strong> = ()</dl>
|
| 493 |
-
|
| 494 |
-
<dl><dt><strong>__table__</strong> = Table('employees', MetaData(), Column('id', BigI...table=<employees>, nullable=False), schema='raw')</dl>
|
| 495 |
-
|
| 496 |
-
<dl><dt><strong>__table_args__</strong> = (Index('ix_raw_employees_employee_external_id', C...', Integer(), table=<employees>, nullable=False)), {'schema': 'raw'})</dl>
|
| 497 |
-
|
| 498 |
-
<dl><dt><strong>__tablename__</strong> = 'employees'</dl>
|
| 499 |
-
|
| 500 |
-
<hr>
|
| 501 |
-
Data and other attributes inherited from <a href="app.models.html#Base">Base</a>:<br>
|
| 502 |
-
<dl><dt><strong>metadata</strong> = MetaData()</dl>
|
| 503 |
-
|
| 504 |
-
<dl><dt><strong>registry</strong> = <sqlalchemy.orm.decl_api.registry object></dl>
|
| 505 |
-
|
| 506 |
-
<hr>
|
| 507 |
-
Class methods inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 508 |
-
<dl><dt><a name="RawEmployee-__init_subclass__"><strong>__init_subclass__</strong></a>(**kw: 'Any') -> 'None'</dt><dd><span class="code">Function to initialize subclasses.</span></dd></dl>
|
| 509 |
-
|
| 510 |
-
<hr>
|
| 511 |
-
Data descriptors inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 512 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 513 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 514 |
-
</dl>
|
| 515 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 516 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 517 |
-
</dl>
|
| 518 |
-
<hr>
|
| 519 |
-
Data and other attributes inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 520 |
-
<dl><dt><strong>__orig_bases__</strong> = (sqlalchemy.inspection.Inspectable[sqlalchemy.orm.state.InstanceState[typing.Any]],)</dl>
|
| 521 |
-
|
| 522 |
-
<hr>
|
| 523 |
-
Class methods inherited from <a href="typing.html#Generic">typing.Generic</a>:<br>
|
| 524 |
-
<dl><dt><a name="RawEmployee-__class_getitem__"><strong>__class_getitem__</strong></a>(...)</dt><dd><span class="code">Parameterizes a generic class.<br>
|
| 525 |
-
<br>
|
| 526 |
-
At least, parameterizing a generic class is the *main* thing this<br>
|
| 527 |
-
method does. For example, for some generic class `Foo`, this is called<br>
|
| 528 |
-
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.<br>
|
| 529 |
-
<br>
|
| 530 |
-
However, note that this method is also called when defining generic<br>
|
| 531 |
-
classes in the first place with `class Foo[T]: ...`.</span></dd></dl>
|
| 532 |
-
|
| 533 |
-
</td></tr></table> <p>
|
| 534 |
-
<table class="section">
|
| 535 |
-
<tr class="decor title-decor heading-text">
|
| 536 |
-
<td class="section-title" colspan=3> <br><a name="RawEmployeeSnapshot">class <strong>RawEmployeeSnapshot</strong></a>(<a href="app.models.html#Base">Base</a>)</td></tr>
|
| 537 |
-
|
| 538 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 539 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#RawEmployeeSnapshot">RawEmployeeSnapshot</a>(**kwargs)<br>
|
| 540 |
-
<br>
|
| 541 |
-
# Les autres champs de la table raw.employees peuvent être ajoutés ici si nécessaire,<br>
|
| 542 |
-
# mais ne sont pas indispensables pour les prédictions basées sur employee_id<br> </span></td></tr>
|
| 543 |
-
<tr><td> </td>
|
| 544 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 545 |
-
<dd><a href="app.models.html#RawEmployeeSnapshot">RawEmployeeSnapshot</a></dd>
|
| 546 |
-
<dd><a href="app.models.html#Base">Base</a></dd>
|
| 547 |
-
<dd><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a></dd>
|
| 548 |
-
<dd><a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a></dd>
|
| 549 |
-
<dd><a href="typing.html#Generic">typing.Generic</a></dd>
|
| 550 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 551 |
-
</dl>
|
| 552 |
-
<hr>
|
| 553 |
-
Methods defined here:<br>
|
| 554 |
-
<dl><dt><a name="RawEmployeeSnapshot-__init__"><strong>__init__</strong></a>(self, **kwargs)<span class="grey"><span class="heading-text"> from sqlalchemy.orm.instrumentation</span></span></dt><dd><span class="code">A simple constructor that allows initialization from kwargs.<br>
|
| 555 |
-
<br>
|
| 556 |
-
Sets attributes on the constructed instance using the names and<br>
|
| 557 |
-
values in ``kwargs``.<br>
|
| 558 |
-
<br>
|
| 559 |
-
Only keys that are present as<br>
|
| 560 |
-
attributes of the instance's class are allowed. These could be,<br>
|
| 561 |
-
for example, any mapped columns or relationships.</span></dd></dl>
|
| 562 |
-
|
| 563 |
-
<hr>
|
| 564 |
-
Data descriptors defined here:<br>
|
| 565 |
-
<dl><dt><strong>id</strong></dt>
|
| 566 |
-
</dl>
|
| 567 |
-
<hr>
|
| 568 |
-
Data and other attributes defined here:<br>
|
| 569 |
-
<dl><dt><strong>__annotations__</strong> = {'id': 'Mapped[int]'}</dl>
|
| 570 |
-
|
| 571 |
-
<dl><dt><strong>__mapper__</strong> = <Mapper at 0x28b5cfdd310; RawEmployeeSnapshot></dl>
|
| 572 |
-
|
| 573 |
-
<dl><dt><strong>__parameters__</strong> = ()</dl>
|
| 574 |
-
|
| 575 |
-
<dl><dt><strong>__table__</strong> = Table('employee_snapshots', MetaData(), Column('... primary_key=True, nullable=False), schema='raw')</dl>
|
| 576 |
-
|
| 577 |
-
<dl><dt><strong>__table_args__</strong> = ({'schema': 'raw'},)</dl>
|
| 578 |
-
|
| 579 |
-
<dl><dt><strong>__tablename__</strong> = 'employee_snapshots'</dl>
|
| 580 |
-
|
| 581 |
-
<hr>
|
| 582 |
-
Data and other attributes inherited from <a href="app.models.html#Base">Base</a>:<br>
|
| 583 |
-
<dl><dt><strong>metadata</strong> = MetaData()</dl>
|
| 584 |
-
|
| 585 |
-
<dl><dt><strong>registry</strong> = <sqlalchemy.orm.decl_api.registry object></dl>
|
| 586 |
-
|
| 587 |
-
<hr>
|
| 588 |
-
Class methods inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 589 |
-
<dl><dt><a name="RawEmployeeSnapshot-__init_subclass__"><strong>__init_subclass__</strong></a>(**kw: 'Any') -> 'None'</dt><dd><span class="code">Function to initialize subclasses.</span></dd></dl>
|
| 590 |
-
|
| 591 |
-
<hr>
|
| 592 |
-
Data descriptors inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 593 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 594 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 595 |
-
</dl>
|
| 596 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 597 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 598 |
-
</dl>
|
| 599 |
-
<hr>
|
| 600 |
-
Data and other attributes inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 601 |
-
<dl><dt><strong>__orig_bases__</strong> = (sqlalchemy.inspection.Inspectable[sqlalchemy.orm.state.InstanceState[typing.Any]],)</dl>
|
| 602 |
-
|
| 603 |
-
<hr>
|
| 604 |
-
Class methods inherited from <a href="typing.html#Generic">typing.Generic</a>:<br>
|
| 605 |
-
<dl><dt><a name="RawEmployeeSnapshot-__class_getitem__"><strong>__class_getitem__</strong></a>(...)</dt><dd><span class="code">Parameterizes a generic class.<br>
|
| 606 |
-
<br>
|
| 607 |
-
At least, parameterizing a generic class is the *main* thing this<br>
|
| 608 |
-
method does. For example, for some generic class `Foo`, this is called<br>
|
| 609 |
-
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.<br>
|
| 610 |
-
<br>
|
| 611 |
-
However, note that this method is also called when defining generic<br>
|
| 612 |
-
classes in the first place with `class Foo[T]: ...`.</span></dd></dl>
|
| 613 |
-
|
| 614 |
-
</td></tr></table> <p>
|
| 615 |
-
<table class="section">
|
| 616 |
-
<tr class="decor title-decor heading-text">
|
| 617 |
-
<td class="section-title" colspan=3> <br><a name="RawSurvey">class <strong>RawSurvey</strong></a>(<a href="app.models.html#Base">Base</a>)</td></tr>
|
| 618 |
-
|
| 619 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 620 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#RawSurvey">RawSurvey</a>(**kwargs)<br>
|
| 621 |
-
<br>
|
| 622 |
-
# Les champs de la table raw.employee_snapshots peuvent être ajoutés ici si nécessaire,<br>
|
| 623 |
-
# mais ne sont pas indispensables pour les prédictions basées sur employee_id<br> </span></td></tr>
|
| 624 |
-
<tr><td> </td>
|
| 625 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 626 |
-
<dd><a href="app.models.html#RawSurvey">RawSurvey</a></dd>
|
| 627 |
-
<dd><a href="app.models.html#Base">Base</a></dd>
|
| 628 |
-
<dd><a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a></dd>
|
| 629 |
-
<dd><a href="sqlalchemy.inspection.html#Inspectable">sqlalchemy.inspection.Inspectable</a></dd>
|
| 630 |
-
<dd><a href="typing.html#Generic">typing.Generic</a></dd>
|
| 631 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 632 |
-
</dl>
|
| 633 |
-
<hr>
|
| 634 |
-
Methods defined here:<br>
|
| 635 |
-
<dl><dt><a name="RawSurvey-__init__"><strong>__init__</strong></a>(self, **kwargs)<span class="grey"><span class="heading-text"> from sqlalchemy.orm.instrumentation</span></span></dt><dd><span class="code">A simple constructor that allows initialization from kwargs.<br>
|
| 636 |
-
<br>
|
| 637 |
-
Sets attributes on the constructed instance using the names and<br>
|
| 638 |
-
values in ``kwargs``.<br>
|
| 639 |
-
<br>
|
| 640 |
-
Only keys that are present as<br>
|
| 641 |
-
attributes of the instance's class are allowed. These could be,<br>
|
| 642 |
-
for example, any mapped columns or relationships.</span></dd></dl>
|
| 643 |
-
|
| 644 |
-
<hr>
|
| 645 |
-
Data descriptors defined here:<br>
|
| 646 |
-
<dl><dt><strong>id</strong></dt>
|
| 647 |
-
</dl>
|
| 648 |
-
<hr>
|
| 649 |
-
Data and other attributes defined here:<br>
|
| 650 |
-
<dl><dt><strong>__annotations__</strong> = {'id': 'Mapped[int]'}</dl>
|
| 651 |
-
|
| 652 |
-
<dl><dt><strong>__mapper__</strong> = <Mapper at 0x28b5cfdda90; RawSurvey></dl>
|
| 653 |
-
|
| 654 |
-
<dl><dt><strong>__parameters__</strong> = ()</dl>
|
| 655 |
-
|
| 656 |
-
<dl><dt><strong>__table__</strong> = Table('surveys', MetaData(), Column('id', BigInt... primary_key=True, nullable=False), schema='raw')</dl>
|
| 657 |
-
|
| 658 |
-
<dl><dt><strong>__table_args__</strong> = ({'schema': 'raw'},)</dl>
|
| 659 |
-
|
| 660 |
-
<dl><dt><strong>__tablename__</strong> = 'surveys'</dl>
|
| 661 |
-
|
| 662 |
-
<hr>
|
| 663 |
-
Data and other attributes inherited from <a href="app.models.html#Base">Base</a>:<br>
|
| 664 |
-
<dl><dt><strong>metadata</strong> = MetaData()</dl>
|
| 665 |
-
|
| 666 |
-
<dl><dt><strong>registry</strong> = <sqlalchemy.orm.decl_api.registry object></dl>
|
| 667 |
-
|
| 668 |
-
<hr>
|
| 669 |
-
Class methods inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 670 |
-
<dl><dt><a name="RawSurvey-__init_subclass__"><strong>__init_subclass__</strong></a>(**kw: 'Any') -> 'None'</dt><dd><span class="code">Function to initialize subclasses.</span></dd></dl>
|
| 671 |
-
|
| 672 |
-
<hr>
|
| 673 |
-
Data descriptors inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 674 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 675 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 676 |
-
</dl>
|
| 677 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 678 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 679 |
-
</dl>
|
| 680 |
-
<hr>
|
| 681 |
-
Data and other attributes inherited from <a href="sqlalchemy.orm.decl_api.html#DeclarativeBase">sqlalchemy.orm.decl_api.DeclarativeBase</a>:<br>
|
| 682 |
-
<dl><dt><strong>__orig_bases__</strong> = (sqlalchemy.inspection.Inspectable[sqlalchemy.orm.state.InstanceState[typing.Any]],)</dl>
|
| 683 |
-
|
| 684 |
-
<hr>
|
| 685 |
-
Class methods inherited from <a href="typing.html#Generic">typing.Generic</a>:<br>
|
| 686 |
-
<dl><dt><a name="RawSurvey-__class_getitem__"><strong>__class_getitem__</strong></a>(...)</dt><dd><span class="code">Parameterizes a generic class.<br>
|
| 687 |
-
<br>
|
| 688 |
-
At least, parameterizing a generic class is the *main* thing this<br>
|
| 689 |
-
method does. For example, for some generic class `Foo`, this is called<br>
|
| 690 |
-
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.<br>
|
| 691 |
-
<br>
|
| 692 |
-
However, note that this method is also called when defining generic<br>
|
| 693 |
-
classes in the first place with `class Foo[T]: ...`.</span></dd></dl>
|
| 694 |
-
|
| 695 |
-
</td></tr></table></td></tr></table><p>
|
| 696 |
-
<table class="section">
|
| 697 |
-
<tr class="decor functions-decor heading-text">
|
| 698 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Functions</strong></td></tr>
|
| 699 |
-
|
| 700 |
-
<tr><td class="decor functions-decor"><span class="code"> </span></td><td> </td>
|
| 701 |
-
<td class="singlecolumn"><dl><dt><a name="-utcnow"><strong>utcnow</strong></a>() -> 'datetime'</dt><dd><span class="code"># Fonction utilitaire pour obtenir l'heure actuelle en UTC, utilisée comme valeur par défaut pour les champs created_at</span></dd></dl>
|
| 702 |
-
</td></tr></table><p>
|
| 703 |
-
<table class="section">
|
| 704 |
-
<tr class="decor data-decor heading-text">
|
| 705 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Data</strong></td></tr>
|
| 706 |
-
|
| 707 |
-
<tr><td class="decor data-decor"><span class="code"> </span></td><td> </td>
|
| 708 |
-
<td class="singlecolumn"><strong>Dict</strong> = typing.Dict<br>
|
| 709 |
-
<strong>ID_FK</strong> = BigInteger()<br>
|
| 710 |
-
<strong>ID_PK</strong> = BigInteger()<br>
|
| 711 |
-
<strong>Optional</strong> = typing.Optional</td></tr></table>
|
| 712 |
-
</body></html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/domain.domain.html
DELETED
|
@@ -1,1225 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="utf-8">
|
| 5 |
-
<title>Python: module domain.domain</title>
|
| 6 |
-
</head><body>
|
| 7 |
-
|
| 8 |
-
<table class="heading">
|
| 9 |
-
<tr class="heading-text decor">
|
| 10 |
-
<td class="title"> <br><strong class="title"><a href="domain.html" class="white">domain</a>.domain</strong></td>
|
| 11 |
-
<td class="extra"><a href=".">index</a><br><a href="file:c%3A%5Cusers%5Cgonza%5Copenclassroom%5Cprojet_4_classification%5Cprojet_technova_partners%5Cdomain%5Cdomain.py">c:\users\gonza\openclassroom\projet_4_classification\projet_technova_partners\domain\domain.py</a></td></tr></table>
|
| 12 |
-
<p></p>
|
| 13 |
-
<p>
|
| 14 |
-
<table class="section">
|
| 15 |
-
<tr class="decor index-decor heading-text">
|
| 16 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Classes</strong></td></tr>
|
| 17 |
-
|
| 18 |
-
<tr><td class="decor index-decor"><span class="code"> </span></td><td> </td>
|
| 19 |
-
<td class="singlecolumn"><dl>
|
| 20 |
-
<dt class="heading-text"><a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>(<a href="builtins.html#object">builtins.object</a>)
|
| 21 |
-
</dt><dd>
|
| 22 |
-
<dl>
|
| 23 |
-
<dt class="heading-text"><a href="domain.domain.html#ModelRequest">ModelRequest</a>
|
| 24 |
-
</dt><dt class="heading-text"><a href="domain.domain.html#ModelResponse">ModelResponse</a>
|
| 25 |
-
</dt></dl>
|
| 26 |
-
</dd>
|
| 27 |
-
</dl>
|
| 28 |
-
<p>
|
| 29 |
-
<table class="section">
|
| 30 |
-
<tr class="decor title-decor heading-text">
|
| 31 |
-
<td class="section-title" colspan=3> <br><a name="ModelRequest">class <strong>ModelRequest</strong></a>(<a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>)</td></tr>
|
| 32 |
-
|
| 33 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 34 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#ModelRequest">ModelRequest</a>(<br>
|
| 35 |
-
*,<br>
|
| 36 |
-
note_evaluation_precedente: int,<br>
|
| 37 |
-
niveau_hierarchique_poste: int,<br>
|
| 38 |
-
note_evaluation_actuelle: int,<br>
|
| 39 |
-
heures_supplementaires: Literal[0, 1],<br>
|
| 40 |
-
augmentation_salaire_precedente: float,<br>
|
| 41 |
-
age: int,<br>
|
| 42 |
-
genre: Literal[0, 1],<br>
|
| 43 |
-
revenu_mensuel: int,<br>
|
| 44 |
-
statut_marital: str,<br>
|
| 45 |
-
departement: str,<br>
|
| 46 |
-
poste: str,<br>
|
| 47 |
-
nombre_experiences_precedentes: int,<br>
|
| 48 |
-
annee_experience_totale: int,<br>
|
| 49 |
-
annees_dans_l_entreprise: int,<br>
|
| 50 |
-
annees_dans_le_poste_actuel: int,<br>
|
| 51 |
-
nombre_participation_pee: int,<br>
|
| 52 |
-
nb_formations_suivies: int,<br>
|
| 53 |
-
distance_domicile_travail: int,<br>
|
| 54 |
-
niveau_education: int,<br>
|
| 55 |
-
domaine_etude: str,<br>
|
| 56 |
-
frequence_deplacement: Literal[0, 1, 2, 3],<br>
|
| 57 |
-
annees_depuis_la_derniere_promotion: int,<br>
|
| 58 |
-
annees_sous_responsable_actuel: int,<br>
|
| 59 |
-
satisfaction_moyenne: float,<br>
|
| 60 |
-
nonlineaire_participation_pee: float,<br>
|
| 61 |
-
ratio_heures_sup_salaire: float,<br>
|
| 62 |
-
nonlinaire_charge_contrainte: float,<br>
|
| 63 |
-
nonlinaire_surmenage_insatisfaction: float,<br>
|
| 64 |
-
jeune_surcharge: Literal[0, 1],<br>
|
| 65 |
-
anciennete_sans_promotion: float,<br>
|
| 66 |
-
mobilite_carriere: float,<br>
|
| 67 |
-
risque_global: float<br>
|
| 68 |
-
) -&gt; None<br>
|
| 69 |
-
<br>
|
| 70 |
-
# Modèles de données pour les requêtes et réponses de l'API, utilisés pour la validation des données d'entrée et de sortie.<br> </span></td></tr>
|
| 71 |
-
<tr><td> </td>
|
| 72 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 73 |
-
<dd><a href="domain.domain.html#ModelRequest">ModelRequest</a></dd>
|
| 74 |
-
<dd><a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a></dd>
|
| 75 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 76 |
-
</dl>
|
| 77 |
-
<hr>
|
| 78 |
-
Data descriptors defined here:<br>
|
| 79 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 80 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 81 |
-
</dl>
|
| 82 |
-
<hr>
|
| 83 |
-
Data and other attributes defined here:<br>
|
| 84 |
-
<dl><dt><strong>__abstractmethods__</strong> = frozenset()</dl>
|
| 85 |
-
|
| 86 |
-
<dl><dt><strong>__annotations__</strong> = {'age': 'int', 'anciennete_sans_promotion': 'float', 'annee_experience_totale': 'int', 'annees_dans_l_entreprise': 'int', 'annees_dans_le_poste_actuel': 'int', 'annees_depuis_la_derniere_promotion': 'int', 'annees_sous_responsable_actuel': 'int', 'augmentation_salaire_precedente': 'float', 'departement': 'str', 'distance_domicile_travail': 'int', ...}</dl>
|
| 87 |
-
|
| 88 |
-
<dl><dt><strong>__class_vars__</strong> = set()</dl>
|
| 89 |
-
|
| 90 |
-
<dl><dt><strong>__private_attributes__</strong> = {}</dl>
|
| 91 |
-
|
| 92 |
-
<dl><dt><strong>__pydantic_complete__</strong> = True</dl>
|
| 93 |
-
|
| 94 |
-
<dl><dt><strong>__pydantic_computed_fields__</strong> = {}</dl>
|
| 95 |
-
|
| 96 |
-
<dl><dt><strong>__pydantic_core_schema__</strong> = {'cls': <class 'domain.domain.ModelRequest'>, 'config': {'title': 'ModelRequest'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'domain.domain.ModelRequest'>>]}, 'ref': 'domain.domain.ModelRequest:2430587751824', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'age': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'anciennete_sans_promotion': {'metadata': {}, 'schema': {'type': 'float'}, 'type': 'model-field'}, 'annee_experience_totale': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'annees_dans_l_entreprise': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'annees_dans_le_poste_actuel': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'annees_depuis_la_derniere_promotion': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'annees_sous_responsable_actuel': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'augmentation_salaire_precedente': {'metadata': {}, 'schema': {'type': 'float'}, 'type': 'model-field'}, 'departement': {'metadata': {}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'distance_domicile_travail': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, ...}, 'model_name': 'ModelRequest', 'type': 'model-fields'}, 'type': 'model'}</dl>
|
| 97 |
-
|
| 98 |
-
<dl><dt><strong>__pydantic_custom_init__</strong> = False</dl>
|
| 99 |
-
|
| 100 |
-
<dl><dt><strong>__pydantic_decorators__</strong> = DecoratorInfos(validators={}, field_validators={...zers={}, model_validators={}, computed_fields={})</dl>
|
| 101 |
-
|
| 102 |
-
<dl><dt><strong>__pydantic_fields__</strong> = {'age': FieldInfo(annotation=int, required=True), 'anciennete_sans_promotion': FieldInfo(annotation=float, required=True), 'annee_experience_totale': FieldInfo(annotation=int, required=True), 'annees_dans_l_entreprise': FieldInfo(annotation=int, required=True), 'annees_dans_le_poste_actuel': FieldInfo(annotation=int, required=True), 'annees_depuis_la_derniere_promotion': FieldInfo(annotation=int, required=True), 'annees_sous_responsable_actuel': FieldInfo(annotation=int, required=True), 'augmentation_salaire_precedente': FieldInfo(annotation=float, required=True), 'departement': FieldInfo(annotation=str, required=True), 'distance_domicile_travail': FieldInfo(annotation=int, required=True), ...}</dl>
|
| 103 |
-
|
| 104 |
-
<dl><dt><strong>__pydantic_generic_metadata__</strong> = {'args': (), 'origin': None, 'parameters': ()}</dl>
|
| 105 |
-
|
| 106 |
-
<dl><dt><strong>__pydantic_parent_namespace__</strong> = None</dl>
|
| 107 |
-
|
| 108 |
-
<dl><dt><strong>__pydantic_post_init__</strong> = None</dl>
|
| 109 |
-
|
| 110 |
-
<dl><dt><strong>__pydantic_serializer__</strong> = SchemaSerializer(serializer=Model(
|
| 111 |
-
ModelSeri... name: "ModelRequest",
|
| 112 |
-
},
|
| 113 |
-
), definitions=[])</dl>
|
| 114 |
-
|
| 115 |
-
<dl><dt><strong>__pydantic_setattr_handlers__</strong> = {}</dl>
|
| 116 |
-
|
| 117 |
-
<dl><dt><strong>__pydantic_validator__</strong> = SchemaValidator(title="ModelRequest", validator=...t",
|
| 118 |
-
},
|
| 119 |
-
), definitions=[], cache_strings=True)</dl>
|
| 120 |
-
|
| 121 |
-
<dl><dt><strong>__signature__</strong> = <Signature (*, note_evaluation_precedente: int, ...e_carriere: float, risque_global: float) -> None></dl>
|
| 122 |
-
|
| 123 |
-
<dl><dt><strong>model_config</strong> = {}</dl>
|
| 124 |
-
|
| 125 |
-
<hr>
|
| 126 |
-
Methods inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 127 |
-
<dl><dt><a name="ModelRequest-__copy__"><strong>__copy__</strong></a>(self) -> 'Self'</dt><dd><span class="code">Returns a shallow copy of the model.</span></dd></dl>
|
| 128 |
-
|
| 129 |
-
<dl><dt><a name="ModelRequest-__deepcopy__"><strong>__deepcopy__</strong></a>(self, memo: 'dict[int, Any] | None' = None) -> 'Self'</dt><dd><span class="code">Returns a deep copy of the model.</span></dd></dl>
|
| 130 |
-
|
| 131 |
-
<dl><dt><a name="ModelRequest-__delattr__"><strong>__delattr__</strong></a>(self, item: 'str') -> 'Any'</dt><dd><span class="code">Implement delattr(self, name).</span></dd></dl>
|
| 132 |
-
|
| 133 |
-
<dl><dt><a name="ModelRequest-__eq__"><strong>__eq__</strong></a>(self, other: 'Any') -> 'bool'</dt><dd><span class="code">Return self==value.</span></dd></dl>
|
| 134 |
-
|
| 135 |
-
<dl><dt><a name="ModelRequest-__getattr__"><strong>__getattr__</strong></a>(self, item: 'str') -> 'Any'</dt></dl>
|
| 136 |
-
|
| 137 |
-
<dl><dt><a name="ModelRequest-__getstate__"><strong>__getstate__</strong></a>(self) -> 'dict[Any, Any]'</dt><dd><span class="code">Helper for pickle.</span></dd></dl>
|
| 138 |
-
|
| 139 |
-
<dl><dt><a name="ModelRequest-__init__"><strong>__init__</strong></a>(self, /, **data: 'Any') -> 'None'</dt><dd><span class="code">Create a new model by parsing and validating input data from keyword arguments.<br>
|
| 140 |
-
<br>
|
| 141 |
-
Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be<br>
|
| 142 |
-
validated to form a valid model.<br>
|
| 143 |
-
<br>
|
| 144 |
-
`self` is explicitly positional-only to allow `self` as a field name.</span></dd></dl>
|
| 145 |
-
|
| 146 |
-
<dl><dt><a name="ModelRequest-__iter__"><strong>__iter__</strong></a>(self) -> 'TupleGenerator'</dt><dd><span class="code">So `<a href="#ModelRequest-dict">dict</a>(model)` works.</span></dd></dl>
|
| 147 |
-
|
| 148 |
-
<dl><dt><a name="ModelRequest-__pretty__"><strong>__pretty__</strong></a>(self, fmt: 'Callable[[Any], Any]', **kwargs: 'Any') -> 'Generator[Any]'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Used by devtools (<a href="https://python-devtools.helpmanual.io/">https://python-devtools.helpmanual.io/</a>) to pretty print objects.</span></dd></dl>
|
| 149 |
-
|
| 150 |
-
<dl><dt><a name="ModelRequest-__replace__"><strong>__replace__</strong></a>(self, **changes: 'Any') -> 'Self'</dt><dd><span class="code"># Because we make use of `@dataclass_transform()`, `__replace__` is already synthesized by<br>
|
| 151 |
-
# type checkers, so we define the implementation in this `if not TYPE_CHECKING:` block:</span></dd></dl>
|
| 152 |
-
|
| 153 |
-
<dl><dt><a name="ModelRequest-__repr__"><strong>__repr__</strong></a>(self) -> 'str'</dt><dd><span class="code">Return repr(self).</span></dd></dl>
|
| 154 |
-
|
| 155 |
-
<dl><dt><a name="ModelRequest-__repr_args__"><strong>__repr_args__</strong></a>(self) -> '_repr.ReprArgs'</dt></dl>
|
| 156 |
-
|
| 157 |
-
<dl><dt><a name="ModelRequest-__repr_name__"><strong>__repr_name__</strong></a>(self) -> 'str'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Name of the instance's class, used in __repr__.</span></dd></dl>
|
| 158 |
-
|
| 159 |
-
<dl><dt><a name="ModelRequest-__repr_recursion__"><strong>__repr_recursion__</strong></a>(self, object: 'Any') -> 'str'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Returns the string representation of a recursive object.</span></dd></dl>
|
| 160 |
-
|
| 161 |
-
<dl><dt><a name="ModelRequest-__repr_str__"><strong>__repr_str__</strong></a>(self, join_str: 'str') -> 'str'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt></dl>
|
| 162 |
-
|
| 163 |
-
<dl><dt><a name="ModelRequest-__rich_repr__"><strong>__rich_repr__</strong></a>(self) -> 'RichReprResult'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Used by Rich (<a href="https://rich.readthedocs.io/en/stable/pretty.html">https://rich.readthedocs.io/en/stable/pretty.html</a>) to pretty print objects.</span></dd></dl>
|
| 164 |
-
|
| 165 |
-
<dl><dt><a name="ModelRequest-__setattr__"><strong>__setattr__</strong></a>(self, name: 'str', value: 'Any') -> 'None'</dt><dd><span class="code">Implement setattr(self, name, value).</span></dd></dl>
|
| 166 |
-
|
| 167 |
-
<dl><dt><a name="ModelRequest-__setstate__"><strong>__setstate__</strong></a>(self, state: 'dict[Any, Any]') -> 'None'</dt></dl>
|
| 168 |
-
|
| 169 |
-
<dl><dt><a name="ModelRequest-__str__"><strong>__str__</strong></a>(self) -> 'str'</dt><dd><span class="code">Return str(self).</span></dd></dl>
|
| 170 |
-
|
| 171 |
-
<dl><dt><a name="ModelRequest-copy"><strong>copy</strong></a>(
|
| 172 |
-
self,
|
| 173 |
-
*,
|
| 174 |
-
include: 'AbstractSetIntStr | MappingIntStrAny | None' = None,
|
| 175 |
-
exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None,
|
| 176 |
-
update: 'Dict[str, Any] | None' = None,
|
| 177 |
-
deep: 'bool' = False
|
| 178 |
-
) -> 'Self'</dt><dd><span class="code">Returns a copy of the model.<br>
|
| 179 |
-
<br>
|
| 180 |
-
!!! warning "Deprecated"<br>
|
| 181 |
-
This method is now deprecated; use `model_copy` instead.<br>
|
| 182 |
-
<br>
|
| 183 |
-
If you need `include` or `exclude`, use:<br>
|
| 184 |
-
<br>
|
| 185 |
-
```python {test="skip" lint="skip"}<br>
|
| 186 |
-
data = self.<a href="#ModelRequest-model_dump">model_dump</a>(include=include, exclude=exclude, round_trip=True)<br>
|
| 187 |
-
data = {**data, **(update or {})}<br>
|
| 188 |
-
copied = self.<a href="#ModelRequest-model_validate">model_validate</a>(data)<br>
|
| 189 |
-
```<br>
|
| 190 |
-
<br>
|
| 191 |
-
Args:<br>
|
| 192 |
-
include: Optional set or mapping specifying which fields to include in the copied model.<br>
|
| 193 |
-
exclude: Optional set or mapping specifying which fields to exclude in the copied model.<br>
|
| 194 |
-
update: Optional dictionary of field-value pairs to override field values in the copied model.<br>
|
| 195 |
-
deep: If True, the values of fields that are Pydantic models will be deep-copied.<br>
|
| 196 |
-
<br>
|
| 197 |
-
Returns:<br>
|
| 198 |
-
A copy of the model with included, excluded and updated fields as specified.</span></dd></dl>
|
| 199 |
-
|
| 200 |
-
<dl><dt><a name="ModelRequest-dict"><strong>dict</strong></a>(
|
| 201 |
-
self,
|
| 202 |
-
*,
|
| 203 |
-
include: 'IncEx | None' = None,
|
| 204 |
-
exclude: 'IncEx | None' = None,
|
| 205 |
-
by_alias: 'bool' = False,
|
| 206 |
-
exclude_unset: 'bool' = False,
|
| 207 |
-
exclude_defaults: 'bool' = False,
|
| 208 |
-
exclude_none: 'bool' = False
|
| 209 |
-
) -> 'Dict[str, Any]'</dt></dl>
|
| 210 |
-
|
| 211 |
-
<dl><dt><a name="ModelRequest-json"><strong>json</strong></a>(
|
| 212 |
-
self,
|
| 213 |
-
*,
|
| 214 |
-
include: 'IncEx | None' = None,
|
| 215 |
-
exclude: 'IncEx | None' = None,
|
| 216 |
-
by_alias: 'bool' = False,
|
| 217 |
-
exclude_unset: 'bool' = False,
|
| 218 |
-
exclude_defaults: 'bool' = False,
|
| 219 |
-
exclude_none: 'bool' = False,
|
| 220 |
-
encoder: 'Callable[[Any], Any] | None' = PydanticUndefined,
|
| 221 |
-
models_as_dict: 'bool' = PydanticUndefined,
|
| 222 |
-
**dumps_kwargs: 'Any'
|
| 223 |
-
) -> 'str'</dt></dl>
|
| 224 |
-
|
| 225 |
-
<dl><dt><a name="ModelRequest-model_copy"><strong>model_copy</strong></a>(
|
| 226 |
-
self,
|
| 227 |
-
*,
|
| 228 |
-
update: 'Mapping[str, Any] | None' = None,
|
| 229 |
-
deep: 'bool' = False
|
| 230 |
-
) -> 'Self'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 231 |
-
[`model_copy`](../concepts/models.md#model-copy)<br>
|
| 232 |
-
<br>
|
| 233 |
-
Returns a copy of the model.<br>
|
| 234 |
-
<br>
|
| 235 |
-
!!! note<br>
|
| 236 |
-
The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This<br>
|
| 237 |
-
might have unexpected side effects if you store anything in it, on top of the model<br>
|
| 238 |
-
fields (e.g. the value of [cached properties][functools.cached_property]).<br>
|
| 239 |
-
<br>
|
| 240 |
-
Args:<br>
|
| 241 |
-
update: Values to change/add in the new model. Note: the data is not validated<br>
|
| 242 |
-
before creating the new model. You should trust this data.<br>
|
| 243 |
-
deep: Set to `True` to make a deep copy of the model.<br>
|
| 244 |
-
<br>
|
| 245 |
-
Returns:<br>
|
| 246 |
-
New model instance.</span></dd></dl>
|
| 247 |
-
|
| 248 |
-
<dl><dt><a name="ModelRequest-model_dump"><strong>model_dump</strong></a>(
|
| 249 |
-
self,
|
| 250 |
-
*,
|
| 251 |
-
mode: "Literal['json', 'python'] | str" = 'python',
|
| 252 |
-
include: 'IncEx | None' = None,
|
| 253 |
-
exclude: 'IncEx | None' = None,
|
| 254 |
-
context: 'Any | None' = None,
|
| 255 |
-
by_alias: 'bool | None' = None,
|
| 256 |
-
exclude_unset: 'bool' = False,
|
| 257 |
-
exclude_defaults: 'bool' = False,
|
| 258 |
-
exclude_none: 'bool' = False,
|
| 259 |
-
exclude_computed_fields: 'bool' = False,
|
| 260 |
-
round_trip: 'bool' = False,
|
| 261 |
-
warnings: "bool | Literal['none', 'warn', 'error']" = True,
|
| 262 |
-
fallback: 'Callable[[Any], Any] | None' = None,
|
| 263 |
-
serialize_as_any: 'bool' = False
|
| 264 |
-
) -> 'dict[str, Any]'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 265 |
-
[`model_dump`](../concepts/serialization.md#python-mode)<br>
|
| 266 |
-
<br>
|
| 267 |
-
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.<br>
|
| 268 |
-
<br>
|
| 269 |
-
Args:<br>
|
| 270 |
-
mode: The mode in which `to_python` should run.<br>
|
| 271 |
-
If mode is 'json', the output will only contain JSON serializable types.<br>
|
| 272 |
-
If mode is 'python', the output may contain non-JSON-serializable Python objects.<br>
|
| 273 |
-
include: A set of fields to include in the output.<br>
|
| 274 |
-
exclude: A set of fields to exclude from the output.<br>
|
| 275 |
-
context: Additional context to pass to the serializer.<br>
|
| 276 |
-
by_alias: Whether to use the field's alias in the dictionary key if defined.<br>
|
| 277 |
-
exclude_unset: Whether to exclude fields that have not been explicitly set.<br>
|
| 278 |
-
exclude_defaults: Whether to exclude fields that are set to their default value.<br>
|
| 279 |
-
exclude_none: Whether to exclude fields that have a value of `None`.<br>
|
| 280 |
-
exclude_computed_fields: Whether to exclude computed fields.<br>
|
| 281 |
-
While this can be useful for round-tripping, it is usually recommended to use the dedicated<br>
|
| 282 |
-
`round_trip` parameter instead.<br>
|
| 283 |
-
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].<br>
|
| 284 |
-
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,<br>
|
| 285 |
-
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].<br>
|
| 286 |
-
fallback: A function to call when an unknown value is encountered. If not provided,<br>
|
| 287 |
-
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.<br>
|
| 288 |
-
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.<br>
|
| 289 |
-
<br>
|
| 290 |
-
Returns:<br>
|
| 291 |
-
A dictionary representation of the model.</span></dd></dl>
|
| 292 |
-
|
| 293 |
-
<dl><dt><a name="ModelRequest-model_dump_json"><strong>model_dump_json</strong></a>(
|
| 294 |
-
self,
|
| 295 |
-
*,
|
| 296 |
-
indent: 'int | None' = None,
|
| 297 |
-
ensure_ascii: 'bool' = False,
|
| 298 |
-
include: 'IncEx | None' = None,
|
| 299 |
-
exclude: 'IncEx | None' = None,
|
| 300 |
-
context: 'Any | None' = None,
|
| 301 |
-
by_alias: 'bool | None' = None,
|
| 302 |
-
exclude_unset: 'bool' = False,
|
| 303 |
-
exclude_defaults: 'bool' = False,
|
| 304 |
-
exclude_none: 'bool' = False,
|
| 305 |
-
exclude_computed_fields: 'bool' = False,
|
| 306 |
-
round_trip: 'bool' = False,
|
| 307 |
-
warnings: "bool | Literal['none', 'warn', 'error']" = True,
|
| 308 |
-
fallback: 'Callable[[Any], Any] | None' = None,
|
| 309 |
-
serialize_as_any: 'bool' = False
|
| 310 |
-
) -> 'str'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 311 |
-
[`model_dump_json`](../concepts/serialization.md#json-mode)<br>
|
| 312 |
-
<br>
|
| 313 |
-
Generates a JSON representation of the model using Pydantic's `to_json` method.<br>
|
| 314 |
-
<br>
|
| 315 |
-
Args:<br>
|
| 316 |
-
indent: Indentation to use in the JSON output. If None is passed, the output will be compact.<br>
|
| 317 |
-
ensure_ascii: If `True`, the output is guaranteed to have all incoming non-ASCII characters escaped.<br>
|
| 318 |
-
If `False` (the default), these characters will be output as-is.<br>
|
| 319 |
-
include: Field(s) to include in the JSON output.<br>
|
| 320 |
-
exclude: Field(s) to exclude from the JSON output.<br>
|
| 321 |
-
context: Additional context to pass to the serializer.<br>
|
| 322 |
-
by_alias: Whether to serialize using field aliases.<br>
|
| 323 |
-
exclude_unset: Whether to exclude fields that have not been explicitly set.<br>
|
| 324 |
-
exclude_defaults: Whether to exclude fields that are set to their default value.<br>
|
| 325 |
-
exclude_none: Whether to exclude fields that have a value of `None`.<br>
|
| 326 |
-
exclude_computed_fields: Whether to exclude computed fields.<br>
|
| 327 |
-
While this can be useful for round-tripping, it is usually recommended to use the dedicated<br>
|
| 328 |
-
`round_trip` parameter instead.<br>
|
| 329 |
-
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].<br>
|
| 330 |
-
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,<br>
|
| 331 |
-
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].<br>
|
| 332 |
-
fallback: A function to call when an unknown value is encountered. If not provided,<br>
|
| 333 |
-
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.<br>
|
| 334 |
-
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.<br>
|
| 335 |
-
<br>
|
| 336 |
-
Returns:<br>
|
| 337 |
-
A JSON string representation of the model.</span></dd></dl>
|
| 338 |
-
|
| 339 |
-
<dl><dt><a name="ModelRequest-model_post_init"><strong>model_post_init</strong></a>(self, context: 'Any', /) -> 'None'</dt><dd><span class="code">Override this method to perform additional initialization after `__init__` and `model_construct`.<br>
|
| 340 |
-
This is useful if you want to do some validation that requires the entire model to be initialized.</span></dd></dl>
|
| 341 |
-
|
| 342 |
-
<hr>
|
| 343 |
-
Class methods inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 344 |
-
<dl><dt><a name="ModelRequest-__class_getitem__"><strong>__class_getitem__</strong></a>(typevar_values: 'type[Any] | tuple[type[Any], ...]') -> 'type[BaseModel] | _forward_ref.PydanticRecursiveRef'</dt></dl>
|
| 345 |
-
|
| 346 |
-
<dl><dt><a name="ModelRequest-__get_pydantic_core_schema__"><strong>__get_pydantic_core_schema__</strong></a>(
|
| 347 |
-
source: 'type[BaseModel]',
|
| 348 |
-
handler: 'GetCoreSchemaHandler',
|
| 349 |
-
/
|
| 350 |
-
) -> 'CoreSchema'</dt></dl>
|
| 351 |
-
|
| 352 |
-
<dl><dt><a name="ModelRequest-__get_pydantic_json_schema__"><strong>__get_pydantic_json_schema__</strong></a>(
|
| 353 |
-
core_schema: 'CoreSchema',
|
| 354 |
-
handler: 'GetJsonSchemaHandler',
|
| 355 |
-
/
|
| 356 |
-
) -> 'JsonSchemaValue'</dt><dd><span class="code">Hook into generating the model's JSON schema.<br>
|
| 357 |
-
<br>
|
| 358 |
-
Args:<br>
|
| 359 |
-
core_schema: A `pydantic-core` CoreSchema.<br>
|
| 360 |
-
You can ignore this argument and call the handler with a new CoreSchema,<br>
|
| 361 |
-
wrap this CoreSchema (`{'type': 'nullable', 'schema': current_schema}`),<br>
|
| 362 |
-
or just call the handler with the original schema.<br>
|
| 363 |
-
handler: Call into Pydantic's internal JSON schema generation.<br>
|
| 364 |
-
This will raise a `pydantic.errors.PydanticInvalidForJsonSchema` if JSON schema<br>
|
| 365 |
-
generation fails.<br>
|
| 366 |
-
Since this gets called by `<a href="pydantic.main.html#BaseModel">BaseModel</a>.model_json_schema` you can override the<br>
|
| 367 |
-
`schema_generator` argument to that function to change JSON schema generation globally<br>
|
| 368 |
-
for a type.<br>
|
| 369 |
-
<br>
|
| 370 |
-
Returns:<br>
|
| 371 |
-
A JSON schema, as a Python object.</span></dd></dl>
|
| 372 |
-
|
| 373 |
-
<dl><dt><a name="ModelRequest-__pydantic_init_subclass__"><strong>__pydantic_init_subclass__</strong></a>(**kwargs: 'Any') -> 'None'</dt><dd><span class="code">This is intended to behave just like `__init_subclass__`, but is called by `ModelMetaclass`<br>
|
| 374 |
-
only after basic class initialization is complete. In particular, attributes like `model_fields` will<br>
|
| 375 |
-
be present when this is called, but forward annotations are not guaranteed to be resolved yet,<br>
|
| 376 |
-
meaning that creating an instance of the class may fail.<br>
|
| 377 |
-
<br>
|
| 378 |
-
This is necessary because `__init_subclass__` will always be called by `type.__new__`,<br>
|
| 379 |
-
and it would require a prohibitively large refactor to the `ModelMetaclass` to ensure that<br>
|
| 380 |
-
`type.__new__` was called in such a manner that the class would already be sufficiently initialized.<br>
|
| 381 |
-
<br>
|
| 382 |
-
This will receive the same `kwargs` that would be passed to the standard `__init_subclass__`, namely,<br>
|
| 383 |
-
any kwargs passed to the class definition that aren't used internally by Pydantic.<br>
|
| 384 |
-
<br>
|
| 385 |
-
Args:<br>
|
| 386 |
-
**kwargs: Any keyword arguments passed to the class definition that aren't used internally<br>
|
| 387 |
-
by Pydantic.<br>
|
| 388 |
-
<br>
|
| 389 |
-
Note:<br>
|
| 390 |
-
You may want to override [`<a href="#ModelRequest-__pydantic_on_complete__">__pydantic_on_complete__</a>()`][pydantic.main.<a href="pydantic.main.html#BaseModel">BaseModel</a>.__pydantic_on_complete__]<br>
|
| 391 |
-
instead, which is called once the class and its fields are fully initialized and ready for validation.</span></dd></dl>
|
| 392 |
-
|
| 393 |
-
<dl><dt><a name="ModelRequest-__pydantic_on_complete__"><strong>__pydantic_on_complete__</strong></a>() -> 'None'</dt><dd><span class="code">This is called once the class and its fields are fully initialized and ready to be used.<br>
|
| 394 |
-
<br>
|
| 395 |
-
This typically happens when the class is created (just before<br>
|
| 396 |
-
[`<a href="#ModelRequest-__pydantic_init_subclass__">__pydantic_init_subclass__</a>()`][pydantic.main.<a href="pydantic.main.html#BaseModel">BaseModel</a>.__pydantic_init_subclass__] is called on the superclass),<br>
|
| 397 |
-
except when forward annotations are used that could not immediately be resolved.<br>
|
| 398 |
-
In that case, it will be called later, when the model is rebuilt automatically or explicitly using<br>
|
| 399 |
-
[`<a href="#ModelRequest-model_rebuild">model_rebuild</a>()`][pydantic.main.<a href="pydantic.main.html#BaseModel">BaseModel</a>.model_rebuild].</span></dd></dl>
|
| 400 |
-
|
| 401 |
-
<dl><dt><a name="ModelRequest-construct"><strong>construct</strong></a>(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'</dt></dl>
|
| 402 |
-
|
| 403 |
-
<dl><dt><a name="ModelRequest-from_orm"><strong>from_orm</strong></a>(obj: 'Any') -> 'Self'</dt></dl>
|
| 404 |
-
|
| 405 |
-
<dl><dt><a name="ModelRequest-model_construct"><strong>model_construct</strong></a>(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'</dt><dd><span class="code">Creates a new instance of the `Model` class with validated data.<br>
|
| 406 |
-
<br>
|
| 407 |
-
Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data.<br>
|
| 408 |
-
Default values are respected, but no other validation is performed.<br>
|
| 409 |
-
<br>
|
| 410 |
-
!!! note<br>
|
| 411 |
-
`<a href="#ModelRequest-model_construct">model_construct</a>()` generally respects the `model_config.extra` setting on the provided model.<br>
|
| 412 |
-
That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__`<br>
|
| 413 |
-
and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored.<br>
|
| 414 |
-
Because no validation is performed with a call to `<a href="#ModelRequest-model_construct">model_construct</a>()`, having `model_config.extra == 'forbid'` does not result in<br>
|
| 415 |
-
an error if extra values are passed, but they will be ignored.<br>
|
| 416 |
-
<br>
|
| 417 |
-
Args:<br>
|
| 418 |
-
_fields_set: A set of field names that were originally explicitly set during instantiation. If provided,<br>
|
| 419 |
-
this is directly used for the [`model_fields_set`][pydantic.<a href="pydantic.main.html#BaseModel">BaseModel</a>.model_fields_set] attribute.<br>
|
| 420 |
-
Otherwise, the field names from the `values` argument will be used.<br>
|
| 421 |
-
values: Trusted or pre-validated data dictionary.<br>
|
| 422 |
-
<br>
|
| 423 |
-
Returns:<br>
|
| 424 |
-
A new instance of the `Model` class with validated data.</span></dd></dl>
|
| 425 |
-
|
| 426 |
-
<dl><dt><a name="ModelRequest-model_json_schema"><strong>model_json_schema</strong></a>(
|
| 427 |
-
by_alias: 'bool' = True,
|
| 428 |
-
ref_template: 'str' = '#/$defs/{model}',
|
| 429 |
-
schema_generator: 'type[GenerateJsonSchema]' = <class 'pydantic.json_schema.GenerateJsonSchema'>,
|
| 430 |
-
mode: 'JsonSchemaMode' = 'validation',
|
| 431 |
-
*,
|
| 432 |
-
union_format: "Literal['any_of', 'primitive_type_array']" = 'any_of'
|
| 433 |
-
) -> 'dict[str, Any]'</dt><dd><span class="code">Generates a JSON schema for a model class.<br>
|
| 434 |
-
<br>
|
| 435 |
-
Args:<br>
|
| 436 |
-
by_alias: Whether to use attribute aliases or not.<br>
|
| 437 |
-
ref_template: The reference template.<br>
|
| 438 |
-
union_format: The format to use when combining schemas from unions together. Can be one of:<br>
|
| 439 |
-
<br>
|
| 440 |
-
- `'any_of'`: Use the [`anyOf`](<a href="https://json-schema.org/understanding-json-schema/reference/combining#anyOf">https://json-schema.org/understanding-json-schema/reference/combining#anyOf</a>)<br>
|
| 441 |
-
keyword to combine schemas (the default).<br>
|
| 442 |
-
- `'primitive_type_array'`: Use the [`type`](<a href="https://json-schema.org/understanding-json-schema/reference/type">https://json-schema.org/understanding-json-schema/reference/type</a>)<br>
|
| 443 |
-
keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive<br>
|
| 444 |
-
type (`string`, `boolean`, `null`, `integer` or `number`) or contains constraints/metadata, falls back to<br>
|
| 445 |
-
`any_of`.<br>
|
| 446 |
-
schema_generator: To override the logic used to generate the JSON schema, as a subclass of<br>
|
| 447 |
-
`GenerateJsonSchema` with your desired modifications<br>
|
| 448 |
-
mode: The mode in which to generate the schema.<br>
|
| 449 |
-
<br>
|
| 450 |
-
Returns:<br>
|
| 451 |
-
The JSON schema for the given model class.</span></dd></dl>
|
| 452 |
-
|
| 453 |
-
<dl><dt><a name="ModelRequest-model_parametrized_name"><strong>model_parametrized_name</strong></a>(params: 'tuple[type[Any], ...]') -> 'str'</dt><dd><span class="code">Compute the class name for parametrizations of generic classes.<br>
|
| 454 |
-
<br>
|
| 455 |
-
This method can be overridden to achieve a custom naming scheme for generic BaseModels.<br>
|
| 456 |
-
<br>
|
| 457 |
-
Args:<br>
|
| 458 |
-
params: Tuple of types of the class. Given a generic class<br>
|
| 459 |
-
`Model` with 2 type variables and a concrete model `Model[str, int]`,<br>
|
| 460 |
-
the value `(str, int)` would be passed to `params`.<br>
|
| 461 |
-
<br>
|
| 462 |
-
Returns:<br>
|
| 463 |
-
String representing the new class where `params` are passed to `cls` as type variables.<br>
|
| 464 |
-
<br>
|
| 465 |
-
Raises:<br>
|
| 466 |
-
TypeError: Raised when trying to generate concrete names for non-generic models.</span></dd></dl>
|
| 467 |
-
|
| 468 |
-
<dl><dt><a name="ModelRequest-model_rebuild"><strong>model_rebuild</strong></a>(
|
| 469 |
-
*,
|
| 470 |
-
force: 'bool' = False,
|
| 471 |
-
raise_errors: 'bool' = True,
|
| 472 |
-
_parent_namespace_depth: 'int' = 2,
|
| 473 |
-
_types_namespace: 'MappingNamespace | None' = None
|
| 474 |
-
) -> 'bool | None'</dt><dd><span class="code">Try to rebuild the pydantic-core schema for the model.<br>
|
| 475 |
-
<br>
|
| 476 |
-
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during<br>
|
| 477 |
-
the initial attempt to build the schema, and automatic rebuilding fails.<br>
|
| 478 |
-
<br>
|
| 479 |
-
Args:<br>
|
| 480 |
-
force: Whether to force the rebuilding of the model schema, defaults to `False`.<br>
|
| 481 |
-
raise_errors: Whether to raise errors, defaults to `True`.<br>
|
| 482 |
-
_parent_namespace_depth: The depth level of the parent namespace, defaults to 2.<br>
|
| 483 |
-
_types_namespace: The types namespace, defaults to `None`.<br>
|
| 484 |
-
<br>
|
| 485 |
-
Returns:<br>
|
| 486 |
-
Returns `None` if the schema is already "complete" and rebuilding was not required.<br>
|
| 487 |
-
If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`.</span></dd></dl>
|
| 488 |
-
|
| 489 |
-
<dl><dt><a name="ModelRequest-model_validate"><strong>model_validate</strong></a>(
|
| 490 |
-
obj: 'Any',
|
| 491 |
-
*,
|
| 492 |
-
strict: 'bool | None' = None,
|
| 493 |
-
extra: 'ExtraValues | None' = None,
|
| 494 |
-
from_attributes: 'bool | None' = None,
|
| 495 |
-
context: 'Any | None' = None,
|
| 496 |
-
by_alias: 'bool | None' = None,
|
| 497 |
-
by_name: 'bool | None' = None
|
| 498 |
-
) -> 'Self'</dt><dd><span class="code">Validate a pydantic model instance.<br>
|
| 499 |
-
<br>
|
| 500 |
-
Args:<br>
|
| 501 |
-
obj: The object to validate.<br>
|
| 502 |
-
strict: Whether to enforce types strictly.<br>
|
| 503 |
-
extra: Whether to ignore, allow, or forbid extra data during model validation.<br>
|
| 504 |
-
See the [`extra` configuration value][pydantic.ConfigDict.extra] for details.<br>
|
| 505 |
-
from_attributes: Whether to extract data from object attributes.<br>
|
| 506 |
-
context: Additional context to pass to the validator.<br>
|
| 507 |
-
by_alias: Whether to use the field's alias when validating against the provided input data.<br>
|
| 508 |
-
by_name: Whether to use the field's name when validating against the provided input data.<br>
|
| 509 |
-
<br>
|
| 510 |
-
Raises:<br>
|
| 511 |
-
ValidationError: If the object could not be validated.<br>
|
| 512 |
-
<br>
|
| 513 |
-
Returns:<br>
|
| 514 |
-
The validated model instance.</span></dd></dl>
|
| 515 |
-
|
| 516 |
-
<dl><dt><a name="ModelRequest-model_validate_json"><strong>model_validate_json</strong></a>(
|
| 517 |
-
json_data: 'str | bytes | bytearray',
|
| 518 |
-
*,
|
| 519 |
-
strict: 'bool | None' = None,
|
| 520 |
-
extra: 'ExtraValues | None' = None,
|
| 521 |
-
context: 'Any | None' = None,
|
| 522 |
-
by_alias: 'bool | None' = None,
|
| 523 |
-
by_name: 'bool | None' = None
|
| 524 |
-
) -> 'Self'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 525 |
-
[JSON Parsing](../concepts/json.md#json-parsing)<br>
|
| 526 |
-
<br>
|
| 527 |
-
Validate the given JSON data against the Pydantic model.<br>
|
| 528 |
-
<br>
|
| 529 |
-
Args:<br>
|
| 530 |
-
json_data: The JSON data to validate.<br>
|
| 531 |
-
strict: Whether to enforce types strictly.<br>
|
| 532 |
-
extra: Whether to ignore, allow, or forbid extra data during model validation.<br>
|
| 533 |
-
See the [`extra` configuration value][pydantic.ConfigDict.extra] for details.<br>
|
| 534 |
-
context: Extra variables to pass to the validator.<br>
|
| 535 |
-
by_alias: Whether to use the field's alias when validating against the provided input data.<br>
|
| 536 |
-
by_name: Whether to use the field's name when validating against the provided input data.<br>
|
| 537 |
-
<br>
|
| 538 |
-
Returns:<br>
|
| 539 |
-
The validated Pydantic model.<br>
|
| 540 |
-
<br>
|
| 541 |
-
Raises:<br>
|
| 542 |
-
ValidationError: If `json_data` is not a JSON string or the object could not be validated.</span></dd></dl>
|
| 543 |
-
|
| 544 |
-
<dl><dt><a name="ModelRequest-model_validate_strings"><strong>model_validate_strings</strong></a>(
|
| 545 |
-
obj: 'Any',
|
| 546 |
-
*,
|
| 547 |
-
strict: 'bool | None' = None,
|
| 548 |
-
extra: 'ExtraValues | None' = None,
|
| 549 |
-
context: 'Any | None' = None,
|
| 550 |
-
by_alias: 'bool | None' = None,
|
| 551 |
-
by_name: 'bool | None' = None
|
| 552 |
-
) -> 'Self'</dt><dd><span class="code">Validate the given object with string data against the Pydantic model.<br>
|
| 553 |
-
<br>
|
| 554 |
-
Args:<br>
|
| 555 |
-
obj: The object containing string data to validate.<br>
|
| 556 |
-
strict: Whether to enforce types strictly.<br>
|
| 557 |
-
extra: Whether to ignore, allow, or forbid extra data during model validation.<br>
|
| 558 |
-
See the [`extra` configuration value][pydantic.ConfigDict.extra] for details.<br>
|
| 559 |
-
context: Extra variables to pass to the validator.<br>
|
| 560 |
-
by_alias: Whether to use the field's alias when validating against the provided input data.<br>
|
| 561 |
-
by_name: Whether to use the field's name when validating against the provided input data.<br>
|
| 562 |
-
<br>
|
| 563 |
-
Returns:<br>
|
| 564 |
-
The validated Pydantic model.</span></dd></dl>
|
| 565 |
-
|
| 566 |
-
<dl><dt><a name="ModelRequest-parse_file"><strong>parse_file</strong></a>(
|
| 567 |
-
path: 'str | Path',
|
| 568 |
-
*,
|
| 569 |
-
content_type: 'str | None' = None,
|
| 570 |
-
encoding: 'str' = 'utf8',
|
| 571 |
-
proto: 'DeprecatedParseProtocol | None' = None,
|
| 572 |
-
allow_pickle: 'bool' = False
|
| 573 |
-
) -> 'Self'</dt></dl>
|
| 574 |
-
|
| 575 |
-
<dl><dt><a name="ModelRequest-parse_obj"><strong>parse_obj</strong></a>(obj: 'Any') -> 'Self'</dt></dl>
|
| 576 |
-
|
| 577 |
-
<dl><dt><a name="ModelRequest-parse_raw"><strong>parse_raw</strong></a>(
|
| 578 |
-
b: 'str | bytes',
|
| 579 |
-
*,
|
| 580 |
-
content_type: 'str | None' = None,
|
| 581 |
-
encoding: 'str' = 'utf8',
|
| 582 |
-
proto: 'DeprecatedParseProtocol | None' = None,
|
| 583 |
-
allow_pickle: 'bool' = False
|
| 584 |
-
) -> 'Self'</dt></dl>
|
| 585 |
-
|
| 586 |
-
<dl><dt><a name="ModelRequest-schema"><strong>schema</strong></a>(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'</dt></dl>
|
| 587 |
-
|
| 588 |
-
<dl><dt><a name="ModelRequest-schema_json"><strong>schema_json</strong></a>(
|
| 589 |
-
*,
|
| 590 |
-
by_alias: 'bool' = True,
|
| 591 |
-
ref_template: 'str' = '#/$defs/{model}',
|
| 592 |
-
**dumps_kwargs: 'Any'
|
| 593 |
-
) -> 'str'</dt></dl>
|
| 594 |
-
|
| 595 |
-
<dl><dt><a name="ModelRequest-update_forward_refs"><strong>update_forward_refs</strong></a>(**localns: 'Any') -> 'None'</dt></dl>
|
| 596 |
-
|
| 597 |
-
<dl><dt><a name="ModelRequest-validate"><strong>validate</strong></a>(value: 'Any') -> 'Self'</dt></dl>
|
| 598 |
-
|
| 599 |
-
<hr>
|
| 600 |
-
Readonly properties inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 601 |
-
<dl><dt><strong>__fields_set__</strong></dt>
|
| 602 |
-
</dl>
|
| 603 |
-
<dl><dt><strong>model_extra</strong></dt>
|
| 604 |
-
<dd><span class="code">Get extra fields set during validation.<br>
|
| 605 |
-
<br>
|
| 606 |
-
Returns:<br>
|
| 607 |
-
A dictionary of extra fields, or `None` if `config.extra` is not set to `"allow"`.</span></dd>
|
| 608 |
-
</dl>
|
| 609 |
-
<dl><dt><strong>model_fields_set</strong></dt>
|
| 610 |
-
<dd><span class="code">Returns the set of fields that have been explicitly set on this model instance.<br>
|
| 611 |
-
<br>
|
| 612 |
-
Returns:<br>
|
| 613 |
-
A set of strings representing the fields that have been set,<br>
|
| 614 |
-
i.e. that were not filled from defaults.</span></dd>
|
| 615 |
-
</dl>
|
| 616 |
-
<hr>
|
| 617 |
-
Data descriptors inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 618 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 619 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 620 |
-
</dl>
|
| 621 |
-
<dl><dt><strong>__pydantic_extra__</strong></dt>
|
| 622 |
-
</dl>
|
| 623 |
-
<dl><dt><strong>__pydantic_fields_set__</strong></dt>
|
| 624 |
-
</dl>
|
| 625 |
-
<dl><dt><strong>__pydantic_private__</strong></dt>
|
| 626 |
-
</dl>
|
| 627 |
-
<hr>
|
| 628 |
-
Data and other attributes inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 629 |
-
<dl><dt><strong>__hash__</strong> = None</dl>
|
| 630 |
-
|
| 631 |
-
<dl><dt><strong>__pydantic_root_model__</strong> = False</dl>
|
| 632 |
-
|
| 633 |
-
<dl><dt><strong>model_computed_fields</strong> = {}</dl>
|
| 634 |
-
|
| 635 |
-
<dl><dt><strong>model_fields</strong> = {'age': FieldInfo(annotation=int, required=True), 'anciennete_sans_promotion': FieldInfo(annotation=float, required=True), 'annee_experience_totale': FieldInfo(annotation=int, required=True), 'annees_dans_l_entreprise': FieldInfo(annotation=int, required=True), 'annees_dans_le_poste_actuel': FieldInfo(annotation=int, required=True), 'annees_depuis_la_derniere_promotion': FieldInfo(annotation=int, required=True), 'annees_sous_responsable_actuel': FieldInfo(annotation=int, required=True), 'augmentation_salaire_precedente': FieldInfo(annotation=float, required=True), 'departement': FieldInfo(annotation=str, required=True), 'distance_domicile_travail': FieldInfo(annotation=int, required=True), ...}</dl>
|
| 636 |
-
|
| 637 |
-
</td></tr></table> <p>
|
| 638 |
-
<table class="section">
|
| 639 |
-
<tr class="decor title-decor heading-text">
|
| 640 |
-
<td class="section-title" colspan=3> <br><a name="ModelResponse">class <strong>ModelResponse</strong></a>(<a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>)</td></tr>
|
| 641 |
-
|
| 642 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 643 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#ModelResponse">ModelResponse</a>(<br>
|
| 644 |
-
*,<br>
|
| 645 |
-
employee_id: Optional[int] = None,<br>
|
| 646 |
-
turnover_probability: float,<br>
|
| 647 |
-
will_leave: bool<br>
|
| 648 |
-
) -&gt; None<br>
|
| 649 |
-
<br>
|
| 650 |
-
# Le modèle de réponse inclut la probabilité de départ et la classe prédite (will_leave), ainsi que l'employee_id si disponible.<br> </span></td></tr>
|
| 651 |
-
<tr><td> </td>
|
| 652 |
-
<td class="singlecolumn"><dl><dt>Method resolution order:</dt>
|
| 653 |
-
<dd><a href="domain.domain.html#ModelResponse">ModelResponse</a></dd>
|
| 654 |
-
<dd><a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a></dd>
|
| 655 |
-
<dd><a href="builtins.html#object">builtins.object</a></dd>
|
| 656 |
-
</dl>
|
| 657 |
-
<hr>
|
| 658 |
-
Data descriptors defined here:<br>
|
| 659 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 660 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 661 |
-
</dl>
|
| 662 |
-
<hr>
|
| 663 |
-
Data and other attributes defined here:<br>
|
| 664 |
-
<dl><dt><strong>__abstractmethods__</strong> = frozenset()</dl>
|
| 665 |
-
|
| 666 |
-
<dl><dt><strong>__annotations__</strong> = {'employee_id': 'Optional[int]', 'turnover_probability': 'float', 'will_leave': 'bool'}</dl>
|
| 667 |
-
|
| 668 |
-
<dl><dt><strong>__class_vars__</strong> = set()</dl>
|
| 669 |
-
|
| 670 |
-
<dl><dt><strong>__private_attributes__</strong> = {}</dl>
|
| 671 |
-
|
| 672 |
-
<dl><dt><strong>__pydantic_complete__</strong> = True</dl>
|
| 673 |
-
|
| 674 |
-
<dl><dt><strong>__pydantic_computed_fields__</strong> = {}</dl>
|
| 675 |
-
|
| 676 |
-
<dl><dt><strong>__pydantic_core_schema__</strong> = {'cls': <class 'domain.domain.ModelResponse'>, 'config': {'title': 'ModelResponse'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'domain.domain.ModelResponse'>>]}, 'ref': 'domain.domain.ModelResponse:2430588436352', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'employee_id': {'metadata': {}, 'schema': {'default': None, 'schema': {'schema': {...}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'turnover_probability': {'metadata': {}, 'schema': {'type': 'float'}, 'type': 'model-field'}, 'will_leave': {'metadata': {}, 'schema': {'type': 'bool'}, 'type': 'model-field'}}, 'model_name': 'ModelResponse', 'type': 'model-fields'}, 'type': 'model'}</dl>
|
| 677 |
-
|
| 678 |
-
<dl><dt><strong>__pydantic_custom_init__</strong> = False</dl>
|
| 679 |
-
|
| 680 |
-
<dl><dt><strong>__pydantic_decorators__</strong> = DecoratorInfos(validators={}, field_validators={...zers={}, model_validators={}, computed_fields={})</dl>
|
| 681 |
-
|
| 682 |
-
<dl><dt><strong>__pydantic_fields__</strong> = {'employee_id': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'turnover_probability': FieldInfo(annotation=float, required=True), 'will_leave': FieldInfo(annotation=bool, required=True)}</dl>
|
| 683 |
-
|
| 684 |
-
<dl><dt><strong>__pydantic_generic_metadata__</strong> = {'args': (), 'origin': None, 'parameters': ()}</dl>
|
| 685 |
-
|
| 686 |
-
<dl><dt><strong>__pydantic_parent_namespace__</strong> = None</dl>
|
| 687 |
-
|
| 688 |
-
<dl><dt><strong>__pydantic_post_init__</strong> = None</dl>
|
| 689 |
-
|
| 690 |
-
<dl><dt><strong>__pydantic_serializer__</strong> = SchemaSerializer(serializer=Model(
|
| 691 |
-
ModelSeri... name: "ModelResponse",
|
| 692 |
-
},
|
| 693 |
-
), definitions=[])</dl>
|
| 694 |
-
|
| 695 |
-
<dl><dt><strong>__pydantic_setattr_handlers__</strong> = {}</dl>
|
| 696 |
-
|
| 697 |
-
<dl><dt><strong>__pydantic_validator__</strong> = SchemaValidator(title="ModelResponse", validator...e",
|
| 698 |
-
},
|
| 699 |
-
), definitions=[], cache_strings=True)</dl>
|
| 700 |
-
|
| 701 |
-
<dl><dt><strong>__signature__</strong> = <Signature (*, employee_id: Optional[int] = None...er_probability: float, will_leave: bool) -> None></dl>
|
| 702 |
-
|
| 703 |
-
<dl><dt><strong>model_config</strong> = {}</dl>
|
| 704 |
-
|
| 705 |
-
<hr>
|
| 706 |
-
Methods inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 707 |
-
<dl><dt><a name="ModelResponse-__copy__"><strong>__copy__</strong></a>(self) -> 'Self'</dt><dd><span class="code">Returns a shallow copy of the model.</span></dd></dl>
|
| 708 |
-
|
| 709 |
-
<dl><dt><a name="ModelResponse-__deepcopy__"><strong>__deepcopy__</strong></a>(self, memo: 'dict[int, Any] | None' = None) -> 'Self'</dt><dd><span class="code">Returns a deep copy of the model.</span></dd></dl>
|
| 710 |
-
|
| 711 |
-
<dl><dt><a name="ModelResponse-__delattr__"><strong>__delattr__</strong></a>(self, item: 'str') -> 'Any'</dt><dd><span class="code">Implement delattr(self, name).</span></dd></dl>
|
| 712 |
-
|
| 713 |
-
<dl><dt><a name="ModelResponse-__eq__"><strong>__eq__</strong></a>(self, other: 'Any') -> 'bool'</dt><dd><span class="code">Return self==value.</span></dd></dl>
|
| 714 |
-
|
| 715 |
-
<dl><dt><a name="ModelResponse-__getattr__"><strong>__getattr__</strong></a>(self, item: 'str') -> 'Any'</dt></dl>
|
| 716 |
-
|
| 717 |
-
<dl><dt><a name="ModelResponse-__getstate__"><strong>__getstate__</strong></a>(self) -> 'dict[Any, Any]'</dt><dd><span class="code">Helper for pickle.</span></dd></dl>
|
| 718 |
-
|
| 719 |
-
<dl><dt><a name="ModelResponse-__init__"><strong>__init__</strong></a>(self, /, **data: 'Any') -> 'None'</dt><dd><span class="code">Create a new model by parsing and validating input data from keyword arguments.<br>
|
| 720 |
-
<br>
|
| 721 |
-
Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be<br>
|
| 722 |
-
validated to form a valid model.<br>
|
| 723 |
-
<br>
|
| 724 |
-
`self` is explicitly positional-only to allow `self` as a field name.</span></dd></dl>
|
| 725 |
-
|
| 726 |
-
<dl><dt><a name="ModelResponse-__iter__"><strong>__iter__</strong></a>(self) -> 'TupleGenerator'</dt><dd><span class="code">So `<a href="#ModelResponse-dict">dict</a>(model)` works.</span></dd></dl>
|
| 727 |
-
|
| 728 |
-
<dl><dt><a name="ModelResponse-__pretty__"><strong>__pretty__</strong></a>(self, fmt: 'Callable[[Any], Any]', **kwargs: 'Any') -> 'Generator[Any]'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Used by devtools (<a href="https://python-devtools.helpmanual.io/">https://python-devtools.helpmanual.io/</a>) to pretty print objects.</span></dd></dl>
|
| 729 |
-
|
| 730 |
-
<dl><dt><a name="ModelResponse-__replace__"><strong>__replace__</strong></a>(self, **changes: 'Any') -> 'Self'</dt><dd><span class="code"># Because we make use of `@dataclass_transform()`, `__replace__` is already synthesized by<br>
|
| 731 |
-
# type checkers, so we define the implementation in this `if not TYPE_CHECKING:` block:</span></dd></dl>
|
| 732 |
-
|
| 733 |
-
<dl><dt><a name="ModelResponse-__repr__"><strong>__repr__</strong></a>(self) -> 'str'</dt><dd><span class="code">Return repr(self).</span></dd></dl>
|
| 734 |
-
|
| 735 |
-
<dl><dt><a name="ModelResponse-__repr_args__"><strong>__repr_args__</strong></a>(self) -> '_repr.ReprArgs'</dt></dl>
|
| 736 |
-
|
| 737 |
-
<dl><dt><a name="ModelResponse-__repr_name__"><strong>__repr_name__</strong></a>(self) -> 'str'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Name of the instance's class, used in __repr__.</span></dd></dl>
|
| 738 |
-
|
| 739 |
-
<dl><dt><a name="ModelResponse-__repr_recursion__"><strong>__repr_recursion__</strong></a>(self, object: 'Any') -> 'str'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Returns the string representation of a recursive object.</span></dd></dl>
|
| 740 |
-
|
| 741 |
-
<dl><dt><a name="ModelResponse-__repr_str__"><strong>__repr_str__</strong></a>(self, join_str: 'str') -> 'str'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt></dl>
|
| 742 |
-
|
| 743 |
-
<dl><dt><a name="ModelResponse-__rich_repr__"><strong>__rich_repr__</strong></a>(self) -> 'RichReprResult'<span class="grey"><span class="heading-text"> from pydantic._internal._repr.Representation</span></span></dt><dd><span class="code">Used by Rich (<a href="https://rich.readthedocs.io/en/stable/pretty.html">https://rich.readthedocs.io/en/stable/pretty.html</a>) to pretty print objects.</span></dd></dl>
|
| 744 |
-
|
| 745 |
-
<dl><dt><a name="ModelResponse-__setattr__"><strong>__setattr__</strong></a>(self, name: 'str', value: 'Any') -> 'None'</dt><dd><span class="code">Implement setattr(self, name, value).</span></dd></dl>
|
| 746 |
-
|
| 747 |
-
<dl><dt><a name="ModelResponse-__setstate__"><strong>__setstate__</strong></a>(self, state: 'dict[Any, Any]') -> 'None'</dt></dl>
|
| 748 |
-
|
| 749 |
-
<dl><dt><a name="ModelResponse-__str__"><strong>__str__</strong></a>(self) -> 'str'</dt><dd><span class="code">Return str(self).</span></dd></dl>
|
| 750 |
-
|
| 751 |
-
<dl><dt><a name="ModelResponse-copy"><strong>copy</strong></a>(
|
| 752 |
-
self,
|
| 753 |
-
*,
|
| 754 |
-
include: 'AbstractSetIntStr | MappingIntStrAny | None' = None,
|
| 755 |
-
exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None,
|
| 756 |
-
update: 'Dict[str, Any] | None' = None,
|
| 757 |
-
deep: 'bool' = False
|
| 758 |
-
) -> 'Self'</dt><dd><span class="code">Returns a copy of the model.<br>
|
| 759 |
-
<br>
|
| 760 |
-
!!! warning "Deprecated"<br>
|
| 761 |
-
This method is now deprecated; use `model_copy` instead.<br>
|
| 762 |
-
<br>
|
| 763 |
-
If you need `include` or `exclude`, use:<br>
|
| 764 |
-
<br>
|
| 765 |
-
```python {test="skip" lint="skip"}<br>
|
| 766 |
-
data = self.<a href="#ModelResponse-model_dump">model_dump</a>(include=include, exclude=exclude, round_trip=True)<br>
|
| 767 |
-
data = {**data, **(update or {})}<br>
|
| 768 |
-
copied = self.<a href="#ModelResponse-model_validate">model_validate</a>(data)<br>
|
| 769 |
-
```<br>
|
| 770 |
-
<br>
|
| 771 |
-
Args:<br>
|
| 772 |
-
include: Optional set or mapping specifying which fields to include in the copied model.<br>
|
| 773 |
-
exclude: Optional set or mapping specifying which fields to exclude in the copied model.<br>
|
| 774 |
-
update: Optional dictionary of field-value pairs to override field values in the copied model.<br>
|
| 775 |
-
deep: If True, the values of fields that are Pydantic models will be deep-copied.<br>
|
| 776 |
-
<br>
|
| 777 |
-
Returns:<br>
|
| 778 |
-
A copy of the model with included, excluded and updated fields as specified.</span></dd></dl>
|
| 779 |
-
|
| 780 |
-
<dl><dt><a name="ModelResponse-dict"><strong>dict</strong></a>(
|
| 781 |
-
self,
|
| 782 |
-
*,
|
| 783 |
-
include: 'IncEx | None' = None,
|
| 784 |
-
exclude: 'IncEx | None' = None,
|
| 785 |
-
by_alias: 'bool' = False,
|
| 786 |
-
exclude_unset: 'bool' = False,
|
| 787 |
-
exclude_defaults: 'bool' = False,
|
| 788 |
-
exclude_none: 'bool' = False
|
| 789 |
-
) -> 'Dict[str, Any]'</dt></dl>
|
| 790 |
-
|
| 791 |
-
<dl><dt><a name="ModelResponse-json"><strong>json</strong></a>(
|
| 792 |
-
self,
|
| 793 |
-
*,
|
| 794 |
-
include: 'IncEx | None' = None,
|
| 795 |
-
exclude: 'IncEx | None' = None,
|
| 796 |
-
by_alias: 'bool' = False,
|
| 797 |
-
exclude_unset: 'bool' = False,
|
| 798 |
-
exclude_defaults: 'bool' = False,
|
| 799 |
-
exclude_none: 'bool' = False,
|
| 800 |
-
encoder: 'Callable[[Any], Any] | None' = PydanticUndefined,
|
| 801 |
-
models_as_dict: 'bool' = PydanticUndefined,
|
| 802 |
-
**dumps_kwargs: 'Any'
|
| 803 |
-
) -> 'str'</dt></dl>
|
| 804 |
-
|
| 805 |
-
<dl><dt><a name="ModelResponse-model_copy"><strong>model_copy</strong></a>(
|
| 806 |
-
self,
|
| 807 |
-
*,
|
| 808 |
-
update: 'Mapping[str, Any] | None' = None,
|
| 809 |
-
deep: 'bool' = False
|
| 810 |
-
) -> 'Self'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 811 |
-
[`model_copy`](../concepts/models.md#model-copy)<br>
|
| 812 |
-
<br>
|
| 813 |
-
Returns a copy of the model.<br>
|
| 814 |
-
<br>
|
| 815 |
-
!!! note<br>
|
| 816 |
-
The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This<br>
|
| 817 |
-
might have unexpected side effects if you store anything in it, on top of the model<br>
|
| 818 |
-
fields (e.g. the value of [cached properties][functools.cached_property]).<br>
|
| 819 |
-
<br>
|
| 820 |
-
Args:<br>
|
| 821 |
-
update: Values to change/add in the new model. Note: the data is not validated<br>
|
| 822 |
-
before creating the new model. You should trust this data.<br>
|
| 823 |
-
deep: Set to `True` to make a deep copy of the model.<br>
|
| 824 |
-
<br>
|
| 825 |
-
Returns:<br>
|
| 826 |
-
New model instance.</span></dd></dl>
|
| 827 |
-
|
| 828 |
-
<dl><dt><a name="ModelResponse-model_dump"><strong>model_dump</strong></a>(
|
| 829 |
-
self,
|
| 830 |
-
*,
|
| 831 |
-
mode: "Literal['json', 'python'] | str" = 'python',
|
| 832 |
-
include: 'IncEx | None' = None,
|
| 833 |
-
exclude: 'IncEx | None' = None,
|
| 834 |
-
context: 'Any | None' = None,
|
| 835 |
-
by_alias: 'bool | None' = None,
|
| 836 |
-
exclude_unset: 'bool' = False,
|
| 837 |
-
exclude_defaults: 'bool' = False,
|
| 838 |
-
exclude_none: 'bool' = False,
|
| 839 |
-
exclude_computed_fields: 'bool' = False,
|
| 840 |
-
round_trip: 'bool' = False,
|
| 841 |
-
warnings: "bool | Literal['none', 'warn', 'error']" = True,
|
| 842 |
-
fallback: 'Callable[[Any], Any] | None' = None,
|
| 843 |
-
serialize_as_any: 'bool' = False
|
| 844 |
-
) -> 'dict[str, Any]'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 845 |
-
[`model_dump`](../concepts/serialization.md#python-mode)<br>
|
| 846 |
-
<br>
|
| 847 |
-
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.<br>
|
| 848 |
-
<br>
|
| 849 |
-
Args:<br>
|
| 850 |
-
mode: The mode in which `to_python` should run.<br>
|
| 851 |
-
If mode is 'json', the output will only contain JSON serializable types.<br>
|
| 852 |
-
If mode is 'python', the output may contain non-JSON-serializable Python objects.<br>
|
| 853 |
-
include: A set of fields to include in the output.<br>
|
| 854 |
-
exclude: A set of fields to exclude from the output.<br>
|
| 855 |
-
context: Additional context to pass to the serializer.<br>
|
| 856 |
-
by_alias: Whether to use the field's alias in the dictionary key if defined.<br>
|
| 857 |
-
exclude_unset: Whether to exclude fields that have not been explicitly set.<br>
|
| 858 |
-
exclude_defaults: Whether to exclude fields that are set to their default value.<br>
|
| 859 |
-
exclude_none: Whether to exclude fields that have a value of `None`.<br>
|
| 860 |
-
exclude_computed_fields: Whether to exclude computed fields.<br>
|
| 861 |
-
While this can be useful for round-tripping, it is usually recommended to use the dedicated<br>
|
| 862 |
-
`round_trip` parameter instead.<br>
|
| 863 |
-
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].<br>
|
| 864 |
-
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,<br>
|
| 865 |
-
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].<br>
|
| 866 |
-
fallback: A function to call when an unknown value is encountered. If not provided,<br>
|
| 867 |
-
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.<br>
|
| 868 |
-
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.<br>
|
| 869 |
-
<br>
|
| 870 |
-
Returns:<br>
|
| 871 |
-
A dictionary representation of the model.</span></dd></dl>
|
| 872 |
-
|
| 873 |
-
<dl><dt><a name="ModelResponse-model_dump_json"><strong>model_dump_json</strong></a>(
|
| 874 |
-
self,
|
| 875 |
-
*,
|
| 876 |
-
indent: 'int | None' = None,
|
| 877 |
-
ensure_ascii: 'bool' = False,
|
| 878 |
-
include: 'IncEx | None' = None,
|
| 879 |
-
exclude: 'IncEx | None' = None,
|
| 880 |
-
context: 'Any | None' = None,
|
| 881 |
-
by_alias: 'bool | None' = None,
|
| 882 |
-
exclude_unset: 'bool' = False,
|
| 883 |
-
exclude_defaults: 'bool' = False,
|
| 884 |
-
exclude_none: 'bool' = False,
|
| 885 |
-
exclude_computed_fields: 'bool' = False,
|
| 886 |
-
round_trip: 'bool' = False,
|
| 887 |
-
warnings: "bool | Literal['none', 'warn', 'error']" = True,
|
| 888 |
-
fallback: 'Callable[[Any], Any] | None' = None,
|
| 889 |
-
serialize_as_any: 'bool' = False
|
| 890 |
-
) -> 'str'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 891 |
-
[`model_dump_json`](../concepts/serialization.md#json-mode)<br>
|
| 892 |
-
<br>
|
| 893 |
-
Generates a JSON representation of the model using Pydantic's `to_json` method.<br>
|
| 894 |
-
<br>
|
| 895 |
-
Args:<br>
|
| 896 |
-
indent: Indentation to use in the JSON output. If None is passed, the output will be compact.<br>
|
| 897 |
-
ensure_ascii: If `True`, the output is guaranteed to have all incoming non-ASCII characters escaped.<br>
|
| 898 |
-
If `False` (the default), these characters will be output as-is.<br>
|
| 899 |
-
include: Field(s) to include in the JSON output.<br>
|
| 900 |
-
exclude: Field(s) to exclude from the JSON output.<br>
|
| 901 |
-
context: Additional context to pass to the serializer.<br>
|
| 902 |
-
by_alias: Whether to serialize using field aliases.<br>
|
| 903 |
-
exclude_unset: Whether to exclude fields that have not been explicitly set.<br>
|
| 904 |
-
exclude_defaults: Whether to exclude fields that are set to their default value.<br>
|
| 905 |
-
exclude_none: Whether to exclude fields that have a value of `None`.<br>
|
| 906 |
-
exclude_computed_fields: Whether to exclude computed fields.<br>
|
| 907 |
-
While this can be useful for round-tripping, it is usually recommended to use the dedicated<br>
|
| 908 |
-
`round_trip` parameter instead.<br>
|
| 909 |
-
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].<br>
|
| 910 |
-
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,<br>
|
| 911 |
-
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].<br>
|
| 912 |
-
fallback: A function to call when an unknown value is encountered. If not provided,<br>
|
| 913 |
-
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.<br>
|
| 914 |
-
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.<br>
|
| 915 |
-
<br>
|
| 916 |
-
Returns:<br>
|
| 917 |
-
A JSON string representation of the model.</span></dd></dl>
|
| 918 |
-
|
| 919 |
-
<dl><dt><a name="ModelResponse-model_post_init"><strong>model_post_init</strong></a>(self, context: 'Any', /) -> 'None'</dt><dd><span class="code">Override this method to perform additional initialization after `__init__` and `model_construct`.<br>
|
| 920 |
-
This is useful if you want to do some validation that requires the entire model to be initialized.</span></dd></dl>
|
| 921 |
-
|
| 922 |
-
<hr>
|
| 923 |
-
Class methods inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 924 |
-
<dl><dt><a name="ModelResponse-__class_getitem__"><strong>__class_getitem__</strong></a>(typevar_values: 'type[Any] | tuple[type[Any], ...]') -> 'type[BaseModel] | _forward_ref.PydanticRecursiveRef'</dt></dl>
|
| 925 |
-
|
| 926 |
-
<dl><dt><a name="ModelResponse-__get_pydantic_core_schema__"><strong>__get_pydantic_core_schema__</strong></a>(
|
| 927 |
-
source: 'type[BaseModel]',
|
| 928 |
-
handler: 'GetCoreSchemaHandler',
|
| 929 |
-
/
|
| 930 |
-
) -> 'CoreSchema'</dt></dl>
|
| 931 |
-
|
| 932 |
-
<dl><dt><a name="ModelResponse-__get_pydantic_json_schema__"><strong>__get_pydantic_json_schema__</strong></a>(
|
| 933 |
-
core_schema: 'CoreSchema',
|
| 934 |
-
handler: 'GetJsonSchemaHandler',
|
| 935 |
-
/
|
| 936 |
-
) -> 'JsonSchemaValue'</dt><dd><span class="code">Hook into generating the model's JSON schema.<br>
|
| 937 |
-
<br>
|
| 938 |
-
Args:<br>
|
| 939 |
-
core_schema: A `pydantic-core` CoreSchema.<br>
|
| 940 |
-
You can ignore this argument and call the handler with a new CoreSchema,<br>
|
| 941 |
-
wrap this CoreSchema (`{'type': 'nullable', 'schema': current_schema}`),<br>
|
| 942 |
-
or just call the handler with the original schema.<br>
|
| 943 |
-
handler: Call into Pydantic's internal JSON schema generation.<br>
|
| 944 |
-
This will raise a `pydantic.errors.PydanticInvalidForJsonSchema` if JSON schema<br>
|
| 945 |
-
generation fails.<br>
|
| 946 |
-
Since this gets called by `<a href="pydantic.main.html#BaseModel">BaseModel</a>.model_json_schema` you can override the<br>
|
| 947 |
-
`schema_generator` argument to that function to change JSON schema generation globally<br>
|
| 948 |
-
for a type.<br>
|
| 949 |
-
<br>
|
| 950 |
-
Returns:<br>
|
| 951 |
-
A JSON schema, as a Python object.</span></dd></dl>
|
| 952 |
-
|
| 953 |
-
<dl><dt><a name="ModelResponse-__pydantic_init_subclass__"><strong>__pydantic_init_subclass__</strong></a>(**kwargs: 'Any') -> 'None'</dt><dd><span class="code">This is intended to behave just like `__init_subclass__`, but is called by `ModelMetaclass`<br>
|
| 954 |
-
only after basic class initialization is complete. In particular, attributes like `model_fields` will<br>
|
| 955 |
-
be present when this is called, but forward annotations are not guaranteed to be resolved yet,<br>
|
| 956 |
-
meaning that creating an instance of the class may fail.<br>
|
| 957 |
-
<br>
|
| 958 |
-
This is necessary because `__init_subclass__` will always be called by `type.__new__`,<br>
|
| 959 |
-
and it would require a prohibitively large refactor to the `ModelMetaclass` to ensure that<br>
|
| 960 |
-
`type.__new__` was called in such a manner that the class would already be sufficiently initialized.<br>
|
| 961 |
-
<br>
|
| 962 |
-
This will receive the same `kwargs` that would be passed to the standard `__init_subclass__`, namely,<br>
|
| 963 |
-
any kwargs passed to the class definition that aren't used internally by Pydantic.<br>
|
| 964 |
-
<br>
|
| 965 |
-
Args:<br>
|
| 966 |
-
**kwargs: Any keyword arguments passed to the class definition that aren't used internally<br>
|
| 967 |
-
by Pydantic.<br>
|
| 968 |
-
<br>
|
| 969 |
-
Note:<br>
|
| 970 |
-
You may want to override [`<a href="#ModelResponse-__pydantic_on_complete__">__pydantic_on_complete__</a>()`][pydantic.main.<a href="pydantic.main.html#BaseModel">BaseModel</a>.__pydantic_on_complete__]<br>
|
| 971 |
-
instead, which is called once the class and its fields are fully initialized and ready for validation.</span></dd></dl>
|
| 972 |
-
|
| 973 |
-
<dl><dt><a name="ModelResponse-__pydantic_on_complete__"><strong>__pydantic_on_complete__</strong></a>() -> 'None'</dt><dd><span class="code">This is called once the class and its fields are fully initialized and ready to be used.<br>
|
| 974 |
-
<br>
|
| 975 |
-
This typically happens when the class is created (just before<br>
|
| 976 |
-
[`<a href="#ModelResponse-__pydantic_init_subclass__">__pydantic_init_subclass__</a>()`][pydantic.main.<a href="pydantic.main.html#BaseModel">BaseModel</a>.__pydantic_init_subclass__] is called on the superclass),<br>
|
| 977 |
-
except when forward annotations are used that could not immediately be resolved.<br>
|
| 978 |
-
In that case, it will be called later, when the model is rebuilt automatically or explicitly using<br>
|
| 979 |
-
[`<a href="#ModelResponse-model_rebuild">model_rebuild</a>()`][pydantic.main.<a href="pydantic.main.html#BaseModel">BaseModel</a>.model_rebuild].</span></dd></dl>
|
| 980 |
-
|
| 981 |
-
<dl><dt><a name="ModelResponse-construct"><strong>construct</strong></a>(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'</dt></dl>
|
| 982 |
-
|
| 983 |
-
<dl><dt><a name="ModelResponse-from_orm"><strong>from_orm</strong></a>(obj: 'Any') -> 'Self'</dt></dl>
|
| 984 |
-
|
| 985 |
-
<dl><dt><a name="ModelResponse-model_construct"><strong>model_construct</strong></a>(_fields_set: 'set[str] | None' = None, **values: 'Any') -> 'Self'</dt><dd><span class="code">Creates a new instance of the `Model` class with validated data.<br>
|
| 986 |
-
<br>
|
| 987 |
-
Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data.<br>
|
| 988 |
-
Default values are respected, but no other validation is performed.<br>
|
| 989 |
-
<br>
|
| 990 |
-
!!! note<br>
|
| 991 |
-
`<a href="#ModelResponse-model_construct">model_construct</a>()` generally respects the `model_config.extra` setting on the provided model.<br>
|
| 992 |
-
That is, if `model_config.extra == 'allow'`, then all extra passed values are added to the model instance's `__dict__`<br>
|
| 993 |
-
and `__pydantic_extra__` fields. If `model_config.extra == 'ignore'` (the default), then all extra passed values are ignored.<br>
|
| 994 |
-
Because no validation is performed with a call to `<a href="#ModelResponse-model_construct">model_construct</a>()`, having `model_config.extra == 'forbid'` does not result in<br>
|
| 995 |
-
an error if extra values are passed, but they will be ignored.<br>
|
| 996 |
-
<br>
|
| 997 |
-
Args:<br>
|
| 998 |
-
_fields_set: A set of field names that were originally explicitly set during instantiation. If provided,<br>
|
| 999 |
-
this is directly used for the [`model_fields_set`][pydantic.<a href="pydantic.main.html#BaseModel">BaseModel</a>.model_fields_set] attribute.<br>
|
| 1000 |
-
Otherwise, the field names from the `values` argument will be used.<br>
|
| 1001 |
-
values: Trusted or pre-validated data dictionary.<br>
|
| 1002 |
-
<br>
|
| 1003 |
-
Returns:<br>
|
| 1004 |
-
A new instance of the `Model` class with validated data.</span></dd></dl>
|
| 1005 |
-
|
| 1006 |
-
<dl><dt><a name="ModelResponse-model_json_schema"><strong>model_json_schema</strong></a>(
|
| 1007 |
-
by_alias: 'bool' = True,
|
| 1008 |
-
ref_template: 'str' = '#/$defs/{model}',
|
| 1009 |
-
schema_generator: 'type[GenerateJsonSchema]' = <class 'pydantic.json_schema.GenerateJsonSchema'>,
|
| 1010 |
-
mode: 'JsonSchemaMode' = 'validation',
|
| 1011 |
-
*,
|
| 1012 |
-
union_format: "Literal['any_of', 'primitive_type_array']" = 'any_of'
|
| 1013 |
-
) -> 'dict[str, Any]'</dt><dd><span class="code">Generates a JSON schema for a model class.<br>
|
| 1014 |
-
<br>
|
| 1015 |
-
Args:<br>
|
| 1016 |
-
by_alias: Whether to use attribute aliases or not.<br>
|
| 1017 |
-
ref_template: The reference template.<br>
|
| 1018 |
-
union_format: The format to use when combining schemas from unions together. Can be one of:<br>
|
| 1019 |
-
<br>
|
| 1020 |
-
- `'any_of'`: Use the [`anyOf`](<a href="https://json-schema.org/understanding-json-schema/reference/combining#anyOf">https://json-schema.org/understanding-json-schema/reference/combining#anyOf</a>)<br>
|
| 1021 |
-
keyword to combine schemas (the default).<br>
|
| 1022 |
-
- `'primitive_type_array'`: Use the [`type`](<a href="https://json-schema.org/understanding-json-schema/reference/type">https://json-schema.org/understanding-json-schema/reference/type</a>)<br>
|
| 1023 |
-
keyword as an array of strings, containing each type of the combination. If any of the schemas is not a primitive<br>
|
| 1024 |
-
type (`string`, `boolean`, `null`, `integer` or `number`) or contains constraints/metadata, falls back to<br>
|
| 1025 |
-
`any_of`.<br>
|
| 1026 |
-
schema_generator: To override the logic used to generate the JSON schema, as a subclass of<br>
|
| 1027 |
-
`GenerateJsonSchema` with your desired modifications<br>
|
| 1028 |
-
mode: The mode in which to generate the schema.<br>
|
| 1029 |
-
<br>
|
| 1030 |
-
Returns:<br>
|
| 1031 |
-
The JSON schema for the given model class.</span></dd></dl>
|
| 1032 |
-
|
| 1033 |
-
<dl><dt><a name="ModelResponse-model_parametrized_name"><strong>model_parametrized_name</strong></a>(params: 'tuple[type[Any], ...]') -> 'str'</dt><dd><span class="code">Compute the class name for parametrizations of generic classes.<br>
|
| 1034 |
-
<br>
|
| 1035 |
-
This method can be overridden to achieve a custom naming scheme for generic BaseModels.<br>
|
| 1036 |
-
<br>
|
| 1037 |
-
Args:<br>
|
| 1038 |
-
params: Tuple of types of the class. Given a generic class<br>
|
| 1039 |
-
`Model` with 2 type variables and a concrete model `Model[str, int]`,<br>
|
| 1040 |
-
the value `(str, int)` would be passed to `params`.<br>
|
| 1041 |
-
<br>
|
| 1042 |
-
Returns:<br>
|
| 1043 |
-
String representing the new class where `params` are passed to `cls` as type variables.<br>
|
| 1044 |
-
<br>
|
| 1045 |
-
Raises:<br>
|
| 1046 |
-
TypeError: Raised when trying to generate concrete names for non-generic models.</span></dd></dl>
|
| 1047 |
-
|
| 1048 |
-
<dl><dt><a name="ModelResponse-model_rebuild"><strong>model_rebuild</strong></a>(
|
| 1049 |
-
*,
|
| 1050 |
-
force: 'bool' = False,
|
| 1051 |
-
raise_errors: 'bool' = True,
|
| 1052 |
-
_parent_namespace_depth: 'int' = 2,
|
| 1053 |
-
_types_namespace: 'MappingNamespace | None' = None
|
| 1054 |
-
) -> 'bool | None'</dt><dd><span class="code">Try to rebuild the pydantic-core schema for the model.<br>
|
| 1055 |
-
<br>
|
| 1056 |
-
This may be necessary when one of the annotations is a ForwardRef which could not be resolved during<br>
|
| 1057 |
-
the initial attempt to build the schema, and automatic rebuilding fails.<br>
|
| 1058 |
-
<br>
|
| 1059 |
-
Args:<br>
|
| 1060 |
-
force: Whether to force the rebuilding of the model schema, defaults to `False`.<br>
|
| 1061 |
-
raise_errors: Whether to raise errors, defaults to `True`.<br>
|
| 1062 |
-
_parent_namespace_depth: The depth level of the parent namespace, defaults to 2.<br>
|
| 1063 |
-
_types_namespace: The types namespace, defaults to `None`.<br>
|
| 1064 |
-
<br>
|
| 1065 |
-
Returns:<br>
|
| 1066 |
-
Returns `None` if the schema is already "complete" and rebuilding was not required.<br>
|
| 1067 |
-
If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`.</span></dd></dl>
|
| 1068 |
-
|
| 1069 |
-
<dl><dt><a name="ModelResponse-model_validate"><strong>model_validate</strong></a>(
|
| 1070 |
-
obj: 'Any',
|
| 1071 |
-
*,
|
| 1072 |
-
strict: 'bool | None' = None,
|
| 1073 |
-
extra: 'ExtraValues | None' = None,
|
| 1074 |
-
from_attributes: 'bool | None' = None,
|
| 1075 |
-
context: 'Any | None' = None,
|
| 1076 |
-
by_alias: 'bool | None' = None,
|
| 1077 |
-
by_name: 'bool | None' = None
|
| 1078 |
-
) -> 'Self'</dt><dd><span class="code">Validate a pydantic model instance.<br>
|
| 1079 |
-
<br>
|
| 1080 |
-
Args:<br>
|
| 1081 |
-
obj: The object to validate.<br>
|
| 1082 |
-
strict: Whether to enforce types strictly.<br>
|
| 1083 |
-
extra: Whether to ignore, allow, or forbid extra data during model validation.<br>
|
| 1084 |
-
See the [`extra` configuration value][pydantic.ConfigDict.extra] for details.<br>
|
| 1085 |
-
from_attributes: Whether to extract data from object attributes.<br>
|
| 1086 |
-
context: Additional context to pass to the validator.<br>
|
| 1087 |
-
by_alias: Whether to use the field's alias when validating against the provided input data.<br>
|
| 1088 |
-
by_name: Whether to use the field's name when validating against the provided input data.<br>
|
| 1089 |
-
<br>
|
| 1090 |
-
Raises:<br>
|
| 1091 |
-
ValidationError: If the object could not be validated.<br>
|
| 1092 |
-
<br>
|
| 1093 |
-
Returns:<br>
|
| 1094 |
-
The validated model instance.</span></dd></dl>
|
| 1095 |
-
|
| 1096 |
-
<dl><dt><a name="ModelResponse-model_validate_json"><strong>model_validate_json</strong></a>(
|
| 1097 |
-
json_data: 'str | bytes | bytearray',
|
| 1098 |
-
*,
|
| 1099 |
-
strict: 'bool | None' = None,
|
| 1100 |
-
extra: 'ExtraValues | None' = None,
|
| 1101 |
-
context: 'Any | None' = None,
|
| 1102 |
-
by_alias: 'bool | None' = None,
|
| 1103 |
-
by_name: 'bool | None' = None
|
| 1104 |
-
) -> 'Self'</dt><dd><span class="code">!!! abstract "Usage Documentation"<br>
|
| 1105 |
-
[JSON Parsing](../concepts/json.md#json-parsing)<br>
|
| 1106 |
-
<br>
|
| 1107 |
-
Validate the given JSON data against the Pydantic model.<br>
|
| 1108 |
-
<br>
|
| 1109 |
-
Args:<br>
|
| 1110 |
-
json_data: The JSON data to validate.<br>
|
| 1111 |
-
strict: Whether to enforce types strictly.<br>
|
| 1112 |
-
extra: Whether to ignore, allow, or forbid extra data during model validation.<br>
|
| 1113 |
-
See the [`extra` configuration value][pydantic.ConfigDict.extra] for details.<br>
|
| 1114 |
-
context: Extra variables to pass to the validator.<br>
|
| 1115 |
-
by_alias: Whether to use the field's alias when validating against the provided input data.<br>
|
| 1116 |
-
by_name: Whether to use the field's name when validating against the provided input data.<br>
|
| 1117 |
-
<br>
|
| 1118 |
-
Returns:<br>
|
| 1119 |
-
The validated Pydantic model.<br>
|
| 1120 |
-
<br>
|
| 1121 |
-
Raises:<br>
|
| 1122 |
-
ValidationError: If `json_data` is not a JSON string or the object could not be validated.</span></dd></dl>
|
| 1123 |
-
|
| 1124 |
-
<dl><dt><a name="ModelResponse-model_validate_strings"><strong>model_validate_strings</strong></a>(
|
| 1125 |
-
obj: 'Any',
|
| 1126 |
-
*,
|
| 1127 |
-
strict: 'bool | None' = None,
|
| 1128 |
-
extra: 'ExtraValues | None' = None,
|
| 1129 |
-
context: 'Any | None' = None,
|
| 1130 |
-
by_alias: 'bool | None' = None,
|
| 1131 |
-
by_name: 'bool | None' = None
|
| 1132 |
-
) -> 'Self'</dt><dd><span class="code">Validate the given object with string data against the Pydantic model.<br>
|
| 1133 |
-
<br>
|
| 1134 |
-
Args:<br>
|
| 1135 |
-
obj: The object containing string data to validate.<br>
|
| 1136 |
-
strict: Whether to enforce types strictly.<br>
|
| 1137 |
-
extra: Whether to ignore, allow, or forbid extra data during model validation.<br>
|
| 1138 |
-
See the [`extra` configuration value][pydantic.ConfigDict.extra] for details.<br>
|
| 1139 |
-
context: Extra variables to pass to the validator.<br>
|
| 1140 |
-
by_alias: Whether to use the field's alias when validating against the provided input data.<br>
|
| 1141 |
-
by_name: Whether to use the field's name when validating against the provided input data.<br>
|
| 1142 |
-
<br>
|
| 1143 |
-
Returns:<br>
|
| 1144 |
-
The validated Pydantic model.</span></dd></dl>
|
| 1145 |
-
|
| 1146 |
-
<dl><dt><a name="ModelResponse-parse_file"><strong>parse_file</strong></a>(
|
| 1147 |
-
path: 'str | Path',
|
| 1148 |
-
*,
|
| 1149 |
-
content_type: 'str | None' = None,
|
| 1150 |
-
encoding: 'str' = 'utf8',
|
| 1151 |
-
proto: 'DeprecatedParseProtocol | None' = None,
|
| 1152 |
-
allow_pickle: 'bool' = False
|
| 1153 |
-
) -> 'Self'</dt></dl>
|
| 1154 |
-
|
| 1155 |
-
<dl><dt><a name="ModelResponse-parse_obj"><strong>parse_obj</strong></a>(obj: 'Any') -> 'Self'</dt></dl>
|
| 1156 |
-
|
| 1157 |
-
<dl><dt><a name="ModelResponse-parse_raw"><strong>parse_raw</strong></a>(
|
| 1158 |
-
b: 'str | bytes',
|
| 1159 |
-
*,
|
| 1160 |
-
content_type: 'str | None' = None,
|
| 1161 |
-
encoding: 'str' = 'utf8',
|
| 1162 |
-
proto: 'DeprecatedParseProtocol | None' = None,
|
| 1163 |
-
allow_pickle: 'bool' = False
|
| 1164 |
-
) -> 'Self'</dt></dl>
|
| 1165 |
-
|
| 1166 |
-
<dl><dt><a name="ModelResponse-schema"><strong>schema</strong></a>(by_alias: 'bool' = True, ref_template: 'str' = '#/$defs/{model}') -> 'Dict[str, Any]'</dt></dl>
|
| 1167 |
-
|
| 1168 |
-
<dl><dt><a name="ModelResponse-schema_json"><strong>schema_json</strong></a>(
|
| 1169 |
-
*,
|
| 1170 |
-
by_alias: 'bool' = True,
|
| 1171 |
-
ref_template: 'str' = '#/$defs/{model}',
|
| 1172 |
-
**dumps_kwargs: 'Any'
|
| 1173 |
-
) -> 'str'</dt></dl>
|
| 1174 |
-
|
| 1175 |
-
<dl><dt><a name="ModelResponse-update_forward_refs"><strong>update_forward_refs</strong></a>(**localns: 'Any') -> 'None'</dt></dl>
|
| 1176 |
-
|
| 1177 |
-
<dl><dt><a name="ModelResponse-validate"><strong>validate</strong></a>(value: 'Any') -> 'Self'</dt></dl>
|
| 1178 |
-
|
| 1179 |
-
<hr>
|
| 1180 |
-
Readonly properties inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 1181 |
-
<dl><dt><strong>__fields_set__</strong></dt>
|
| 1182 |
-
</dl>
|
| 1183 |
-
<dl><dt><strong>model_extra</strong></dt>
|
| 1184 |
-
<dd><span class="code">Get extra fields set during validation.<br>
|
| 1185 |
-
<br>
|
| 1186 |
-
Returns:<br>
|
| 1187 |
-
A dictionary of extra fields, or `None` if `config.extra` is not set to `"allow"`.</span></dd>
|
| 1188 |
-
</dl>
|
| 1189 |
-
<dl><dt><strong>model_fields_set</strong></dt>
|
| 1190 |
-
<dd><span class="code">Returns the set of fields that have been explicitly set on this model instance.<br>
|
| 1191 |
-
<br>
|
| 1192 |
-
Returns:<br>
|
| 1193 |
-
A set of strings representing the fields that have been set,<br>
|
| 1194 |
-
i.e. that were not filled from defaults.</span></dd>
|
| 1195 |
-
</dl>
|
| 1196 |
-
<hr>
|
| 1197 |
-
Data descriptors inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 1198 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 1199 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 1200 |
-
</dl>
|
| 1201 |
-
<dl><dt><strong>__pydantic_extra__</strong></dt>
|
| 1202 |
-
</dl>
|
| 1203 |
-
<dl><dt><strong>__pydantic_fields_set__</strong></dt>
|
| 1204 |
-
</dl>
|
| 1205 |
-
<dl><dt><strong>__pydantic_private__</strong></dt>
|
| 1206 |
-
</dl>
|
| 1207 |
-
<hr>
|
| 1208 |
-
Data and other attributes inherited from <a href="pydantic.main.html#BaseModel">pydantic.main.BaseModel</a>:<br>
|
| 1209 |
-
<dl><dt><strong>__hash__</strong> = None</dl>
|
| 1210 |
-
|
| 1211 |
-
<dl><dt><strong>__pydantic_root_model__</strong> = False</dl>
|
| 1212 |
-
|
| 1213 |
-
<dl><dt><strong>model_computed_fields</strong> = {}</dl>
|
| 1214 |
-
|
| 1215 |
-
<dl><dt><strong>model_fields</strong> = {'employee_id': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'turnover_probability': FieldInfo(annotation=float, required=True), 'will_leave': FieldInfo(annotation=bool, required=True)}</dl>
|
| 1216 |
-
|
| 1217 |
-
</td></tr></table></td></tr></table><p>
|
| 1218 |
-
<table class="section">
|
| 1219 |
-
<tr class="decor data-decor heading-text">
|
| 1220 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Data</strong></td></tr>
|
| 1221 |
-
|
| 1222 |
-
<tr><td class="decor data-decor"><span class="code"> </span></td><td> </td>
|
| 1223 |
-
<td class="singlecolumn"><strong>Literal</strong> = typing.Literal<br>
|
| 1224 |
-
<strong>Optional</strong> = typing.Optional</td></tr></table>
|
| 1225 |
-
</body></html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/index.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Welcome to MkDocs
|
| 2 |
+
|
| 3 |
+
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
|
| 4 |
+
|
| 5 |
+
## Commands
|
| 6 |
+
|
| 7 |
+
* `mkdocs new [dir-name]` - Create a new project.
|
| 8 |
+
* `mkdocs serve` - Start the live-reloading docs server.
|
| 9 |
+
* `mkdocs build` - Build the documentation site.
|
| 10 |
+
* `mkdocs -h` - Print help message and exit.
|
| 11 |
+
|
| 12 |
+
## Project layout
|
| 13 |
+
|
| 14 |
+
mkdocs.yml # The configuration file.
|
| 15 |
+
docs/
|
| 16 |
+
index.md # The documentation homepage.
|
| 17 |
+
... # Other markdown pages, images and other files.
|
docs/init_base/database.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.database
|
| 2 |
+
|
| 3 |
+
::: app.database
|
docs/securite/security.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.security
|
| 2 |
+
|
| 3 |
+
::: app.security
|
docs/service.technova_service.html
DELETED
|
@@ -1,66 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="utf-8">
|
| 5 |
-
<title>Python: module service.technova_service</title>
|
| 6 |
-
</head><body>
|
| 7 |
-
|
| 8 |
-
<table class="heading">
|
| 9 |
-
<tr class="heading-text decor">
|
| 10 |
-
<td class="title"> <br><strong class="title"><a href="service.html" class="white">service</a>.technova_service</strong></td>
|
| 11 |
-
<td class="extra"><a href=".">index</a><br><a href="file:c%3A%5Cusers%5Cgonza%5Copenclassroom%5Cprojet_4_classification%5Cprojet_technova_partners%5Cservice%5Ctechnova_service.py">c:\users\gonza\openclassroom\projet_4_classification\projet_technova_partners\service\technova_service.py</a></td></tr></table>
|
| 12 |
-
<p></p>
|
| 13 |
-
<p>
|
| 14 |
-
<table class="section">
|
| 15 |
-
<tr class="decor pkg-content-decor heading-text">
|
| 16 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Modules</strong></td></tr>
|
| 17 |
-
|
| 18 |
-
<tr><td class="decor pkg-content-decor"><span class="code"> </span></td><td> </td>
|
| 19 |
-
<td class="singlecolumn"><table><tr><td class="multicolumn"><a href="joblib.html">joblib</a><br>
|
| 20 |
-
</td><td class="multicolumn"><a href="json.html">json</a><br>
|
| 21 |
-
</td><td class="multicolumn"><a href="pandas.html">pandas</a><br>
|
| 22 |
-
</td><td class="multicolumn"></td></tr></table></td></tr></table><p>
|
| 23 |
-
<table class="section">
|
| 24 |
-
<tr class="decor index-decor heading-text">
|
| 25 |
-
<td class="section-title" colspan=3> <br><strong class="bigsection">Classes</strong></td></tr>
|
| 26 |
-
|
| 27 |
-
<tr><td class="decor index-decor"><span class="code"> </span></td><td> </td>
|
| 28 |
-
<td class="singlecolumn"><dl>
|
| 29 |
-
<dt class="heading-text"><a href="builtins.html#object">builtins.object</a>
|
| 30 |
-
</dt><dd>
|
| 31 |
-
<dl>
|
| 32 |
-
<dt class="heading-text"><a href="service.technova_service.html#TechNovaService">TechNovaService</a>
|
| 33 |
-
</dt></dl>
|
| 34 |
-
</dd>
|
| 35 |
-
</dl>
|
| 36 |
-
<p>
|
| 37 |
-
<table class="section">
|
| 38 |
-
<tr class="decor title-decor heading-text">
|
| 39 |
-
<td class="section-title" colspan=3> <br><a name="TechNovaService">class <strong>TechNovaService</strong></a>(<a href="builtins.html#object">builtins.object</a>)</td></tr>
|
| 40 |
-
|
| 41 |
-
<tr><td class="decor title-decor" rowspan=2><span class="code"> </span></td>
|
| 42 |
-
<td class="decor title-decor" colspan=2><span class="code"><a href="#TechNovaService">TechNovaService</a>() -&gt; 'None'<br>
|
| 43 |
-
<br>
|
| 44 |
-
<br> </span></td></tr>
|
| 45 |
-
<tr><td> </td>
|
| 46 |
-
<td class="singlecolumn">Methods defined here:<br>
|
| 47 |
-
<dl><dt><a name="TechNovaService-__init__"><strong>__init__</strong></a>(self) -> 'None'</dt><dd><span class="code">Initialize self. See help(type(self)) for accurate signature.</span></dd></dl>
|
| 48 |
-
|
| 49 |
-
<dl><dt><a name="TechNovaService-adapt_input"><strong>adapt_input</strong></a>(self, request: 'ModelRequest') -> 'pd.DataFrame'</dt><dd><span class="code"># ---------- Payload ----------</span></dd></dl>
|
| 50 |
-
|
| 51 |
-
<dl><dt><a name="TechNovaService-fetch_latest_clean_row"><strong>fetch_latest_clean_row</strong></a>(self, db: 'Session', employee_id: 'int') -> 'dict[str, Any] | None'</dt><dd><span class="code"># ---------- Clean fetch (isolé pour tests / mocks) ----------</span></dd></dl>
|
| 52 |
-
|
| 53 |
-
<dl><dt><a name="TechNovaService-predict_from_clean"><strong>predict_from_clean</strong></a>(self, db: 'Session', employee_id: 'int') -> 'ModelResponse'</dt><dd><span class="code"># ---------- Predict from clean ----------</span></dd></dl>
|
| 54 |
-
|
| 55 |
-
<dl><dt><a name="TechNovaService-predict_from_payload"><strong>predict_from_payload</strong></a>(self, request: 'ModelRequest') -> 'ModelResponse'</dt></dl>
|
| 56 |
-
|
| 57 |
-
<hr>
|
| 58 |
-
Data descriptors defined here:<br>
|
| 59 |
-
<dl><dt><strong>__dict__</strong></dt>
|
| 60 |
-
<dd><span class="code">dictionary for instance variables</span></dd>
|
| 61 |
-
</dl>
|
| 62 |
-
<dl><dt><strong>__weakref__</strong></dt>
|
| 63 |
-
<dd><span class="code">list of weak references to the object</span></dd>
|
| 64 |
-
</dl>
|
| 65 |
-
</td></tr></table></td></tr></table>
|
| 66 |
-
</body></html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
domain/domain.py
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
from typing import Literal, Optional
|
|
@@ -7,6 +24,31 @@ from pydantic import BaseModel
|
|
| 7 |
|
| 8 |
# Modèles de données pour les requêtes et réponses de l'API, utilisés pour la validation des données d'entrée et de sortie.
|
| 9 |
class ModelRequest(BaseModel):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
note_evaluation_precedente: int
|
| 11 |
niveau_hierarchique_poste: int
|
| 12 |
note_evaluation_actuelle: int
|
|
@@ -42,6 +84,31 @@ class ModelRequest(BaseModel):
|
|
| 42 |
|
| 43 |
# Le modèle de réponse inclut la probabilité de départ et la classe prédite (will_leave), ainsi que l'employee_id si disponible.
|
| 44 |
class ModelResponse(BaseModel):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
employee_id: Optional[int] = None
|
| 46 |
turnover_probability: float
|
| 47 |
will_leave: bool
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Schémas Pydantic partagés (API + dashboard) pour le projet TechNova Partners.
|
| 3 |
+
|
| 4 |
+
Ce module définit les modèles de données utilisés pour :
|
| 5 |
+
- valider les entrées de l'API (payload de prédiction),
|
| 6 |
+
- standardiser les sorties de l'API (réponse de prédiction),
|
| 7 |
+
- partager une "source de vérité" côté types entre FastAPI et Streamlit.
|
| 8 |
+
|
| 9 |
+
Pourquoi Pydantic ?
|
| 10 |
+
- Pydantic vérifie automatiquement les types (int, float, str…)
|
| 11 |
+
- Il rejette les payloads invalides (erreurs 422 côté FastAPI)
|
| 12 |
+
- Il documente l'API via OpenAPI/Swagger (schéma JSON généré)
|
| 13 |
+
|
| 14 |
+
Conventions
|
| 15 |
+
- Les variables catégorielles binaires sont encodées en 0/1 (ex: genre, heures_supplementaires).
|
| 16 |
+
- Certaines variables sont limitées par des `Literal[...]` pour éviter les valeurs hors domaine.
|
| 17 |
+
"""
|
| 18 |
from __future__ import annotations
|
| 19 |
|
| 20 |
from typing import Literal, Optional
|
|
|
|
| 24 |
|
| 25 |
# Modèles de données pour les requêtes et réponses de l'API, utilisés pour la validation des données d'entrée et de sortie.
|
| 26 |
class ModelRequest(BaseModel):
|
| 27 |
+
"""
|
| 28 |
+
Schéma d'entrée pour une prédiction "par features" (mode scoring direct).
|
| 29 |
+
|
| 30 |
+
Ce modèle représente **exactement** l'ensemble des features attendues par le modèle ML,
|
| 31 |
+
dans le bon type. Il est utilisé par FastAPI pour valider le JSON reçu sur l'endpoint
|
| 32 |
+
`/predict/by-features`.
|
| 33 |
+
|
| 34 |
+
Points importants
|
| 35 |
+
-----------------
|
| 36 |
+
- Aucune étape de preprocessing n'est faite ici.
|
| 37 |
+
Le payload doit déjà être "propre" et au format attendu.
|
| 38 |
+
- Les champs en `Literal[...]` restreignent volontairement les valeurs autorisées
|
| 39 |
+
(ex: 0/1 pour un booléen encodé, ou 0..3 pour une fréquence).
|
| 40 |
+
|
| 41 |
+
Effet côté API
|
| 42 |
+
--------------
|
| 43 |
+
- Si un champ manque, ou si un type/valeur est invalide, FastAPI renvoie une erreur 422.
|
| 44 |
+
- Le schéma apparaît automatiquement dans Swagger (/docs).
|
| 45 |
+
|
| 46 |
+
Notes
|
| 47 |
+
-----
|
| 48 |
+
- Les variables catégorielles (ex: statut_marital, departement, poste, domaine_etude)
|
| 49 |
+
sont des chaînes. Le pipeline du modèle doit savoir les gérer (encodage/OneHot etc.)
|
| 50 |
+
ou attendre des valeurs déjà compatibles.
|
| 51 |
+
"""
|
| 52 |
note_evaluation_precedente: int
|
| 53 |
niveau_hierarchique_poste: int
|
| 54 |
note_evaluation_actuelle: int
|
|
|
|
| 84 |
|
| 85 |
# Le modèle de réponse inclut la probabilité de départ et la classe prédite (will_leave), ainsi que l'employee_id si disponible.
|
| 86 |
class ModelResponse(BaseModel):
|
| 87 |
+
"""
|
| 88 |
+
Schéma de sortie standard pour une prédiction.
|
| 89 |
+
|
| 90 |
+
Ce modèle est renvoyé par les endpoints de prédiction (`/predict/by-id` et `/predict/by-features`).
|
| 91 |
+
|
| 92 |
+
Champs
|
| 93 |
+
------
|
| 94 |
+
employee_id : int | None
|
| 95 |
+
Identifiant de l'employé si la prédiction est faite "par ID".
|
| 96 |
+
`None` si la prédiction est faite "par features" (pas d'employé en base).
|
| 97 |
+
turnover_probability : float
|
| 98 |
+
Probabilité estimée que l'employé quitte l'entreprise (classe positive).
|
| 99 |
+
Valeur attendue entre 0 et 1.
|
| 100 |
+
will_leave : bool
|
| 101 |
+
Décision binaire calculée en comparant `turnover_probability` à un seuil (`threshold`).
|
| 102 |
+
True = départ prédit, False = non-départ prédit.
|
| 103 |
+
|
| 104 |
+
Exemple
|
| 105 |
+
-------
|
| 106 |
+
{
|
| 107 |
+
"employee_id": 123,
|
| 108 |
+
"turnover_probability": 0.78,
|
| 109 |
+
"will_leave": true
|
| 110 |
+
}
|
| 111 |
+
"""
|
| 112 |
employee_id: Optional[int] = None
|
| 113 |
turnover_probability: float
|
| 114 |
will_leave: bool
|
mkdocs.yml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
site_name: TechNova Partners – ML Deployment
|
| 2 |
+
site_description: Déploiement d’un modèle de Machine Learning avec FastAPI et PostgreSQL
|
| 3 |
+
site_author: Stéphane Gonzalez
|
| 4 |
+
|
| 5 |
+
theme:
|
| 6 |
+
name: material
|
| 7 |
+
language: fr
|
| 8 |
+
palette:
|
| 9 |
+
primary: teal
|
| 10 |
+
accent: cyan
|
| 11 |
+
|
| 12 |
+
plugins:
|
| 13 |
+
- search
|
| 14 |
+
- mkdocstrings:
|
| 15 |
+
handlers:
|
| 16 |
+
python:
|
| 17 |
+
paths: [.]
|
| 18 |
+
|
| 19 |
+
nav:
|
| 20 |
+
- Accueil: index.md
|
| 21 |
+
- API:
|
| 22 |
+
- app.api: api_reference/app_api.md
|
| 23 |
+
- app.models: api_reference/app_models.md
|
| 24 |
+
- domain.domain: api_reference/domain.md
|
| 25 |
+
- technova_service: api_reference/technova_service.md
|
| 26 |
+
- Base de données: init_base/database.md
|
| 27 |
+
- Sécurité: securite/security.md
|
| 28 |
+
|
| 29 |
+
markdown_extensions:
|
| 30 |
+
- admonition
|
| 31 |
+
- toc:
|
| 32 |
+
permalink: true
|
| 33 |
+
- pymdownx.superfences
|
poetry.lock
CHANGED
|
@@ -108,6 +108,41 @@ files = [
|
|
| 108 |
{file = "attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11"},
|
| 109 |
]
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
[[package]]
|
| 112 |
name = "blinker"
|
| 113 |
version = "1.9.0"
|
|
@@ -248,7 +283,7 @@ version = "3.4.4"
|
|
| 248 |
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
|
| 249 |
optional = false
|
| 250 |
python-versions = ">=3.7"
|
| 251 |
-
groups = ["main"]
|
| 252 |
files = [
|
| 253 |
{file = "charset_normalizer-3.4.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e824f1492727fa856dd6eda4f7cee25f8518a12f3c4a56a74e8095695089cf6d"},
|
| 254 |
{file = "charset_normalizer-3.4.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4bd5d4137d500351a30687c2d3971758aac9a19208fc110ccb9d7188fbe709e8"},
|
|
@@ -371,7 +406,7 @@ version = "8.3.1"
|
|
| 371 |
description = "Composable command line interface toolkit"
|
| 372 |
optional = false
|
| 373 |
python-versions = ">=3.10"
|
| 374 |
-
groups = ["main"]
|
| 375 |
files = [
|
| 376 |
{file = "click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6"},
|
| 377 |
{file = "click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a"},
|
|
@@ -403,7 +438,7 @@ files = [
|
|
| 403 |
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
| 404 |
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
| 405 |
]
|
| 406 |
-
markers = {main = "platform_system == \"Windows\""
|
| 407 |
|
| 408 |
[[package]]
|
| 409 |
name = "comm"
|
|
@@ -848,6 +883,24 @@ test-downstream = ["aiobotocore (>=2.5.4,<3.0.0)", "dask[dataframe,test]", "moto
|
|
| 848 |
test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "backports-zstd ; python_version < \"3.14\"", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas (<3.0.0)", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr", "zstandard ; python_version < \"3.14\""]
|
| 849 |
tqdm = ["tqdm"]
|
| 850 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 851 |
[[package]]
|
| 852 |
name = "gitdb"
|
| 853 |
version = "4.0.12"
|
|
@@ -945,6 +998,53 @@ files = [
|
|
| 945 |
docs = ["Sphinx", "furo"]
|
| 946 |
test = ["objgraph", "psutil", "setuptools"]
|
| 947 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 948 |
[[package]]
|
| 949 |
name = "h11"
|
| 950 |
version = "0.16.0"
|
|
@@ -1261,7 +1361,7 @@ version = "3.1.6"
|
|
| 1261 |
description = "A very fast and expressive template engine."
|
| 1262 |
optional = false
|
| 1263 |
python-versions = ">=3.7"
|
| 1264 |
-
groups = ["main"]
|
| 1265 |
files = [
|
| 1266 |
{file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"},
|
| 1267 |
{file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"},
|
|
@@ -1552,6 +1652,22 @@ files = [
|
|
| 1552 |
{file = "llvmlite-0.46.0.tar.gz", hash = "sha256:227c9fd6d09dce2783c18b754b7cd9d9b3b3515210c46acc2d3c5badd9870ceb"},
|
| 1553 |
]
|
| 1554 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1555 |
[[package]]
|
| 1556 |
name = "markdown-it-py"
|
| 1557 |
version = "4.0.0"
|
|
@@ -1582,7 +1698,7 @@ version = "3.0.3"
|
|
| 1582 |
description = "Safely add untrusted strings to HTML/XML markup."
|
| 1583 |
optional = false
|
| 1584 |
python-versions = ">=3.9"
|
| 1585 |
-
groups = ["main"]
|
| 1586 |
files = [
|
| 1587 |
{file = "markupsafe-3.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f981d352f04553a7171b8e44369f2af4055f888dfb147d55e42d29e29e74559"},
|
| 1588 |
{file = "markupsafe-3.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c1493fb6e50ab01d20a22826e57520f1284df32f2d8601fdd90b6304601419"},
|
|
@@ -1784,6 +1900,167 @@ files = [
|
|
| 1784 |
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
|
| 1785 |
]
|
| 1786 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1787 |
[[package]]
|
| 1788 |
name = "narwhals"
|
| 1789 |
version = "2.16.0"
|
|
@@ -2087,6 +2364,22 @@ files = [
|
|
| 2087 |
{file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"},
|
| 2088 |
]
|
| 2089 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2090 |
[[package]]
|
| 2091 |
name = "pandas"
|
| 2092 |
version = "2.3.3"
|
|
@@ -2199,6 +2492,24 @@ files = [
|
|
| 2199 |
qa = ["flake8 (==5.0.4)", "mypy (==0.971)", "types-setuptools (==67.2.0.1)"]
|
| 2200 |
testing = ["docopt", "pytest"]
|
| 2201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2202 |
[[package]]
|
| 2203 |
name = "pexpect"
|
| 2204 |
version = "4.9.0"
|
|
@@ -2807,6 +3118,25 @@ files = [
|
|
| 2807 |
[package.extras]
|
| 2808 |
windows-terminal = ["colorama (>=0.4.6)"]
|
| 2809 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2810 |
[[package]]
|
| 2811 |
name = "pyparsing"
|
| 2812 |
version = "3.2.5"
|
|
@@ -2912,7 +3242,7 @@ version = "6.0.3"
|
|
| 2912 |
description = "YAML parser and emitter for Python"
|
| 2913 |
optional = false
|
| 2914 |
python-versions = ">=3.8"
|
| 2915 |
-
groups = ["main"]
|
| 2916 |
files = [
|
| 2917 |
{file = "PyYAML-6.0.3-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f"},
|
| 2918 |
{file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4"},
|
|
@@ -2989,6 +3319,21 @@ files = [
|
|
| 2989 |
{file = "pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f"},
|
| 2990 |
]
|
| 2991 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2992 |
[[package]]
|
| 2993 |
name = "pyzmq"
|
| 2994 |
version = "27.1.0"
|
|
@@ -3116,7 +3461,7 @@ version = "2.32.5"
|
|
| 3116 |
description = "Python HTTP for Humans."
|
| 3117 |
optional = false
|
| 3118 |
python-versions = ">=3.9"
|
| 3119 |
-
groups = ["main"]
|
| 3120 |
files = [
|
| 3121 |
{file = "requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6"},
|
| 3122 |
{file = "requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf"},
|
|
@@ -3932,7 +4277,7 @@ version = "2.6.3"
|
|
| 3932 |
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
| 3933 |
optional = false
|
| 3934 |
python-versions = ">=3.9"
|
| 3935 |
-
groups = ["main"]
|
| 3936 |
files = [
|
| 3937 |
{file = "urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4"},
|
| 3938 |
{file = "urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed"},
|
|
@@ -3969,8 +4314,7 @@ version = "6.0.0"
|
|
| 3969 |
description = "Filesystem events monitoring"
|
| 3970 |
optional = false
|
| 3971 |
python-versions = ">=3.9"
|
| 3972 |
-
groups = ["main"]
|
| 3973 |
-
markers = "platform_system != \"Darwin\""
|
| 3974 |
files = [
|
| 3975 |
{file = "watchdog-6.0.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d1cdb490583ebd691c012b3d6dae011000fe42edb7a82ece80965b42abd61f26"},
|
| 3976 |
{file = "watchdog-6.0.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bc64ab3bdb6a04d69d4023b29422170b74681784ffb9463ed4870cf2f3e66112"},
|
|
@@ -4003,6 +4347,7 @@ files = [
|
|
| 4003 |
{file = "watchdog-6.0.0-py3-none-win_ia64.whl", hash = "sha256:a1914259fa9e1454315171103c6a30961236f508b9b623eae470268bbcc6a22f"},
|
| 4004 |
{file = "watchdog-6.0.0.tar.gz", hash = "sha256:9ddf7c82fda3ae8e24decda1338ede66e1c99883db93711d8fb941eaa2d8c282"},
|
| 4005 |
]
|
|
|
|
| 4006 |
|
| 4007 |
[package.extras]
|
| 4008 |
watchmedo = ["PyYAML (>=3.10)"]
|
|
@@ -4062,4 +4407,4 @@ scikit-learn = ["scikit-learn"]
|
|
| 4062 |
[metadata]
|
| 4063 |
lock-version = "2.1"
|
| 4064 |
python-versions = "^3.13"
|
| 4065 |
-
content-hash = "
|
|
|
|
| 108 |
{file = "attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11"},
|
| 109 |
]
|
| 110 |
|
| 111 |
+
[[package]]
|
| 112 |
+
name = "babel"
|
| 113 |
+
version = "2.18.0"
|
| 114 |
+
description = "Internationalization utilities"
|
| 115 |
+
optional = false
|
| 116 |
+
python-versions = ">=3.8"
|
| 117 |
+
groups = ["dev"]
|
| 118 |
+
files = [
|
| 119 |
+
{file = "babel-2.18.0-py3-none-any.whl", hash = "sha256:e2b422b277c2b9a9630c1d7903c2a00d0830c409c59ac8cae9081c92f1aeba35"},
|
| 120 |
+
{file = "babel-2.18.0.tar.gz", hash = "sha256:b80b99a14bd085fcacfa15c9165f651fbb3406e66cc603abf11c5750937c992d"},
|
| 121 |
+
]
|
| 122 |
+
|
| 123 |
+
[package.extras]
|
| 124 |
+
dev = ["backports.zoneinfo ; python_version < \"3.9\"", "freezegun (>=1.0,<2.0)", "jinja2 (>=3.0)", "pytest (>=6.0)", "pytest-cov", "pytz", "setuptools", "tzdata ; sys_platform == \"win32\""]
|
| 125 |
+
|
| 126 |
+
[[package]]
|
| 127 |
+
name = "backrefs"
|
| 128 |
+
version = "6.1"
|
| 129 |
+
description = "A wrapper around re and regex that adds additional back references."
|
| 130 |
+
optional = false
|
| 131 |
+
python-versions = ">=3.9"
|
| 132 |
+
groups = ["dev"]
|
| 133 |
+
files = [
|
| 134 |
+
{file = "backrefs-6.1-py310-none-any.whl", hash = "sha256:2a2ccb96302337ce61ee4717ceacfbf26ba4efb1d55af86564b8bbaeda39cac1"},
|
| 135 |
+
{file = "backrefs-6.1-py311-none-any.whl", hash = "sha256:e82bba3875ee4430f4de4b6db19429a27275d95a5f3773c57e9e18abc23fd2b7"},
|
| 136 |
+
{file = "backrefs-6.1-py312-none-any.whl", hash = "sha256:c64698c8d2269343d88947c0735cb4b78745bd3ba590e10313fbf3f78c34da5a"},
|
| 137 |
+
{file = "backrefs-6.1-py313-none-any.whl", hash = "sha256:4c9d3dc1e2e558965202c012304f33d4e0e477e1c103663fd2c3cc9bb18b0d05"},
|
| 138 |
+
{file = "backrefs-6.1-py314-none-any.whl", hash = "sha256:13eafbc9ccd5222e9c1f0bec563e6d2a6d21514962f11e7fc79872fd56cbc853"},
|
| 139 |
+
{file = "backrefs-6.1-py39-none-any.whl", hash = "sha256:a9e99b8a4867852cad177a6430e31b0f6e495d65f8c6c134b68c14c3c95bf4b0"},
|
| 140 |
+
{file = "backrefs-6.1.tar.gz", hash = "sha256:3bba1749aafe1db9b915f00e0dd166cba613b6f788ffd63060ac3485dc9be231"},
|
| 141 |
+
]
|
| 142 |
+
|
| 143 |
+
[package.extras]
|
| 144 |
+
extras = ["regex"]
|
| 145 |
+
|
| 146 |
[[package]]
|
| 147 |
name = "blinker"
|
| 148 |
version = "1.9.0"
|
|
|
|
| 283 |
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
|
| 284 |
optional = false
|
| 285 |
python-versions = ">=3.7"
|
| 286 |
+
groups = ["main", "dev"]
|
| 287 |
files = [
|
| 288 |
{file = "charset_normalizer-3.4.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e824f1492727fa856dd6eda4f7cee25f8518a12f3c4a56a74e8095695089cf6d"},
|
| 289 |
{file = "charset_normalizer-3.4.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4bd5d4137d500351a30687c2d3971758aac9a19208fc110ccb9d7188fbe709e8"},
|
|
|
|
| 406 |
description = "Composable command line interface toolkit"
|
| 407 |
optional = false
|
| 408 |
python-versions = ">=3.10"
|
| 409 |
+
groups = ["main", "dev"]
|
| 410 |
files = [
|
| 411 |
{file = "click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6"},
|
| 412 |
{file = "click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a"},
|
|
|
|
| 438 |
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
| 439 |
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
| 440 |
]
|
| 441 |
+
markers = {main = "platform_system == \"Windows\""}
|
| 442 |
|
| 443 |
[[package]]
|
| 444 |
name = "comm"
|
|
|
|
| 883 |
test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "backports-zstd ; python_version < \"3.14\"", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas (<3.0.0)", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr", "zstandard ; python_version < \"3.14\""]
|
| 884 |
tqdm = ["tqdm"]
|
| 885 |
|
| 886 |
+
[[package]]
|
| 887 |
+
name = "ghp-import"
|
| 888 |
+
version = "2.1.0"
|
| 889 |
+
description = "Copy your docs directly to the gh-pages branch."
|
| 890 |
+
optional = false
|
| 891 |
+
python-versions = "*"
|
| 892 |
+
groups = ["dev"]
|
| 893 |
+
files = [
|
| 894 |
+
{file = "ghp-import-2.1.0.tar.gz", hash = "sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343"},
|
| 895 |
+
{file = "ghp_import-2.1.0-py3-none-any.whl", hash = "sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619"},
|
| 896 |
+
]
|
| 897 |
+
|
| 898 |
+
[package.dependencies]
|
| 899 |
+
python-dateutil = ">=2.8.1"
|
| 900 |
+
|
| 901 |
+
[package.extras]
|
| 902 |
+
dev = ["flake8", "markdown", "twine", "wheel"]
|
| 903 |
+
|
| 904 |
[[package]]
|
| 905 |
name = "gitdb"
|
| 906 |
version = "4.0.12"
|
|
|
|
| 998 |
docs = ["Sphinx", "furo"]
|
| 999 |
test = ["objgraph", "psutil", "setuptools"]
|
| 1000 |
|
| 1001 |
+
[[package]]
|
| 1002 |
+
name = "griffe"
|
| 1003 |
+
version = "2.0.0"
|
| 1004 |
+
description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API."
|
| 1005 |
+
optional = false
|
| 1006 |
+
python-versions = ">=3.10"
|
| 1007 |
+
groups = ["dev"]
|
| 1008 |
+
files = [
|
| 1009 |
+
{file = "griffe-2.0.0-py3-none-any.whl", hash = "sha256:5418081135a391c3e6e757a7f3f156f1a1a746cc7b4023868ff7d5e2f9a980aa"},
|
| 1010 |
+
]
|
| 1011 |
+
|
| 1012 |
+
[package.dependencies]
|
| 1013 |
+
griffecli = "2.0.0"
|
| 1014 |
+
griffelib = "2.0.0"
|
| 1015 |
+
|
| 1016 |
+
[package.extras]
|
| 1017 |
+
pypi = ["griffelib[pypi] (==2.0.0)"]
|
| 1018 |
+
|
| 1019 |
+
[[package]]
|
| 1020 |
+
name = "griffecli"
|
| 1021 |
+
version = "2.0.0"
|
| 1022 |
+
description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API."
|
| 1023 |
+
optional = false
|
| 1024 |
+
python-versions = ">=3.10"
|
| 1025 |
+
groups = ["dev"]
|
| 1026 |
+
files = [
|
| 1027 |
+
{file = "griffecli-2.0.0-py3-none-any.whl", hash = "sha256:9f7cd9ee9b21d55e91689358978d2385ae65c22f307a63fb3269acf3f21e643d"},
|
| 1028 |
+
]
|
| 1029 |
+
|
| 1030 |
+
[package.dependencies]
|
| 1031 |
+
colorama = ">=0.4"
|
| 1032 |
+
griffelib = "2.0.0"
|
| 1033 |
+
|
| 1034 |
+
[[package]]
|
| 1035 |
+
name = "griffelib"
|
| 1036 |
+
version = "2.0.0"
|
| 1037 |
+
description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API."
|
| 1038 |
+
optional = false
|
| 1039 |
+
python-versions = ">=3.10"
|
| 1040 |
+
groups = ["dev"]
|
| 1041 |
+
files = [
|
| 1042 |
+
{file = "griffelib-2.0.0-py3-none-any.whl", hash = "sha256:01284878c966508b6d6f1dbff9b6fa607bc062d8261c5c7253cb285b06422a7f"},
|
| 1043 |
+
]
|
| 1044 |
+
|
| 1045 |
+
[package.extras]
|
| 1046 |
+
pypi = ["pip (>=24.0)", "platformdirs (>=4.2)", "wheel (>=0.42)"]
|
| 1047 |
+
|
| 1048 |
[[package]]
|
| 1049 |
name = "h11"
|
| 1050 |
version = "0.16.0"
|
|
|
|
| 1361 |
description = "A very fast and expressive template engine."
|
| 1362 |
optional = false
|
| 1363 |
python-versions = ">=3.7"
|
| 1364 |
+
groups = ["main", "dev"]
|
| 1365 |
files = [
|
| 1366 |
{file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"},
|
| 1367 |
{file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"},
|
|
|
|
| 1652 |
{file = "llvmlite-0.46.0.tar.gz", hash = "sha256:227c9fd6d09dce2783c18b754b7cd9d9b3b3515210c46acc2d3c5badd9870ceb"},
|
| 1653 |
]
|
| 1654 |
|
| 1655 |
+
[[package]]
|
| 1656 |
+
name = "markdown"
|
| 1657 |
+
version = "3.10.2"
|
| 1658 |
+
description = "Python implementation of John Gruber's Markdown."
|
| 1659 |
+
optional = false
|
| 1660 |
+
python-versions = ">=3.10"
|
| 1661 |
+
groups = ["dev"]
|
| 1662 |
+
files = [
|
| 1663 |
+
{file = "markdown-3.10.2-py3-none-any.whl", hash = "sha256:e91464b71ae3ee7afd3017d9f358ef0baf158fd9a298db92f1d4761133824c36"},
|
| 1664 |
+
{file = "markdown-3.10.2.tar.gz", hash = "sha256:994d51325d25ad8aa7ce4ebaec003febcce822c3f8c911e3b17c52f7f589f950"},
|
| 1665 |
+
]
|
| 1666 |
+
|
| 1667 |
+
[package.extras]
|
| 1668 |
+
docs = ["mdx_gh_links (>=0.2)", "mkdocs (>=1.6)", "mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-nature (>=0.6)", "mkdocs-section-index", "mkdocstrings[python] (>=0.28.3)"]
|
| 1669 |
+
testing = ["coverage", "pyyaml"]
|
| 1670 |
+
|
| 1671 |
[[package]]
|
| 1672 |
name = "markdown-it-py"
|
| 1673 |
version = "4.0.0"
|
|
|
|
| 1698 |
description = "Safely add untrusted strings to HTML/XML markup."
|
| 1699 |
optional = false
|
| 1700 |
python-versions = ">=3.9"
|
| 1701 |
+
groups = ["main", "dev"]
|
| 1702 |
files = [
|
| 1703 |
{file = "markupsafe-3.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f981d352f04553a7171b8e44369f2af4055f888dfb147d55e42d29e29e74559"},
|
| 1704 |
{file = "markupsafe-3.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c1493fb6e50ab01d20a22826e57520f1284df32f2d8601fdd90b6304601419"},
|
|
|
|
| 1900 |
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
|
| 1901 |
]
|
| 1902 |
|
| 1903 |
+
[[package]]
|
| 1904 |
+
name = "mergedeep"
|
| 1905 |
+
version = "1.3.4"
|
| 1906 |
+
description = "A deep merge function for 🐍."
|
| 1907 |
+
optional = false
|
| 1908 |
+
python-versions = ">=3.6"
|
| 1909 |
+
groups = ["dev"]
|
| 1910 |
+
files = [
|
| 1911 |
+
{file = "mergedeep-1.3.4-py3-none-any.whl", hash = "sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307"},
|
| 1912 |
+
{file = "mergedeep-1.3.4.tar.gz", hash = "sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8"},
|
| 1913 |
+
]
|
| 1914 |
+
|
| 1915 |
+
[[package]]
|
| 1916 |
+
name = "mkdocs"
|
| 1917 |
+
version = "1.6.1"
|
| 1918 |
+
description = "Project documentation with Markdown."
|
| 1919 |
+
optional = false
|
| 1920 |
+
python-versions = ">=3.8"
|
| 1921 |
+
groups = ["dev"]
|
| 1922 |
+
files = [
|
| 1923 |
+
{file = "mkdocs-1.6.1-py3-none-any.whl", hash = "sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e"},
|
| 1924 |
+
{file = "mkdocs-1.6.1.tar.gz", hash = "sha256:7b432f01d928c084353ab39c57282f29f92136665bdd6abf7c1ec8d822ef86f2"},
|
| 1925 |
+
]
|
| 1926 |
+
|
| 1927 |
+
[package.dependencies]
|
| 1928 |
+
click = ">=7.0"
|
| 1929 |
+
colorama = {version = ">=0.4", markers = "platform_system == \"Windows\""}
|
| 1930 |
+
ghp-import = ">=1.0"
|
| 1931 |
+
jinja2 = ">=2.11.1"
|
| 1932 |
+
markdown = ">=3.3.6"
|
| 1933 |
+
markupsafe = ">=2.0.1"
|
| 1934 |
+
mergedeep = ">=1.3.4"
|
| 1935 |
+
mkdocs-get-deps = ">=0.2.0"
|
| 1936 |
+
packaging = ">=20.5"
|
| 1937 |
+
pathspec = ">=0.11.1"
|
| 1938 |
+
pyyaml = ">=5.1"
|
| 1939 |
+
pyyaml-env-tag = ">=0.1"
|
| 1940 |
+
watchdog = ">=2.0"
|
| 1941 |
+
|
| 1942 |
+
[package.extras]
|
| 1943 |
+
i18n = ["babel (>=2.9.0)"]
|
| 1944 |
+
min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4) ; platform_system == \"Windows\"", "ghp-import (==1.0)", "importlib-metadata (==4.4) ; python_version < \"3.10\"", "jinja2 (==2.11.1)", "markdown (==3.3.6)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "mkdocs-get-deps (==0.2.0)", "packaging (==20.5)", "pathspec (==0.11.1)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "watchdog (==2.0)"]
|
| 1945 |
+
|
| 1946 |
+
[[package]]
|
| 1947 |
+
name = "mkdocs-autorefs"
|
| 1948 |
+
version = "1.4.4"
|
| 1949 |
+
description = "Automatically link across pages in MkDocs."
|
| 1950 |
+
optional = false
|
| 1951 |
+
python-versions = ">=3.9"
|
| 1952 |
+
groups = ["dev"]
|
| 1953 |
+
files = [
|
| 1954 |
+
{file = "mkdocs_autorefs-1.4.4-py3-none-any.whl", hash = "sha256:834ef5408d827071ad1bc69e0f39704fa34c7fc05bc8e1c72b227dfdc5c76089"},
|
| 1955 |
+
{file = "mkdocs_autorefs-1.4.4.tar.gz", hash = "sha256:d54a284f27a7346b9c38f1f852177940c222da508e66edc816a0fa55fc6da197"},
|
| 1956 |
+
]
|
| 1957 |
+
|
| 1958 |
+
[package.dependencies]
|
| 1959 |
+
Markdown = ">=3.3"
|
| 1960 |
+
markupsafe = ">=2.0.1"
|
| 1961 |
+
mkdocs = ">=1.1"
|
| 1962 |
+
|
| 1963 |
+
[[package]]
|
| 1964 |
+
name = "mkdocs-get-deps"
|
| 1965 |
+
version = "0.2.0"
|
| 1966 |
+
description = "MkDocs extension that lists all dependencies according to a mkdocs.yml file"
|
| 1967 |
+
optional = false
|
| 1968 |
+
python-versions = ">=3.8"
|
| 1969 |
+
groups = ["dev"]
|
| 1970 |
+
files = [
|
| 1971 |
+
{file = "mkdocs_get_deps-0.2.0-py3-none-any.whl", hash = "sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134"},
|
| 1972 |
+
{file = "mkdocs_get_deps-0.2.0.tar.gz", hash = "sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c"},
|
| 1973 |
+
]
|
| 1974 |
+
|
| 1975 |
+
[package.dependencies]
|
| 1976 |
+
mergedeep = ">=1.3.4"
|
| 1977 |
+
platformdirs = ">=2.2.0"
|
| 1978 |
+
pyyaml = ">=5.1"
|
| 1979 |
+
|
| 1980 |
+
[[package]]
|
| 1981 |
+
name = "mkdocs-material"
|
| 1982 |
+
version = "9.7.1"
|
| 1983 |
+
description = "Documentation that simply works"
|
| 1984 |
+
optional = false
|
| 1985 |
+
python-versions = ">=3.8"
|
| 1986 |
+
groups = ["dev"]
|
| 1987 |
+
files = [
|
| 1988 |
+
{file = "mkdocs_material-9.7.1-py3-none-any.whl", hash = "sha256:3f6100937d7d731f87f1e3e3b021c97f7239666b9ba1151ab476cabb96c60d5c"},
|
| 1989 |
+
{file = "mkdocs_material-9.7.1.tar.gz", hash = "sha256:89601b8f2c3e6c6ee0a918cc3566cb201d40bf37c3cd3c2067e26fadb8cce2b8"},
|
| 1990 |
+
]
|
| 1991 |
+
|
| 1992 |
+
[package.dependencies]
|
| 1993 |
+
babel = ">=2.10"
|
| 1994 |
+
backrefs = ">=5.7.post1"
|
| 1995 |
+
colorama = ">=0.4"
|
| 1996 |
+
jinja2 = ">=3.1"
|
| 1997 |
+
markdown = ">=3.2"
|
| 1998 |
+
mkdocs = ">=1.6"
|
| 1999 |
+
mkdocs-material-extensions = ">=1.3"
|
| 2000 |
+
paginate = ">=0.5"
|
| 2001 |
+
pygments = ">=2.16"
|
| 2002 |
+
pymdown-extensions = ">=10.2"
|
| 2003 |
+
requests = ">=2.30"
|
| 2004 |
+
|
| 2005 |
+
[package.extras]
|
| 2006 |
+
git = ["mkdocs-git-committers-plugin-2 (>=1.1,<3)", "mkdocs-git-revision-date-localized-plugin (>=1.2.4,<2.0)"]
|
| 2007 |
+
imaging = ["cairosvg (>=2.6,<3.0)", "pillow (>=10.2,<12.0)"]
|
| 2008 |
+
recommended = ["mkdocs-minify-plugin (>=0.7,<1.0)", "mkdocs-redirects (>=1.2,<2.0)", "mkdocs-rss-plugin (>=1.6,<2.0)"]
|
| 2009 |
+
|
| 2010 |
+
[[package]]
|
| 2011 |
+
name = "mkdocs-material-extensions"
|
| 2012 |
+
version = "1.3.1"
|
| 2013 |
+
description = "Extension pack for Python Markdown and MkDocs Material."
|
| 2014 |
+
optional = false
|
| 2015 |
+
python-versions = ">=3.8"
|
| 2016 |
+
groups = ["dev"]
|
| 2017 |
+
files = [
|
| 2018 |
+
{file = "mkdocs_material_extensions-1.3.1-py3-none-any.whl", hash = "sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31"},
|
| 2019 |
+
{file = "mkdocs_material_extensions-1.3.1.tar.gz", hash = "sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443"},
|
| 2020 |
+
]
|
| 2021 |
+
|
| 2022 |
+
[[package]]
|
| 2023 |
+
name = "mkdocstrings"
|
| 2024 |
+
version = "1.0.3"
|
| 2025 |
+
description = "Automatic documentation from sources, for MkDocs."
|
| 2026 |
+
optional = false
|
| 2027 |
+
python-versions = ">=3.10"
|
| 2028 |
+
groups = ["dev"]
|
| 2029 |
+
files = [
|
| 2030 |
+
{file = "mkdocstrings-1.0.3-py3-none-any.whl", hash = "sha256:0d66d18430c2201dc7fe85134277382baaa15e6b30979f3f3bdbabd6dbdb6046"},
|
| 2031 |
+
{file = "mkdocstrings-1.0.3.tar.gz", hash = "sha256:ab670f55040722b49bb45865b2e93b824450fb4aef638b00d7acb493a9020434"},
|
| 2032 |
+
]
|
| 2033 |
+
|
| 2034 |
+
[package.dependencies]
|
| 2035 |
+
Jinja2 = ">=3.1"
|
| 2036 |
+
Markdown = ">=3.6"
|
| 2037 |
+
MarkupSafe = ">=1.1"
|
| 2038 |
+
mkdocs = ">=1.6"
|
| 2039 |
+
mkdocs-autorefs = ">=1.4"
|
| 2040 |
+
pymdown-extensions = ">=6.3"
|
| 2041 |
+
|
| 2042 |
+
[package.extras]
|
| 2043 |
+
crystal = ["mkdocstrings-crystal (>=0.3.4)"]
|
| 2044 |
+
python = ["mkdocstrings-python (>=1.16.2)"]
|
| 2045 |
+
python-legacy = ["mkdocstrings-python-legacy (>=0.2.1)"]
|
| 2046 |
+
|
| 2047 |
+
[[package]]
|
| 2048 |
+
name = "mkdocstrings-python"
|
| 2049 |
+
version = "2.0.2"
|
| 2050 |
+
description = "A Python handler for mkdocstrings."
|
| 2051 |
+
optional = false
|
| 2052 |
+
python-versions = ">=3.10"
|
| 2053 |
+
groups = ["dev"]
|
| 2054 |
+
files = [
|
| 2055 |
+
{file = "mkdocstrings_python-2.0.2-py3-none-any.whl", hash = "sha256:31241c0f43d85a69306d704d5725786015510ea3f3c4bdfdb5a5731d83cdc2b0"},
|
| 2056 |
+
{file = "mkdocstrings_python-2.0.2.tar.gz", hash = "sha256:4a32ccfc4b8d29639864698e81cfeb04137bce76bb9f3c251040f55d4b6e1ad8"},
|
| 2057 |
+
]
|
| 2058 |
+
|
| 2059 |
+
[package.dependencies]
|
| 2060 |
+
griffe = ">=1.13"
|
| 2061 |
+
mkdocs-autorefs = ">=1.4"
|
| 2062 |
+
mkdocstrings = ">=0.30"
|
| 2063 |
+
|
| 2064 |
[[package]]
|
| 2065 |
name = "narwhals"
|
| 2066 |
version = "2.16.0"
|
|
|
|
| 2364 |
{file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"},
|
| 2365 |
]
|
| 2366 |
|
| 2367 |
+
[[package]]
|
| 2368 |
+
name = "paginate"
|
| 2369 |
+
version = "0.5.7"
|
| 2370 |
+
description = "Divides large result sets into pages for easier browsing"
|
| 2371 |
+
optional = false
|
| 2372 |
+
python-versions = "*"
|
| 2373 |
+
groups = ["dev"]
|
| 2374 |
+
files = [
|
| 2375 |
+
{file = "paginate-0.5.7-py2.py3-none-any.whl", hash = "sha256:b885e2af73abcf01d9559fd5216b57ef722f8c42affbb63942377668e35c7591"},
|
| 2376 |
+
{file = "paginate-0.5.7.tar.gz", hash = "sha256:22bd083ab41e1a8b4f3690544afb2c60c25e5c9a63a30fa2f483f6c60c8e5945"},
|
| 2377 |
+
]
|
| 2378 |
+
|
| 2379 |
+
[package.extras]
|
| 2380 |
+
dev = ["pytest", "tox"]
|
| 2381 |
+
lint = ["black"]
|
| 2382 |
+
|
| 2383 |
[[package]]
|
| 2384 |
name = "pandas"
|
| 2385 |
version = "2.3.3"
|
|
|
|
| 2492 |
qa = ["flake8 (==5.0.4)", "mypy (==0.971)", "types-setuptools (==67.2.0.1)"]
|
| 2493 |
testing = ["docopt", "pytest"]
|
| 2494 |
|
| 2495 |
+
[[package]]
|
| 2496 |
+
name = "pathspec"
|
| 2497 |
+
version = "1.0.4"
|
| 2498 |
+
description = "Utility library for gitignore style pattern matching of file paths."
|
| 2499 |
+
optional = false
|
| 2500 |
+
python-versions = ">=3.9"
|
| 2501 |
+
groups = ["dev"]
|
| 2502 |
+
files = [
|
| 2503 |
+
{file = "pathspec-1.0.4-py3-none-any.whl", hash = "sha256:fb6ae2fd4e7c921a165808a552060e722767cfa526f99ca5156ed2ce45a5c723"},
|
| 2504 |
+
{file = "pathspec-1.0.4.tar.gz", hash = "sha256:0210e2ae8a21a9137c0d470578cb0e595af87edaa6ebf12ff176f14a02e0e645"},
|
| 2505 |
+
]
|
| 2506 |
+
|
| 2507 |
+
[package.extras]
|
| 2508 |
+
hyperscan = ["hyperscan (>=0.7)"]
|
| 2509 |
+
optional = ["typing-extensions (>=4)"]
|
| 2510 |
+
re2 = ["google-re2 (>=1.1)"]
|
| 2511 |
+
tests = ["pytest (>=9)", "typing-extensions (>=4.15)"]
|
| 2512 |
+
|
| 2513 |
[[package]]
|
| 2514 |
name = "pexpect"
|
| 2515 |
version = "4.9.0"
|
|
|
|
| 3118 |
[package.extras]
|
| 3119 |
windows-terminal = ["colorama (>=0.4.6)"]
|
| 3120 |
|
| 3121 |
+
[[package]]
|
| 3122 |
+
name = "pymdown-extensions"
|
| 3123 |
+
version = "10.20.1"
|
| 3124 |
+
description = "Extension pack for Python Markdown."
|
| 3125 |
+
optional = false
|
| 3126 |
+
python-versions = ">=3.9"
|
| 3127 |
+
groups = ["dev"]
|
| 3128 |
+
files = [
|
| 3129 |
+
{file = "pymdown_extensions-10.20.1-py3-none-any.whl", hash = "sha256:24af7feacbca56504b313b7b418c4f5e1317bb5fea60f03d57be7fcc40912aa0"},
|
| 3130 |
+
{file = "pymdown_extensions-10.20.1.tar.gz", hash = "sha256:e7e39c865727338d434b55f1dd8da51febcffcaebd6e1a0b9c836243f660740a"},
|
| 3131 |
+
]
|
| 3132 |
+
|
| 3133 |
+
[package.dependencies]
|
| 3134 |
+
markdown = ">=3.6"
|
| 3135 |
+
pyyaml = "*"
|
| 3136 |
+
|
| 3137 |
+
[package.extras]
|
| 3138 |
+
extra = ["pygments (>=2.19.1)"]
|
| 3139 |
+
|
| 3140 |
[[package]]
|
| 3141 |
name = "pyparsing"
|
| 3142 |
version = "3.2.5"
|
|
|
|
| 3242 |
description = "YAML parser and emitter for Python"
|
| 3243 |
optional = false
|
| 3244 |
python-versions = ">=3.8"
|
| 3245 |
+
groups = ["main", "dev"]
|
| 3246 |
files = [
|
| 3247 |
{file = "PyYAML-6.0.3-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f"},
|
| 3248 |
{file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4"},
|
|
|
|
| 3319 |
{file = "pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f"},
|
| 3320 |
]
|
| 3321 |
|
| 3322 |
+
[[package]]
|
| 3323 |
+
name = "pyyaml-env-tag"
|
| 3324 |
+
version = "1.1"
|
| 3325 |
+
description = "A custom YAML tag for referencing environment variables in YAML files."
|
| 3326 |
+
optional = false
|
| 3327 |
+
python-versions = ">=3.9"
|
| 3328 |
+
groups = ["dev"]
|
| 3329 |
+
files = [
|
| 3330 |
+
{file = "pyyaml_env_tag-1.1-py3-none-any.whl", hash = "sha256:17109e1a528561e32f026364712fee1264bc2ea6715120891174ed1b980d2e04"},
|
| 3331 |
+
{file = "pyyaml_env_tag-1.1.tar.gz", hash = "sha256:2eb38b75a2d21ee0475d6d97ec19c63287a7e140231e4214969d0eac923cd7ff"},
|
| 3332 |
+
]
|
| 3333 |
+
|
| 3334 |
+
[package.dependencies]
|
| 3335 |
+
pyyaml = "*"
|
| 3336 |
+
|
| 3337 |
[[package]]
|
| 3338 |
name = "pyzmq"
|
| 3339 |
version = "27.1.0"
|
|
|
|
| 3461 |
description = "Python HTTP for Humans."
|
| 3462 |
optional = false
|
| 3463 |
python-versions = ">=3.9"
|
| 3464 |
+
groups = ["main", "dev"]
|
| 3465 |
files = [
|
| 3466 |
{file = "requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6"},
|
| 3467 |
{file = "requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf"},
|
|
|
|
| 4277 |
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
| 4278 |
optional = false
|
| 4279 |
python-versions = ">=3.9"
|
| 4280 |
+
groups = ["main", "dev"]
|
| 4281 |
files = [
|
| 4282 |
{file = "urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4"},
|
| 4283 |
{file = "urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed"},
|
|
|
|
| 4314 |
description = "Filesystem events monitoring"
|
| 4315 |
optional = false
|
| 4316 |
python-versions = ">=3.9"
|
| 4317 |
+
groups = ["main", "dev"]
|
|
|
|
| 4318 |
files = [
|
| 4319 |
{file = "watchdog-6.0.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d1cdb490583ebd691c012b3d6dae011000fe42edb7a82ece80965b42abd61f26"},
|
| 4320 |
{file = "watchdog-6.0.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bc64ab3bdb6a04d69d4023b29422170b74681784ffb9463ed4870cf2f3e66112"},
|
|
|
|
| 4347 |
{file = "watchdog-6.0.0-py3-none-win_ia64.whl", hash = "sha256:a1914259fa9e1454315171103c6a30961236f508b9b623eae470268bbcc6a22f"},
|
| 4348 |
{file = "watchdog-6.0.0.tar.gz", hash = "sha256:9ddf7c82fda3ae8e24decda1338ede66e1c99883db93711d8fb941eaa2d8c282"},
|
| 4349 |
]
|
| 4350 |
+
markers = {main = "platform_system != \"Darwin\""}
|
| 4351 |
|
| 4352 |
[package.extras]
|
| 4353 |
watchmedo = ["PyYAML (>=3.10)"]
|
|
|
|
| 4407 |
[metadata]
|
| 4408 |
lock-version = "2.1"
|
| 4409 |
python-versions = "^3.13"
|
| 4410 |
+
content-hash = "101b0a34233f01cb5a76000ba1b028fa65e8a95cb16ca2525187e838651a4d74"
|
pyproject.toml
CHANGED
|
@@ -48,6 +48,10 @@ ipykernel = "^7.1.0"
|
|
| 48 |
ipywidgets = "^8.1.8"
|
| 49 |
matplotlib = "^3.10.8"
|
| 50 |
seaborn = "^0.13.2"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
[tool.poetry.scripts]
|
| 53 |
technova = "app.main:main"
|
|
|
|
| 48 |
ipywidgets = "^8.1.8"
|
| 49 |
matplotlib = "^3.10.8"
|
| 50 |
seaborn = "^0.13.2"
|
| 51 |
+
mkdocs = "^1.6.1"
|
| 52 |
+
mkdocs-material = "^9.7.1"
|
| 53 |
+
mkdocstrings = "^1.0.3"
|
| 54 |
+
mkdocstrings-python = "^2.0.2"
|
| 55 |
|
| 56 |
[tool.poetry.scripts]
|
| 57 |
technova = "app.main:main"
|
scripts/generate_docs.py
CHANGED
|
@@ -1,26 +1,38 @@
|
|
| 1 |
-
import
|
| 2 |
-
import webbrowser
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
"app.
|
| 7 |
-
"
|
| 8 |
-
"
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
os.system(f"python -m pydoc -w {m}")
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
|
|
|
| 2 |
|
| 3 |
+
modules1 = {
|
| 4 |
+
"app.models": "app_models.md",
|
| 5 |
+
"app.api": "app_api.md",
|
| 6 |
+
"domain.domain": "domain.md",
|
| 7 |
+
"service.technova_service": "technova_service.md"
|
| 8 |
+
}
|
| 9 |
+
modules2 = {
|
| 10 |
+
"app.database": "database.md"
|
| 11 |
+
}
|
| 12 |
|
| 13 |
+
modules3 = {
|
| 14 |
+
"app.security": "security.md"
|
| 15 |
+
}
|
| 16 |
|
| 17 |
+
docs_dir1 = Path("docs/api_reference")
|
| 18 |
+
docs_dir1.mkdir(parents=True, exist_ok=True)
|
| 19 |
|
| 20 |
+
for module, filename in modules1.items():
|
| 21 |
+
content = f"# {module}\n\n::: {module}\n"
|
| 22 |
+
(docs_dir1 / filename).write_text(content, encoding="utf-8")
|
| 23 |
|
| 24 |
+
docs_dir2 = Path("docs/init_base")
|
| 25 |
+
docs_dir2.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 26 |
|
| 27 |
+
for module, filename in modules2.items():
|
| 28 |
+
content = f"# {module}\n\n::: {module}\n"
|
| 29 |
+
(docs_dir2 / filename).write_text(content, encoding="utf-8")
|
| 30 |
+
|
| 31 |
+
docs_dir3 = Path("docs/securite")
|
| 32 |
+
docs_dir3.mkdir(parents=True, exist_ok=True)
|
| 33 |
+
|
| 34 |
+
for module, filename in modules3.items():
|
| 35 |
+
content = f"# {module}\n\n::: {module}\n"
|
| 36 |
+
(docs_dir3 / filename).write_text(content, encoding="utf-8")
|
| 37 |
+
|
| 38 |
+
print(" Fichiers MkDocs API générés.")
|
service/technova_service.py
CHANGED
|
@@ -1,5 +1,48 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import json
|
| 4 |
import os
|
| 5 |
from pathlib import Path
|
|
@@ -19,6 +62,31 @@ THRESH_FILE = os.getenv("THRESH_FILE", "threshold.json")
|
|
| 19 |
|
| 20 |
# Note : on pourrait aussi imaginer stocker ces artefacts dans un bucket S3 ou autre, et les télécharger à la volée au démarrage de l'API.
|
| 21 |
def _get_artifact_path(artifacts_dir: Path, filename: str) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
local_path = artifacts_dir / filename
|
| 23 |
if local_path.exists():
|
| 24 |
return str(local_path)
|
|
@@ -28,9 +96,46 @@ def _get_artifact_path(artifacts_dir: Path, filename: str) -> str:
|
|
| 28 |
filename=filename,
|
| 29 |
repo_type="model",
|
| 30 |
)
|
|
|
|
|
|
|
| 31 |
# Service encapsulant la logique de chargement du modèle, de préparation des données et de prédiction.
|
| 32 |
class TechNovaService:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def __init__(self) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
artifacts_dir = Path(__file__).resolve().parents[1] / "artifacts"
|
| 35 |
|
| 36 |
# Load model (local or HF)
|
|
@@ -90,24 +195,96 @@ class TechNovaService:
|
|
| 90 |
|
| 91 |
# Récupère la dernière ligne de features "clean" pour un employee_id donné, ou None si pas trouvé
|
| 92 |
def fetch_latest_clean_row(self, db: Session, employee_id: int) -> dict[str, Any] | None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
row = (
|
| 94 |
db.execute(self._sql_clean_latest, {"employee_id": employee_id})
|
| 95 |
.mappings()
|
| 96 |
.first()
|
| 97 |
)
|
| 98 |
return dict(row) if row else None
|
| 99 |
-
|
| 100 |
# Transforme une ligne de features "clean" en DataFrame prête à être ingérée par le modèle, en vérifiant que toutes les features attendues sont présentes
|
| 101 |
def _row_to_X(self, row: dict[str, Any]) -> pd.DataFrame:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
missing = [c for c in self.feature_columns if c not in row]
|
| 103 |
if missing:
|
| 104 |
raise ValueError(f"Clean row missing required features: {missing}")
|
| 105 |
|
| 106 |
X = pd.DataFrame([{c: row[c] for c in self.feature_columns}])
|
| 107 |
return X[self.feature_columns]
|
| 108 |
-
|
| 109 |
# Prédit le risque de départ d'un employé à partir de son employee_id, en lisant les features dans clean.ml_features_employees et en appliquant le modèle chargé. Retourne une ModelResponse avec la probabilité et la prédiction binaire (will_leave).
|
| 110 |
def predict_from_clean(self, db: Session, employee_id: int) -> ModelResponse:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
row = self.fetch_latest_clean_row(db, employee_id)
|
| 112 |
if row is None:
|
| 113 |
raise ValueError(
|
|
@@ -123,9 +300,34 @@ class TechNovaService:
|
|
| 123 |
turnover_probability=proba,
|
| 124 |
will_leave=proba >= self.threshold,
|
| 125 |
)
|
| 126 |
-
|
| 127 |
# Transforme un ModelRequest (payload de features brutes) en DataFrame prête à être ingérée par le modèle, en vérifiant que toutes les features attendues sont présentes et qu'il n'y a pas de features inattendues.
|
| 128 |
def adapt_input(self, request: ModelRequest) -> pd.DataFrame:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
data = request.model_dump()
|
| 130 |
X = pd.DataFrame([data])
|
| 131 |
|
|
@@ -138,9 +340,29 @@ class TechNovaService:
|
|
| 138 |
raise ValueError(f"Unexpected features: {extra}")
|
| 139 |
|
| 140 |
return X[self.feature_columns]
|
| 141 |
-
|
| 142 |
# Prédit le risque de départ à partir d'un payload de features brutes, en adaptant le payload pour obtenir les features attendues par le modèle, puis en appliquant le modèle. Retourne une ModelResponse avec la probabilité et la prédiction binaire (will_leave).
|
| 143 |
def predict_from_payload(self, request: ModelRequest) -> ModelResponse:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
X = self.adapt_input(request)
|
| 145 |
proba = float(self.model.predict_proba(X)[0, 1])
|
| 146 |
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
+
"""
|
| 4 |
+
service.technova_service
|
| 5 |
+
|
| 6 |
+
Service ML central du projet TechNova Partners.
|
| 7 |
+
|
| 8 |
+
Ce module encapsule la logique "métier ML" côté API :
|
| 9 |
+
- charger les artefacts du modèle (pipeline joblib + seuil) au démarrage,
|
| 10 |
+
- préparer les données au format attendu par le pipeline,
|
| 11 |
+
- produire une prédiction (probabilité + décision binaire),
|
| 12 |
+
- interroger la base pour récupérer les features déjà préparées (tables `clean.*`).
|
| 13 |
+
|
| 14 |
+
Philosophie MLOps
|
| 15 |
+
-------------------------------------
|
| 16 |
+
1) Pas de preprocessing dans l'API
|
| 17 |
+
L'API ne "nettoie" pas les données à chaque requête.
|
| 18 |
+
Elle consomme des features déjà prêtes en base (ETL séparé).
|
| 19 |
+
|
| 20 |
+
2) Un service dédié au ML
|
| 21 |
+
L'API appelle ce service, ce qui rend le code :
|
| 22 |
+
- plus testable (on peut mocker le service),
|
| 23 |
+
- plus clair (responsabilités séparées),
|
| 24 |
+
- plus maintenable (V2 plus simple).
|
| 25 |
+
|
| 26 |
+
Artefacts du modèle
|
| 27 |
+
-------------------
|
| 28 |
+
Le service cherche d'abord les fichiers en local dans `artifacts/`.
|
| 29 |
+
S'ils ne sont pas présents, il les télécharge depuis Hugging Face Hub.
|
| 30 |
+
|
| 31 |
+
Variables d'environnement utiles
|
| 32 |
+
--------------------------------
|
| 33 |
+
MODEL_REPO : dépôt HF contenant les artefacts (repo type = "model")
|
| 34 |
+
MODEL_FILE : nom du fichier joblib du modèle (pipeline)
|
| 35 |
+
THRESH_FILE : nom du fichier JSON contenant le seuil
|
| 36 |
+
|
| 37 |
+
Exemples
|
| 38 |
+
--------
|
| 39 |
+
- MODE production (recommandé) :
|
| 40 |
+
predict_from_clean(db, employee_id)
|
| 41 |
+
|
| 42 |
+
- MODE debug / scoring direct :
|
| 43 |
+
predict_from_payload(request)
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
import json
|
| 47 |
import os
|
| 48 |
from pathlib import Path
|
|
|
|
| 62 |
|
| 63 |
# Note : on pourrait aussi imaginer stocker ces artefacts dans un bucket S3 ou autre, et les télécharger à la volée au démarrage de l'API.
|
| 64 |
def _get_artifact_path(artifacts_dir: Path, filename: str) -> str:
|
| 65 |
+
"""
|
| 66 |
+
Retourne le chemin vers un artefact (modèle ou threshold).
|
| 67 |
+
|
| 68 |
+
Stratégie :
|
| 69 |
+
1) si le fichier existe en local dans `artifacts_dir`, on l'utilise,
|
| 70 |
+
2) sinon, on le télécharge depuis Hugging Face Hub.
|
| 71 |
+
|
| 72 |
+
Parameters
|
| 73 |
+
----------
|
| 74 |
+
artifacts_dir : pathlib.Path
|
| 75 |
+
Dossier local contenant les artefacts (ex: /app/artifacts).
|
| 76 |
+
filename : str
|
| 77 |
+
Nom du fichier recherché (ex: "modele_classification_technova.joblib").
|
| 78 |
+
|
| 79 |
+
Returns
|
| 80 |
+
-------
|
| 81 |
+
str
|
| 82 |
+
Chemin local utilisable par joblib/open().
|
| 83 |
+
Si téléchargé depuis HF, `hf_hub_download` renvoie un chemin vers le cache local.
|
| 84 |
+
|
| 85 |
+
Raises
|
| 86 |
+
------
|
| 87 |
+
huggingface_hub.utils.HfHubHTTPError
|
| 88 |
+
Si le repo ou le fichier est introuvable ou non accessible.
|
| 89 |
+
"""
|
| 90 |
local_path = artifacts_dir / filename
|
| 91 |
if local_path.exists():
|
| 92 |
return str(local_path)
|
|
|
|
| 96 |
filename=filename,
|
| 97 |
repo_type="model",
|
| 98 |
)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
# Service encapsulant la logique de chargement du modèle, de préparation des données et de prédiction.
|
| 102 |
class TechNovaService:
|
| 103 |
+
"""
|
| 104 |
+
Service ML utilisé par l'API.
|
| 105 |
+
|
| 106 |
+
Responsabilités
|
| 107 |
+
---------------
|
| 108 |
+
- Charger le modèle (pipeline joblib) et le seuil de décision (threshold).
|
| 109 |
+
- Définir la liste ordonnée des features attendues par le pipeline (`feature_columns`).
|
| 110 |
+
- Récupérer une ligne de features "clean" depuis la base.
|
| 111 |
+
- Convertir ces données en DataFrame compatible avec `predict_proba`.
|
| 112 |
+
- Retourner un `ModelResponse` standard.
|
| 113 |
+
|
| 114 |
+
Notes importantes
|
| 115 |
+
-----------------
|
| 116 |
+
- Le modèle est chargé une seule fois au démarrage de l'API (via lifespan).
|
| 117 |
+
- `feature_columns` est l'ordre **exact** attendu par le pipeline.
|
| 118 |
+
- La prédiction binaire `will_leave` dépend du seuil chargé depuis `threshold.json`.
|
| 119 |
+
"""
|
| 120 |
+
|
| 121 |
def __init__(self) -> None:
|
| 122 |
+
"""
|
| 123 |
+
Initialise le service et charge les artefacts du modèle.
|
| 124 |
+
|
| 125 |
+
Étapes :
|
| 126 |
+
1) Détermine le dossier `artifacts/` du projet.
|
| 127 |
+
2) Charge le modèle joblib (local si présent, sinon HF Hub).
|
| 128 |
+
3) Charge le seuil depuis un JSON (local si présent, sinon HF Hub).
|
| 129 |
+
4) Déclare l'ordre des features attendues.
|
| 130 |
+
5) Prépare une requête SQL pour récupérer la dernière ligne "clean" par employee_id.
|
| 131 |
+
|
| 132 |
+
Raises
|
| 133 |
+
------
|
| 134 |
+
FileNotFoundError / OSError
|
| 135 |
+
Si le fichier threshold local est introuvable et que le téléchargement HF échoue.
|
| 136 |
+
Exception
|
| 137 |
+
Toute erreur de chargement du modèle (joblib) ou de parsing du JSON.
|
| 138 |
+
"""
|
| 139 |
artifacts_dir = Path(__file__).resolve().parents[1] / "artifacts"
|
| 140 |
|
| 141 |
# Load model (local or HF)
|
|
|
|
| 195 |
|
| 196 |
# Récupère la dernière ligne de features "clean" pour un employee_id donné, ou None si pas trouvé
|
| 197 |
def fetch_latest_clean_row(self, db: Session, employee_id: int) -> dict[str, Any] | None:
|
| 198 |
+
"""
|
| 199 |
+
Récupère la dernière ligne de features "clean" d'un employé.
|
| 200 |
+
|
| 201 |
+
La table `clean.ml_features_employees` peut contenir plusieurs versions dans le temps.
|
| 202 |
+
On prend la plus récente (`ORDER BY created_at DESC LIMIT 1`).
|
| 203 |
+
|
| 204 |
+
Parameters
|
| 205 |
+
----------
|
| 206 |
+
db : sqlalchemy.orm.Session
|
| 207 |
+
Session SQLAlchemy ouverte sur la base.
|
| 208 |
+
employee_id : int
|
| 209 |
+
Identifiant interne (clé utilisée dans `clean.ml_features_employees.employee_id`).
|
| 210 |
+
|
| 211 |
+
Returns
|
| 212 |
+
-------
|
| 213 |
+
dict[str, Any] | None
|
| 214 |
+
Un dictionnaire {feature: valeur} si trouvé, sinon None.
|
| 215 |
+
|
| 216 |
+
Raises
|
| 217 |
+
------
|
| 218 |
+
sqlalchemy.exc.SQLAlchemyError
|
| 219 |
+
Si la requête échoue (table absente, schéma absent, etc.).
|
| 220 |
+
"""
|
| 221 |
row = (
|
| 222 |
db.execute(self._sql_clean_latest, {"employee_id": employee_id})
|
| 223 |
.mappings()
|
| 224 |
.first()
|
| 225 |
)
|
| 226 |
return dict(row) if row else None
|
| 227 |
+
|
| 228 |
# Transforme une ligne de features "clean" en DataFrame prête à être ingérée par le modèle, en vérifiant que toutes les features attendues sont présentes
|
| 229 |
def _row_to_X(self, row: dict[str, Any]) -> pd.DataFrame:
|
| 230 |
+
"""
|
| 231 |
+
Convertit une ligne "clean" (dict) en DataFrame modèle-ready.
|
| 232 |
+
|
| 233 |
+
Vérifie que toutes les features attendues sont présentes, puis construit un DataFrame
|
| 234 |
+
avec **exactement** les colonnes dans l'ordre `feature_columns`.
|
| 235 |
+
|
| 236 |
+
Parameters
|
| 237 |
+
----------
|
| 238 |
+
row : dict[str, Any]
|
| 239 |
+
Dictionnaire contenant les features.
|
| 240 |
+
|
| 241 |
+
Returns
|
| 242 |
+
-------
|
| 243 |
+
pandas.DataFrame
|
| 244 |
+
DataFrame (1 ligne) au format attendu par le pipeline.
|
| 245 |
+
|
| 246 |
+
Raises
|
| 247 |
+
------
|
| 248 |
+
ValueError
|
| 249 |
+
Si des features attendues manquent.
|
| 250 |
+
"""
|
| 251 |
missing = [c for c in self.feature_columns if c not in row]
|
| 252 |
if missing:
|
| 253 |
raise ValueError(f"Clean row missing required features: {missing}")
|
| 254 |
|
| 255 |
X = pd.DataFrame([{c: row[c] for c in self.feature_columns}])
|
| 256 |
return X[self.feature_columns]
|
| 257 |
+
|
| 258 |
# Prédit le risque de départ d'un employé à partir de son employee_id, en lisant les features dans clean.ml_features_employees et en appliquant le modèle chargé. Retourne une ModelResponse avec la probabilité et la prédiction binaire (will_leave).
|
| 259 |
def predict_from_clean(self, db: Session, employee_id: int) -> ModelResponse:
|
| 260 |
+
"""
|
| 261 |
+
Prédit à partir de la base (mode production, recommandé).
|
| 262 |
+
|
| 263 |
+
Pipeline :
|
| 264 |
+
1) récupère la dernière ligne "clean" pour `employee_id`,
|
| 265 |
+
2) transforme en DataFrame au bon format,
|
| 266 |
+
3) calcule la probabilité de départ via `predict_proba`,
|
| 267 |
+
4) compare au seuil pour produire `will_leave`.
|
| 268 |
+
|
| 269 |
+
Parameters
|
| 270 |
+
----------
|
| 271 |
+
db : sqlalchemy.orm.Session
|
| 272 |
+
Session SQLAlchemy.
|
| 273 |
+
employee_id : int
|
| 274 |
+
Identifiant interne utilisé dans la table clean.
|
| 275 |
+
|
| 276 |
+
Returns
|
| 277 |
+
-------
|
| 278 |
+
ModelResponse
|
| 279 |
+
- employee_id : renseigné
|
| 280 |
+
- turnover_probability : proba [0, 1]
|
| 281 |
+
- will_leave : bool selon le seuil
|
| 282 |
+
|
| 283 |
+
Raises
|
| 284 |
+
------
|
| 285 |
+
ValueError
|
| 286 |
+
Si aucune ligne clean n'existe pour cet employee_id.
|
| 287 |
+
"""
|
| 288 |
row = self.fetch_latest_clean_row(db, employee_id)
|
| 289 |
if row is None:
|
| 290 |
raise ValueError(
|
|
|
|
| 300 |
turnover_probability=proba,
|
| 301 |
will_leave=proba >= self.threshold,
|
| 302 |
)
|
| 303 |
+
|
| 304 |
# Transforme un ModelRequest (payload de features brutes) en DataFrame prête à être ingérée par le modèle, en vérifiant que toutes les features attendues sont présentes et qu'il n'y a pas de features inattendues.
|
| 305 |
def adapt_input(self, request: ModelRequest) -> pd.DataFrame:
|
| 306 |
+
"""
|
| 307 |
+
Adapte un payload JSON (ModelRequest) vers un DataFrame modèle-ready.
|
| 308 |
+
|
| 309 |
+
Utilisé par l'endpoint `/predict/by-features`.
|
| 310 |
+
|
| 311 |
+
Contrôles :
|
| 312 |
+
- toutes les features attendues doivent être présentes,
|
| 313 |
+
- aucune feature inconnue ne doit être envoyée,
|
| 314 |
+
- l'ordre final est imposé par `feature_columns`.
|
| 315 |
+
|
| 316 |
+
Parameters
|
| 317 |
+
----------
|
| 318 |
+
request : ModelRequest
|
| 319 |
+
Payload validé par Pydantic.
|
| 320 |
+
|
| 321 |
+
Returns
|
| 322 |
+
-------
|
| 323 |
+
pandas.DataFrame
|
| 324 |
+
DataFrame (1 ligne) au format attendu.
|
| 325 |
+
|
| 326 |
+
Raises
|
| 327 |
+
------
|
| 328 |
+
ValueError
|
| 329 |
+
Si features manquantes ou inattendues.
|
| 330 |
+
"""
|
| 331 |
data = request.model_dump()
|
| 332 |
X = pd.DataFrame([data])
|
| 333 |
|
|
|
|
| 340 |
raise ValueError(f"Unexpected features: {extra}")
|
| 341 |
|
| 342 |
return X[self.feature_columns]
|
| 343 |
+
|
| 344 |
# Prédit le risque de départ à partir d'un payload de features brutes, en adaptant le payload pour obtenir les features attendues par le modèle, puis en appliquant le modèle. Retourne une ModelResponse avec la probabilité et la prédiction binaire (will_leave).
|
| 345 |
def predict_from_payload(self, request: ModelRequest) -> ModelResponse:
|
| 346 |
+
"""
|
| 347 |
+
Prédit à partir d'un payload de features (mode debug / scoring direct).
|
| 348 |
+
|
| 349 |
+
Étapes :
|
| 350 |
+
1) transforme le payload en DataFrame via `adapt_input`,
|
| 351 |
+
2) calcule la probabilité via `predict_proba`,
|
| 352 |
+
3) applique le seuil pour obtenir `will_leave`.
|
| 353 |
+
|
| 354 |
+
Parameters
|
| 355 |
+
----------
|
| 356 |
+
request : ModelRequest
|
| 357 |
+
Features prêtes (pas de preprocessing dans l'API).
|
| 358 |
+
|
| 359 |
+
Returns
|
| 360 |
+
-------
|
| 361 |
+
ModelResponse
|
| 362 |
+
- employee_id : None (pas d'ID côté payload)
|
| 363 |
+
- turnover_probability : proba [0, 1]
|
| 364 |
+
- will_leave : bool selon le seuil
|
| 365 |
+
"""
|
| 366 |
X = self.adapt_input(request)
|
| 367 |
proba = float(self.model.predict_proba(X)[0, 1])
|
| 368 |
|