Repository navigation
Initial IMDB version - #2
Conversation
|
@claude review |
|
Claude finished @claudio525's task in 4m 35s —— View job Claude's review
Findings: 1 medium
Everything else I looked at held up well:
The ingest script ( |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical ingestion reliability issues and moderate database integrity and validation issues must be addressed.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds the initial DuckDB-backed IMDB library, CS25.6 ingestion tooling, tests, documentation, packaging, and CI workflows.
Changes:
- Defines the IMDB schema and read/write API.
- Adds tests, examples, and documentation.
- Adds parallel ingestion and project automation.
File summaries
| File | Summary |
|---|---|
tests/test_imdb.py |
IMDB behavior tests |
tests/conftest.py |
Shared test database fixture |
tests/__init__.py |
Tests package marker |
scripts/cs25p6_ingest.py |
CS25.6 ingestion pipeline; unresolved critical failure-handling and completion-marker issues, plus moderate input and validation issues |
README.md |
Usage and schema documentation; nit regarding pSA/FAS example arguments |
pyproject.toml |
Packaging and tooling configuration |
imdb/schema.py |
Schema and vocabularies; metadata-table contract and schema-version docstring need correction |
imdb/imdb.py |
Core database API; unresolved moderate validation, uniqueness, foreign-key, component, and metadata integrity issues |
imdb/__init__.py |
Public API export |
examples/read_imdb.py |
Read API example |
.gitignore |
Python ignore rules |
.github/workflows/publish-PyPI.yml |
PyPI publishing workflow |
.github/workflows/ci.yml |
Continuous integration workflow |
Review details
Suppressed comments (6)
README.md:170
add_recordsdoes not accept pSA/FAS as DataFrame columns; those arrays must be passed through thepSA=/FAS=arguments. As written, this example suggests putting them inrecords_df, which would silently omit the spectra from the database.
db.add_records(
records_df
) # rel_id, site_id, component, kind, pSA, FAS, scalar IM columns
imdb/imdb.py:139
createserializes the caller-supplied component tuple without checking it against the fixed vocabulary inschema.COMPONENTS/README. For example,IMDB.create(..., components=("typo",))creates a database that accepts a non-schema component. Reject unknown (and preferably duplicate) components before writingdb_meta.
frequencies = frequencies or []
imdb/imdb.py:491
- The validator checks record foreign keys but omits
site_event.site_int_idandsite_event.event_int_id, even though that table has no FK constraints. An orphan site-event row can therefore makeget_site_eventsilently drop data on its inner joins whilevalidate()reports the database clean; include site_event in the FK checks.
fks = {
"rel_int_id": self.con.table("realisations").rel_int_id,
"site_int_id": self.con.table("sites").site_int_id,
"event_int_id": self.con.table("events").event_int_id,
}
imdb/schema.py:1
- The module docstring labels the schema as version 0, while
SCHEMA_VERSIONis"1"and is used for compatibility checks. Update the docstring so generated documentation does not report the wrong schema version.
"""DDL and fixed vocabulary for the IMDB schema, version 0.
scripts/cs25p6_ingest.py:262
- Each context row is built from every IM row, but an input file can contain both
geomandrotd50rows for one(rel_id, site_id). Becauserun_pSA_logic_treeassigns every predictioncomponent="rotd50", this produces duplicate GMM logical keys andadd_recordsrejects the fault at line 360. Deduplicate to one context row per realisation/site before calling the GMM.
context = pd.concat(rel_contexts, ignore_index=True)
scripts/cs25p6_ingest.py:122
- Converting the CSV header suffixes to floats loses their original spelling, but
process_fault()later reconstructs names withf"pSA_{p}". A valid header such aspSA_0.10is normalized to0.1and then looked up aspSA_0.1, causing aKeyErrorfor that fault. Preserve the original column-name mapping while still storing numeric period values.
columns = pd.read_csv(first_rel, nrows=0).columns
return [float(c.removeprefix("pSA_")) for c in columns if c.startswith("pSA_")]
- Files reviewed: 11/14 changed files
- Comments generated: 8
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
joelridden
left a comment
There was a problem hiding this comment.
Seems pretty good to me, I would like
is_real BOOLEAN NOT NULL DEFAULT TRUE,
To be added though to the site schema as that would be beneficial for my work at least.
Yes fair point, will add as a separate PR though, so that this version works with my already generated CS200 database. |
AndrewRidden-Harper
left a comment
There was a problem hiding this comment.
Very nice! I think this unified IMDB will be very useful
Uh oh!
There was an error while loading. Please reload this page.