Validate that referenced DataItems are registered when writing

Open
#78 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
database

Research direction

Start by reading write_models and validate_for_write to understand where rows are written and how project_id is available; inspect the referenced DataItemDataSetAssociation.dataitem_id, ClusterMembership.item, and EmbeddingLocation.dataitem_id fields. Done means writes reject references missing from the DataItem table for the same project and report missing IDs or examples.

Written by the indexing model from the issue text.

Description

bug io

Problem

When write_models writes a table that references DataItems, it doesn't check whether those DataItems exist in the DataItem table for the same project. validate_for_write checks one row at a time and never reads other tables, so rows that point to unregistered DataItems are written without error.

Affected tables include DataItemDataSetAssociation.dataitem_id, ClusterMembership.item and EmbeddingLocation.dataitem_id.

ETL notebooks currently guard against this with their own asserts (e.g. etl_v1dd1196_01 checks against a local registered_ids set), but callers of write_models get no such check.

Proposal

Before writing, check that every referenced dataitem_id exists in the DataItem table under the row's project_id. Raise an error listing the missing IDs, or a few examples if there are many.

Related #81

Dominant language
Python
Stars
4
Forks
1
Avg merge
2d 6h
Merged PRs (30d)
7

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AllenInstitute/ConnectsCommonConnectivity

All issues in AllenInstitute/ConnectsCommonConnectivity

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.