Assorted updates - #12
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
map_cif_to_optimadefunction to adddownloadandignore_errorsparameters, improved error handling, and ensured correct relationships and IDs for references. Now, references are created asReferenceResourceobjects with unique IDs, and the immutable ID is set correctly. [1] [2] [3]get_cifutility now supports adownloadflag to control whether missing CIFs are downloaded or an error is raised, improving flexibility for offline or cached workflows.Date and metadata handling:
isoformat_dateutility to standardize date parsing and formatting. Updated reference and structure parsing to prefer update dates over creation dates for thelast_modifiedattribute and to store creation dates in a dedicated field. [1] [2] [3]Code quality and bug fixes:
pycfrw_d→pycifrw_dict) and ensured all structure parsing functions use the correct dictionary, reducing confusion and potential errors. [1] [2] [3]descriptive_formulavariable that gracefully falls back if structural formula is missing. [1] [2]Testing and test infrastructure:
data_dirfixture for cached CIFs and to pass thedownload=Falseflag, 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:
ICSDClientinitialization to only attempt login if credentials are present, logging a warning otherwise, and improved thelogoutmethod to avoid errors if no session exists. [1] [2]These changes collectively improve reliability, maintainability, and usability of the ICSD OPTIMADE ingestion pipeline.