-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
création de fct_metrics, ajout des colonnes mmsi & ship_name, premier…
… remplissage de la table lors de l'execution de create_updateexcursions_segments.py
- Loading branch information
Showing
5 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from pydantic import BaseModel, ConfigDict | ||
from typing import Generic,TypeVar, List | ||
from typing_extensions import Annotated, Literal, Optional | ||
from datetime import datetime, timedelta | ||
|
||
class Metrics(BaseModel) : | ||
model_config = ConfigDict(arbitrary_types_allowed=True) | ||
timestamp : datetime | ||
vessel_id: Optional[int] | ||
vessel_mmsi: int | ||
ship_name: str | ||
type : str | ||
duration_total : timedelta | ||
duration_fishing: Optional[timedelta] = None | ||
mpa_name : Optional[str] = None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
stmt = select( | ||
sql_model.Vessel.id, | ||
#sql_model.Segment.excursion_id, | ||
sql_model.Vessel.mmsi | ||
sql_model.Segment.in_amp_zone #segment dans une zone ou non | ||
sql_model.Segment.type #default d'ais ou pas | ||
|
||
).join( | ||
sql_model.Excursion, | ||
sql_model.Segment.excursion_id == sql_model.Excursion.id | ||
|
||
).join( | ||
sql_model.Vessel, | ||
sql_model.Excursion.vessel_id == sql_model.Vessel.id | ||
|
||
).filter( | ||
sql_model.Segment.last_vessel_segment == True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters