Skip to content

Commit

Permalink
fix: use vessels_subset.csv & guess CSV seperation ; or , automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
herve.le-bars committed Mar 28, 2024
1 parent a8dccd6 commit fd1f1ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bloom/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Settings(BaseSettings):
port_polygon_data_csv_path:Path = Path(__file__).parent.joinpath("../../data/ports_rad3000_res10.csv")
port_radius_m:int = 3000 # Radius in meters
port_resolution:int = 10 # Number of points in the resulting polygon
vessel_data_csv_path:Path = Path(__file__).parent.joinpath("../../data/chalutiers_pelagiques.csv")
vessel_data_csv_path:Path = Path(__file__).parent.joinpath("../../data/vessels_subset.csv")


vessel_positions_data_csv_path:Path = Path(__file__).parent.joinpath("../../data/spire_positions_subset.csv")
Expand Down
6 changes: 3 additions & 3 deletions src/tasks/dimensions/load_dim_vessel_from_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ def map_to_domain(self, row: pd.Series) -> Vessel:
else None,
external_marking=row["external_marking"] if not isna["external_marking"] else None,
ircs=row["ircs"] if not isna["ircs"] else None,
mt_activated=row["mt_activated"].strip(),
mt_activated=row["mt_activated"],
)

def run(self, *args, **kwarg) -> None:
def run(self, *args, **kwargs) -> None:
use_cases = UseCases()
vessel_repository = use_cases.vessel_repository()
db = use_cases.db()

ports = []
total = 0
try:
df = pd.read_csv(kwarg['vessel_data_csv_path'], sep=";")
df = pd.read_csv(kwargs['vessel_data_csv_path'], sep=None, engine='python')
vessels = df.apply(self.map_to_domain, axis=1)
with db.session() as session:
ports = vessel_repository.batch_create_vessel(session, list(vessels))
Expand Down

0 comments on commit fd1f1ff

Please sign in to comment.