Skip to content

Commit 396e95a

Browse files
committed
fix: pass file_path not DataFrame to detect_or_get_provider
1 parent 34b9476 commit 396e95a

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

ingest/adapter.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ def _peek_headers(file_path: Path) -> list[str]:
462462
return []
463463

464464

465-
def enrich_with_provider(df: pd.DataFrame, provider_name: str) -> pd.DataFrame:
465+
def enrich_with_provider(
466+
df: pd.DataFrame, provider_name: str, file_path: "Path | None" = None
467+
) -> pd.DataFrame:
466468
"""Optionally enrich a DataFrame using an oceanstream provider.
467469
468470
Parameters
@@ -471,6 +473,9 @@ def enrich_with_provider(df: pd.DataFrame, provider_name: str) -> pd.DataFrame:
471473
Data to enrich.
472474
provider_name : str
473475
Provider name or ``"auto"`` for auto-detection.
476+
file_path : Path or None
477+
Source file path, used for provider auto-detection when *provider_name*
478+
is ``"auto"``.
474479
475480
Returns
476481
-------
@@ -485,7 +490,8 @@ def enrich_with_provider(df: pd.DataFrame, provider_name: str) -> pd.DataFrame:
485490
from oceanstream.providers.factory import detect_or_get_provider
486491

487492
provider = detect_or_get_provider(
488-
provider_name if provider_name != "auto" else None, df
493+
provider_name if provider_name != "auto" else None,
494+
file_path=file_path,
489495
)
490496
if provider is not None:
491497
df = provider.enrich_dataframe(df)

process/pipeline.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ def _extract_archive(archive_path: Path) -> tuple[list[Path], str]:
127127
return extracted, tmpdir
128128

129129

130-
def _enrich_with_provider(df: pd.DataFrame, provider_name: str) -> pd.DataFrame:
130+
def _enrich_with_provider(
131+
df: pd.DataFrame, provider_name: str, file_path: "Path | None" = None
132+
) -> pd.DataFrame:
131133
"""Optionally enrich a DataFrame using an oceanstream provider."""
132-
return enrich_with_provider(df, provider_name)
134+
return enrich_with_provider(df, provider_name, file_path=file_path)
133135

134136

135137
def _make_output_path(config: "EdgeConfig", source_name: str, suffix: str = ".parquet") -> str:
@@ -211,7 +213,7 @@ async def process_file(
211213
return result
212214

213215
# Provider enrichment
214-
df = _enrich_with_provider(df, config.provider)
216+
df = _enrich_with_provider(df, config.provider, file_path=path)
215217

216218
# Deduplicate (skip for ADCP — multiple depth cells per timestamp)
217219
if "time" in df.columns and file_type != "adcp":

0 commit comments

Comments
 (0)