Skip to content

Commit

Permalink
feat: add function for getting metadata for a dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhsmit committed Feb 15, 2024
1 parent 774baab commit e2d8ea2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hdxms_datasets/datavault.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,12 @@ def clear_cache(self) -> None:
for dir in self.cache_dir.iterdir():
shutil.rmtree(dir)

def get_metadata(self, data_id: str) -> dict:
return yaml.safe_load((self.cache_dir / data_id / "metadata.yaml").read_text())

def load_dataset(self, data_id: str) -> DataSet:
hdx_spec = yaml.safe_load((self.cache_dir / data_id / "hdx_spec.yaml").read_text())
dataset_metadata = yaml.safe_load((self.cache_dir / data_id / "metadata.yaml").read_text())
dataset_metadata = self.get_metadata(data_id)

return DataSet.from_spec(
hdx_spec=hdx_spec,
Expand Down

0 comments on commit e2d8ea2

Please sign in to comment.