Repository navigation
Add CoRE MOF v26.0.2 Lux schemas - #2156
100mingyu-rgb wants to merge 4 commits into
Conversation
|
@bfoley12 The CoRE MOF v26.0.2 Lux schema PR is ready for your review. GitHub did not allow the fork author to add a formal review request, so I am tagging you here as requested. The PR is schema-only and includes the design questions in the description. |
c3f184c to
b6d52ea
Compare
bfoley12
left a comment
There was a problem hiding this comment.
In addition to comments in the PR:
- Unclear what the "Contribution" is
- All field names must be
camelCase, notsnake_case - Field names should not include units - use
client.init_columnsto set the units of the data - Lots of Literals that go unused
- Possibility for non-final contributions to be submitted
We will go through more rounds of review. There are things that will need to be refactored, but this needs to get to a more final state before that.
There was a problem hiding this comment.
This is not needed - we save structures as a Structure object internally. You can submit structures by using submit_contributions and having structures described in the submitted data.
Note: You will also need to include sites, lattice, and optionally charge fields in addition to cif.
Sites that use CifManifestRecord can reference pymatgen.Structure instead.
There was a problem hiding this comment.
It looks like this accepts Errors from a pipeline? Only successfully ran pipelines should have final data submitted.
There was a problem hiding this comment.
It looks like this accepts Errors from a pipeline? Only successfully ran pipelines should have final data submitted.
| StructureId = Annotated[ | ||
| str, | ||
| Field( | ||
| pattern=r"^(ASR|FSR|ION)-(COD|CSD|SI)-(?:\d{4}|UNKN)-\d{4}$", |
There was a problem hiding this comment.
Duplication of _STRUCTURE_ID_RE
There was a problem hiding this comment.
It looks like this accepts Errors from a pipeline? Only successfully ran pipelines should have final data submitted.
|
|
||
| parsed = parse_structure_id(structure_id) | ||
| if cif_file is not None and cif_file != f"cifs/{structure_id}.cif": | ||
| raise ValueError("cif_file must equal cifs/{structure_id}.cif") |
| PositiveSize = Annotated[ | ||
| int, | ||
| Field(gt=0, description="File size in bytes."), | ||
| ] | ||
| NonNegativeInt = Annotated[int, Field(ge=0)] | ||
| NonNegativeFloat = Annotated[float, Field(ge=0)] |
There was a problem hiding this comment.
These exist as pydantic.* - use them directly
| def _parse_dimension(value: object) -> object: | ||
| """Coerce integer CSV cells while retaining a bounded JSON integer type.""" | ||
|
|
||
| if isinstance(value, str) and value in {"0", "1", "2", "3"}: | ||
| return int(value) | ||
| return value | ||
|
|
||
|
|
||
| Dimension = Annotated[Literal[0, 1, 2, 3], BeforeValidator(_parse_dimension)] |
There was a problem hiding this comment.
Pydantic handles string coercion. Can drop the validator
| metal_element_count: NonNegativeInt = Field( | ||
| description="Number of distinct detected metal elements." | ||
| ) | ||
| metal_atom_count: NonNegativeFloat = Field( |
There was a problem hiding this comment.
This will most likely become a Table.
|
@bfoley12 Thank you for the review. I revised the schema so that one contribution represents one final CoRE MOF structure identified by a unique structureId. The previous artifact-specific schemas were replaced with one minimal CoreMofContribution using StructureType. Fields are camelCase and unit-free, optional fields default to None, and operational or non-final pipeline data were removed. The updated tests pass locally. Could you please review the revised structure? |
bfoley12
left a comment
There was a problem hiding this comment.
This was a major change from the last commit. Make sure you are including enough information. The information just has to be a well-structured final datapoint (with some associated data (tables, structures).
Overall good step in the right direction, just make sure you aren't leaving out additional meaningful data.
| structureId: StructureId = Field( | ||
| description="Release-preserved identifier for this CoRE MOF structure." | ||
| ) |
There was a problem hiding this comment.
Since these are your unique identifiers, they should not live in this class. when submitting contributions, you should set identifiers to your structureId
| structure: StructureType = Field( | ||
| description="Pymatgen Structure containing lattice, sites, and charge." | ||
| ) | ||
| cif: Annotated[str, StringConstraints(min_length=1)] = Field( | ||
| description="Original Crystallographic Information File text." | ||
| ) |
There was a problem hiding this comment.
We can remove these. Every Contribution carries with it a structures field. When submitting you contributions, you can also submit a Structure there.
See this Quickstart example. Except in that example, identifier would be your structureId and data is what we are describing in this model. Then, structures would be a list of pymatgen Structures.
Let me know if a further example would help!
| sourceDatabase: SourceDatabase = Field( | ||
| description="COD, CSD, or supporting-information provenance category." | ||
| ) | ||
| sourceId: Annotated[str, StringConstraints(min_length=1)] = Field( |
There was a problem hiding this comment.
Can you put a max_length on this? It helps prevent abuse. You can make it something like 1.5x the max length of the longest source ID that you have. Even better would be to more strongly enforce the format of the sourceId
| formula: str | None = Field( | ||
| default=None, | ||
| description="Chemical formula recorded for the release structure." | ||
| ) |
There was a problem hiding this comment.
This will also go in the top level of the Contribution. Here, we are just describing Contribution.data. See the Quickstart link in an earlier comment
Remove the project-specific README and schema test file from this PR. Keep all six schema and import modules and the package-level README unchanged.
Proposed PR title
Add CoRE MOF v26.0.2 Lux schemas
Summary
core_mofsproject package with seven released-artifact schemas.structure_idas the canonical cross-artifact key.partial, and failed executions.
combined checker table.
flags, diagnostic mappings, and checker vote consistency.
Validation performed locally
structure.
(structure_id, calculation)keys.emmet.core.arrow.arrowizecheck passed for all 12top-level and nested Pydantic models.
Maintainer review questions
core_mofsthe preferred project namespace?each checker become a separate nested schema?
one-to-one fields be composed into one contribution model?
No source CIFs or internal-review data are included in this schema-only change.