Skip to content

Add EChemDBReader for reading digitized CV data from echemdb.org#194

Merged
ScottSoren merged 48 commits into
mainfrom
echemdb
Aug 25, 2025
Merged

Add EChemDBReader for reading digitized CV data from echemdb.org#194
ScottSoren merged 48 commits into
mainfrom
echemdb

Conversation

@FrederikLizakJohansen

Copy link
Copy Markdown
Contributor

Summary

This PR introduces a new EChemDBReader class to support loading CV reference data from echemdb.org, a curated open-access repository for digitized electrochemical datasets (digitized from SVG extractions). This data is versioned and distributed via GitHub releases and PyPI metadata.

This PR also includes:

  • Minor CI improvements (Python 3.7 discontinued support on Ubuntu >22.04, at least through GitHub actions)
  • A new cross-platform caching utility (get_default_cache_dir) in tools.py

Key Features

EChemDBReader class

  • Fetches digitized CV data by identifier (e.g. "alves_2011_electrochemistry_6010")
  • Supports latest or pinned versions of the dataset (version="0.4.1")
  • Downloads and caches only necessary files (CSV, JSON, bib) at read-time.
  • Uses metadata schema to infer CV axes and set appropriate aliases (potential, current)
  • Converts EChemDB data into TimeSeries + ValueSeries using schema. Each read-call fetches a single CV.

Demo script (demo_echemdb_reader.py)

  • Shows loading of CVs from EChemDB.
  • Demonstrates version-switching.

Additional Improvements

Tools

  • get_default_cache_dir() (in src/ixdat/tools.py)
    • Determines appropriate cache directory based on platform:
      • Windows --> LOCALAPPDATA
      • macOS --> ~/Library/Caches
      • Linux --> $XDG_CACHE_HOME or ~/.cache
    • Supports optional subdirectory input for namespacing/versioning
    • Used by EChemDBReader to store cached datasets

CI / Testing

  • Restricting testing on Python 3.7 to Ubuntu 22.04
    • Needed due to setup-python compatibility issues
    • Ensures continued test coverage for Python 3.7

CI-related changes are required for the EChemDBReader to pass tests. If preferred, they could be split into a separate PR.

For Review

  • New reader: src/ixdat/readers/echemdb.py
  • Demo: development_scripts/reader_demonstrators/demo_echemdb_reader.py
  • Caching utility: src/ixdat/tools.py --> get_default_cache_dir()
  • CI updates in workflows

ScottSoren and others added 25 commits August 4, 2025 11:12
…compatibility

- Switched to actions/setup-python@v4
- Explicitly mapped Python versions to compatible OS using matrix.include
- Ensured Python 3.7 runs only on ubuntu-22.04 since ubuntu-latest (24.04) drops support
- Supports fetching latest version from PyPI
- Selectively extracts only required files from release zip
- Caches data locally using versioned directories
- Parses metadata and bibtex citation
- Builds Measurement with alias mapping for CV compatibility
…-derived aliases; resolve potential issue of circular alias lookup

@ScottSoren ScottSoren left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work, @FrederikLizakJohansen !
It works well on my computer and all the code fits well with ixdat
I've requested a few additions to comments and docstrings, plus very minor changes of code in the demo script and the reader.

Comment thread development_scripts/reader_demonstrators/demo_echemdb_cache_load_entry.py Outdated
Comment thread development_scripts/reader_demonstrators/demo_echemdb_cache_load_entry.py Outdated
Comment thread development_scripts/reader_demonstrators/demo_echemdb_cache_load_entry.py Outdated
Comment thread development_scripts/reader_demonstrators/demo_echemdb_reader.py Outdated
Comment thread src/ixdat/readers/echemdb.py Outdated
Comment thread src/ixdat/readers/echemdb.py
Comment thread src/ixdat/readers/echemdb.py
Comment thread src/ixdat/readers/echemdb.py
Comment thread src/ixdat/readers/echemdb.py
Comment thread src/ixdat/tools.py
@ScottSoren

Copy link
Copy Markdown
Member

Looks great! Thanks for the contribution :)
Merging.

@ScottSoren ScottSoren merged commit 40b7ef2 into main Aug 25, 2025
9 checks passed
@DunklesArchipel

Copy link
Copy Markdown

Just found out about this integration. Nice to see the reuse of the database. :)

It seems though that you write some code that might be covered by our API. Maybe that simplifies a bit the data extraction.
https://echemdb.github.io/unitpackage/usage/echemdb_usage.html
Feel free to open issues, if our API is missing something that you mare interested in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants