feat: Neo4j entity graph (phase 9) — catalog sync, Dagster asset, S2 /graph endpoints - #31
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ies) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… schedule Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nal, 503-degrading) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…-sync note Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- fuel-only BAs become full plan nodes (never bare edge-MERGE nodes) - schedule probes neo4j reachability and skips instead of failing daily in profiles without the optional server - readapi backs off 15s between failed graph connects so an unreachable neo4j cannot stall the threadpool - _redact_uri strips userinfo from scheme-less URIs too - tests: neo4j temporal-type cleaning, query-time 503s, Cypher shape for label=None, connect backoff, schedule skip/fire - docs: note that GENERATES fuel mix is under-reported pending the generation-by-fuel storage dedup fix (flagged separately) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Builds the reserved phase-9 Neo4j entity graph: the what/who/connected layer over the instrument catalog. Numbers stay in ArcticDB — the graph mirrors identity only (instruments, balancing authorities, ERCOT hubs/load zones, NOAA regions, commodities, observed fuel types) plus curated cross-domain edges, per the original unified-platform spec's locked decision #8.
energex.core.graph(pure):build_entity_graph()derives aGraphPlanfrom symbology + connector vocabularies + store-observed entities; compiles to batched idempotentUNWIND…MERGECypher withfirst_seen/last_seenprovenance. The neo4j driver (6.2.0 as locked) is imported lazily in exactly one function; sync/queries duck-type the driver, so no test or graph-extra-less install ever imports it.Neo4jResource(EnvVar-bound, redacted errors),entity_graphasset with store-driven discovery (BAs frompower.demandsymbols, fuel types frompower.generation_by_fueltails — no hardcoded lists),entity_graph_instruments_resolveasset check, daily 06:10 ET schedule that probes reachability and skips (not fails) when the optional neo4j is absent.GET /graph/entities+GET /graph/related(semantic-rel traversal only), lazy connect with 15s backoff, 503 degradation, additivegraphflag on/healthz; gated by the optional API key like every other data endpoint.graphextra + NEO4J env; CIgraph-gatejob;.env.exampleNEO4J_AUTH/NEO4J_PASSWORD sync warning; newwebsite/docs/entity-graph.md+ contract-table additions.Verification
neo4j:5.26.0-community: driver-6.x compatibility, idempotent re-sync (identical counts, stablefirst_seen),/graph/*end-to-end through uvicorn.fix(graph).Notes for review
/graph/*has noas_ofby design — the graph is a current-state catalog withfirst_seen/last_seenprovenance; anything time-series-shaped stays behindread_as_of.:?) style.Test plan
graph-gatedocker compose --profile full up -d --build, materializeentity_graphin Dagster, browse http://localhost:7474curl localhost:8000/graph/related?instrument_id=ERCOT.SPP.HB_NORTH🤖 Generated with Claude Code