Skip to content

Assorted updates - #12

Merged
ml-evs merged 7 commits into
mainfrom
ml-evs/tests
Jun 26, 2026
Merged

Assorted updates#12
ml-evs merged 7 commits into
mainfrom
ml-evs/tests

Conversation

@ml-evs

@ml-evs ml-evs commented Jun 21, 2026

Copy link
Copy Markdown
Member

This pull request introduces several improvements and refactorings to the ICSD OPTIMADE adapter, focusing on more robust handling of CIF parsing, improved date handling, enhanced error handling, and better testability. The most significant changes are grouped below.

Core functionality improvements:

  • Refactored the map_cif_to_optimade function to add download and ignore_errors parameters, improved error handling, and ensured correct relationships and IDs for references. Now, references are created as ReferenceResource objects with unique IDs, and the immutable ID is set correctly. [1] [2] [3]
  • The get_cif utility now supports a download flag to control whether missing CIFs are downloaded or an error is raised, improving flexibility for offline or cached workflows.

Date and metadata handling:

  • Added a new isoformat_date utility to standardize date parsing and formatting. Updated reference and structure parsing to prefer update dates over creation dates for the last_modified attribute and to store creation dates in a dedicated field. [1] [2] [3]

Code quality and bug fixes:

  • Fixed variable naming inconsistencies (pycfrw_dpycifrw_dict) and ensured all structure parsing functions use the correct dictionary, reducing confusion and potential errors. [1] [2] [3]
  • Improved handling of chemical formula fields by introducing a descriptive_formula variable that gracefully falls back if structural formula is missing. [1] [2]

Testing and test infrastructure:

  • Updated tests to use a shared data_dir fixture for cached CIFs and to pass the download=False flag, ensuring tests do not require network access and are more reliable. Also, updated assertions to match new reference ID conventions and commented out non-essential attribute checks. [1] [2] [3] [4] [5] [6]

Client usability improvements:

  • Changed the ICSDClient initialization to only attempt login if credentials are present, logging a warning otherwise, and improved the logout method to avoid errors if no session exists. [1] [2]

These changes collectively improve reliability, maintainability, and usability of the ICSD OPTIMADE ingestion pipeline.

@ml-evs ml-evs changed the title Update tests Assorted updates Jun 21, 2026
@ml-evs
ml-evs merged commit 627a9c7 into main Jun 26, 2026
1 of 2 checks passed
@ml-evs
ml-evs deleted the ml-evs/tests branch June 26, 2026 11:06
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.

1 participant