Skip to content

Commit

Permalink
Saving contains_data_from and contains_data_until to metadata
Browse files Browse the repository at this point in the history
Co-authored-by: Cecilie Seim <[email protected]>
Co-authored-by: Miles Mason Winther <[email protected]>
  • Loading branch information
3 people committed Jan 29, 2024
1 parent 85334a0 commit d2ee2b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/datadoc/backend/dapla_dataset_path_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def convert_ssb_period(
class DaplaDatasetPathInfo:
"""Extract info from a path following SSB's dataset naming convention."""

# def __init__(self, dataset_path: str | os.PathLike[str]) -> None:
def __init__(self, dataset_path: str) -> None:
"""Digest the path so that it's ready for further parsing."""
self.dataset_path = pathlib.Path(dataset_path)
Expand Down
5 changes: 5 additions & 0 deletions src/datadoc/backend/datadoc_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from datadoc_model import model

from datadoc import config
from datadoc.backend.dapla_dataset_path_info import DaplaDatasetPathInfo
from datadoc.backend.dataset_parser import DatasetParser
from datadoc.backend.model_backwards_compatibility import upgrade_metadata
from datadoc.backend.storage_adapter import StorageAdapter
Expand Down Expand Up @@ -214,10 +215,14 @@ def extract_metadata_from_dataset(
"""
self.ds_schema: DatasetParser = DatasetParser.for_file(dataset)

dapla_dataset_path_info = DaplaDatasetPathInfo(dataset)

self.meta.dataset = model.Dataset(
short_name=self.short_name,
dataset_state=self.dataset_state,
version=self.get_dataset_version(short_name),
contains_data_from=str(dapla_dataset_path_info.contains_data_from),
contains_data_until=str(dapla_dataset_path_info.contains_data_until),
data_source_path=self.dataset,
created_by=self.current_user,
)
Expand Down

0 comments on commit d2ee2b9

Please sign in to comment.