Skip to content

About

ChemDataExtractorElectrocatalysis (CDEEC): ChemDataExtractor v2.4 adapted for electrocatalysis, with extensive postprocessing, for text-mining electrocatalyst performance data from the scientific literature.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

ChemDataExtractorElectrocatalysis (CDEEC)

ChemDataExtractorElectrocatalysis (CDEEC) is ChemDataExtractor 2 (v2.4.0) adapted for electrocatalysis. It extracts electrocatalyst performance metrics – Tafel slopes, current densities with their overpotentials, onset and half-wave potentials, Faradaic efficiencies, electrochemically active surface areas, turnover numbers and frequencies – together with the catalyst, reaction and measurement conditions, from the scientific literature. It was used to build the CDEEC database of electrocatalyst performance [placeholder: link to database].

Python versions and platforms: CDEEC is developed and tested on Python 3.12 on Linux; it is not tested on Windows. The underlying ChemDataExtractor 2.4 supports Python 3.9 to 3.11, and its tests also pass on Python 3.12 in this repository.

What the adaptation adds

  • Extensive postprocessing (CDEECpipelinescripts/postprocessing_preliminary_v3.py), where much of CDEEC's value lies: it removes invalid records, standardises and enriches catalyst names, reaction types, units, products and measurement conditions, and merges duplicate and partial records into a consistent, analysis-ready database. See the code and the CDEEC paper [placeholder: paper reference] for full details.
  • Electrocatalysis property models (chemdataextractor/model/ec_models.py, dictionaries in ec_dicts.py) for 13 property types, with the catalyst, reaction type, overpotential, reference electrode, electrolyte, iR correction, normalisation, products and other conditions.
  • A catalyst-name grammar (chemdataextractor/parse/ec_cem.py) for composite catalyst names such as Co@N-CNTs@rGO or Ni2P/Ni@C.
  • Other extraction changes for electrocatalysis text, all opt-in through the CDEEC switches below, so ChemDataExtractor's default behaviour is unchanged.
  • The full pipeline used to build the database (CDEECpipelinescripts/): paper download and filtering, extraction (including HPC scaling), postprocessing and evaluation. See its README.

Installation

conda create -n cdeec python=3.12
conda activate cdeec
git clone https://github.com/finlayg/chemdataextractorEC.git
cd chemdataextractorEC
pip install -e .
cde data download        # ChemDataExtractor's model data
python -c "import stanza; stanza.download('en', resources_version='1.12.0')"   # Stanza models used for the CDEEC database

The CDEEC database was built with Stanza 1.12.0's English models. ChemDataExtractor uses Stanza's dependency parser to split sentences, and newer Stanza models split some sentences differently, which can change the extracted records.

To use the package versions with which the CDEEC database was built, create the environment from environment.yml instead of the first two lines above (see the comments in that file).

The package installs as chemdataextractor2 (version 2.4.0+cdeec.1) and is imported as chemdataextractor, so it replaces an existing ChemDataExtractor 2 installation in the same environment.

Quick start

import os
os.environ["CDEEC_MODE"] = "1"   # turn on the CDEEC changes before importing chemdataextractor

from chemdataextractor import Document
from chemdataextractor.model.ec_models import TafelSlope, CurrentDensity, AltCurrentDensityOverpotential

doc = Document("The NiFe-LDH/NF electrocatalyst showed a Tafel slope of 42 mV dec-1 and an overpotential "
               "of 230 mV at 10 mA cm-2 for the OER in 1 M KOH.")
doc.models = [TafelSlope, CurrentDensity, AltCurrentDensityOverpotential]
for record in doc.records.serialize():
    print(record)

This extracts a Tafel slope of 42 mV dec⁻¹ and a current density of 10 mA cm⁻² at an overpotential of 230 mV, each with the catalyst NiFe-LDH/NF electrocatalyst, the reaction OER and the electrolyte 1 M KOH. Documents can also be read from Elsevier XML and RSC HTML files with Document.from_file.

CDEEC mode

ChemDataExtractorElectrocatalysis (CDEEC) changes some of ChemDataExtractor's core behaviour for electrocatalysis extraction. These changes are off by default, so the package behaves exactly as upstream ChemDataExtractor 2 unless they are turned on with environment variables:

Variable Turns on Default
CDEEC_MODE All CDEEC changes below off
CDEEC_CEM The CDEEC chemical-name grammar for composite catalyst names (chemdataextractor/parse/ec_cem.py) same as CDEEC_MODE
CDEEC_OTHER The other CDEEC extraction changes: sentence and section-heading annotation of records, sentence-skipping heuristics, relaxed required-field checks, sentence re-joining after "vs.", "Fig." and "al.", BERT tokenisation and the volt unit pattern same as CDEEC_MODE

Each takes 1/0 (or true/false, yes/no, on/off). CDEEC_CEM and CDEEC_OTHER override CDEEC_MODE, so for example CDEEC_MODE=1 CDEEC_CEM=0 turns on everything except the CDEEC grammar.

The variables must be set before chemdataextractor is first imported. The CDEEC pipeline scripts (CDEECpipelinescripts/) set CDEEC_MODE=1 themselves. In your own code:

import os
os.environ["CDEEC_MODE"] = "1"   # before importing chemdataextractor

from chemdataextractor import Document
from chemdataextractor.model.ec_models import TafelSlope

The CDEEC property models (chemdataextractor/model/ec_models.py) need CDEEC_OTHER on to produce records, and warn if either group is off. See chemdataextractor/cdeec_config.py for details.

Running the tests

pytest tests --ignore=tests/cdeec --ignore-glob="tests/test_relex_*"   # upstream ChemDataExtractor tests (CDEEC off)
CDEEC_MODE=1 pytest tests/cdeec                                       # CDEEC tests

The relex tests need additional data and are left out above; test_doc_table is very slow. Both behave as in upstream ChemDataExtractor 2. Without CDEEC_MODE=1, tests/cdeec runs only the CDEEC switch tests and skips the extraction tests.

If a change to CDEEC extraction is intended, regenerate the extraction snapshot with CDEEC_MODE=1 python tests/cdeec/make_snapshot.py and review the reported changes before committing.

Citing

If you use CDEEC or its database, please cite:

[placeholder: CDEEC paper – authors, title, journal, year, DOI]

and the ChemDataExtractor papers on which it is built:

J. Mavračić, C. J. Court, T. Isazawa, S. R. Elliott and J. M. Cole, "ChemDataExtractor 2.0: Autopopulated Ontologies for Materials Science", J. Chem. Inf. Model. 61, 4280–4289 (2021). https://doi.org/10.1021/acs.jcim.1c00446

T. Isazawa and J. M. Cole, "Single Model for Organic and Inorganic Chemical Named Entity Recognition in ChemDataExtractor", J. Chem. Inf. Model. 62, 1207–1213 (2022). https://doi.org/10.1021/acs.jcim.1c01199

ChemDataExtractor 2 documentation

The general ChemDataExtractor 2 documentation (readers, parsers, models) applies to this package: https://cambridgemolecularengineering-chemdataextractor-development.readthedocs-hosted.com/en/latest/. The docs/, Introduction.md and CHANGELOG.md files are upstream ChemDataExtractor's.

License

MIT, as for ChemDataExtractor 2 – see LICENSE.

About

ChemDataExtractorElectrocatalysis (CDEEC): ChemDataExtractor v2.4 adapted for electrocatalysis, with extensive postprocessing, for text-mining electrocatalyst performance data from the scientific literature.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages