diff --git a/CHANGELOG.md b/CHANGELOG.md index 7783f67486..bbb6354244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ * Fixed GenericDataChunkIterator (in hdmf.py) in the case where the number of dimensions is 1 and the size in bytes is greater than the threshold of 1 GB. [PR #638](https://github.com/catalystneuro/neuroconv/pull/638) * Changed `np.floor` and `np.prod` usage to `math.floor` and `math.prod` in various files. [PR #638](https://github.com/catalystneuro/neuroconv/pull/638) +### Improvements +* Change metadata extraction library from `fparse` to `parse`. [PR #654](https://github.com/catalystneuro/neuroconv/pull/654) + # v0.4.5 ### Back-compatibility break diff --git a/requirements-minimal.txt b/requirements-minimal.txt index 7acc23dc23..9f9931ea82 100644 --- a/requirements-minimal.txt +++ b/requirements-minimal.txt @@ -10,4 +10,4 @@ psutil>=5.8.0 tqdm>=4.60.0 dandi>=0.57.0 pandas -fparse +parse>=1.20.0 diff --git a/src/neuroconv/tools/path_expansion.py b/src/neuroconv/tools/path_expansion.py index a08e5c717c..2ce8bd86b3 100644 --- a/src/neuroconv/tools/path_expansion.py +++ b/src/neuroconv/tools/path_expansion.py @@ -1,10 +1,11 @@ -"""Helpful classes for expanding file or folder paths on a system given a f-string rule for matching patterns.""" +"""Helpful classes for expanding file or folder paths on a system given an f-string rule for matching patterns.""" import abc import os +from datetime import date, datetime from pathlib import Path from typing import Dict, Iterable, List -from fparse import parse +from parse import parse from pydantic import DirectoryPath, FilePath from ..utils import DeepDict @@ -81,6 +82,8 @@ def expand_paths(self, source_data_spec: Dict[str, dict]) -> List[DeepDict]: for meta_key, meta_val in metadata.items(): super_key = standard_metadata.get(meta_key, non_standard_super) + if meta_key == "session_start_time" and isinstance(meta_val, date): + meta_val = datetime(meta_val.year, meta_val.month, meta_val.day) out[key]["metadata"][super_key][meta_key] = meta_val return list(dict(out).values())