Skip to content

[DCP Ingestion] Namespace support in preprocessor - #686

Merged
gmechali merged 48 commits into
datacommonsorg:masterfrom
gmechali:namespace
Jul 28, 2026
Merged

[DCP Ingestion] Namespace support in preprocessor#686
gmechali merged 48 commits into
datacommonsorg:masterfrom
gmechali:namespace

Conversation

@gmechali

@gmechali gmechali commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Standardize on provenance_id across graph nodes and enable per-provenance GCS handshakes

  • Per-Provenance GCS Handshakes: Update dcpbridge mode to generate a per-provenance {workflow_id}.json handshake manifest where importList specifies each individual provenance folder (provenance/<name>) and its shard glob (**/*.jsonld).
  • Standardize Data Model: Replace provenance_dir(s) with provenance_id(s) across Entity, Property, Provenance, and Source to match StatVar, EventType, and EntityType.
  • Remove Upfront Normalization: Eliminate boilerplate config.import_name() and provenance_dir piping in importers (Observations, VariablePerRow, Events, Mcf) and runner IPC serialization.
  • Centralize Shard Bucketing: Consolidate folder normalization (strip_namespace(prov_id)) to a single location at the JSON-LD export boundary in Nodes.triples_by_provenance_dir().

@codacy-production

codacy-production Bot commented Jul 24, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 3 medium · 4 minor

Alerts:
⚠ 7 issues (≤ 0 issues of at least minor severity)

Results:
7 new issues

Category Results
UnusedCode 2 minor
Security 1 medium
CodeStyle 2 minor
Complexity 2 medium

View in Codacy

🟢 Metrics 54 complexity

Metric Results
Complexity 54

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces parallel processing for CSV imports using a ProcessPoolExecutor in the Runner, along with changes to prevent file collisions by incorporating the file name into observation shard names. It also adds GCS upload retry logic, improves custom namespace handling across importers and validators, and optimizes custom dimension serialization. Feedback on these changes highlights a fragile design pattern in _write_observation_shard where the first parameter is overloaded to accept either a list or a tuple, and warns of a potential collision risk for node shards similar to the one resolved for observation shards.

Comment thread simple/stats/jsonld_stream_db.py
Comment thread simple/stats/jsonld_stream_db.py Outdated
@gmechali
gmechali requested a review from clincoln8 July 25, 2026 15:44
@gmechali

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces changes to support grouping and exporting triples by their provenance directories, handling custom namespace prefixes during entity resolution, and preventing the duplication of global triples across multiple imports. It updates several importers, the node registry, and database interfaces to track and propagate provenance directories. A correctness bug was identified in events_importer.py where unresolved entity names are registered before they are resolved, which can lead to invalid registrations and missing triples.

Comment thread simple/stats/events_importer.py Outdated

@clincoln8 clincoln8 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!!!!!

Nonblocking questions / comments. Can likely be addressed in followups if needed.

Comment thread simple/stats/util.py
Comment thread simple/stats/util.py
Comment thread simple/stats/data.py
Comment thread simple/util/filesystem.py Outdated
Comment thread simple/stats/nodes.py
Comment thread simple/stats/validation.py
Comment thread simple/stats/jsonld_stream_db.py
Comment thread simple/stats/observations_importer.py
@gmechali

Copy link
Copy Markdown
Contributor Author

Thanks Christie! Fixed like half the comments, the half regarding namespaces i think will need to be hanlded in the namespace work coming up, but agree fully on the cleanup needed :)

@gmechali
gmechali merged commit 8ab80c3 into datacommonsorg:master Jul 28, 2026
10 of 11 checks passed
@gmechali
gmechali deleted the namespace branch July 28, 2026 02:38
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.

2 participants