Category: data-layer | Epic: 0 | Priority: high
Summary
Implement CRUD operations for Fact and Event nodes in Neo4j with full provenance
tracking. Facts represent canonical truth about the world; Events are temporal
facts with timestamps. Both support SUPPORTED_BY edges to Sources/Snippets/Scenes
and INVOLVES/ABOUT edges to entities.
Acceptance Criteria
Dependencies
This use case depends on:
Blocks
This use case blocks:
Implementation
Layer: 1
Files to create:
packages/data-layer/src/monitor_data/schemas/facts.py
packages/data-layer/tests/test_tools/test_fact_tools.py
Files to modify:
packages/data-layer/src/monitor_data/tools/neo4j_tools.py
packages/data-layer/src/monitor_data/middleware/auth.py
NEO4J Operations:
neo4j_create_fact (authority: CanonKeeper)
neo4j_create_event (authority: CanonKeeper)
neo4j_get_fact (authority: *)
neo4j_list_facts (authority: *)
neo4j_update_fact (authority: CanonKeeper)
neo4j_delete_fact (authority: CanonKeeper)
Notes:
- Fact vs Event: Events have explicit timestamps, Facts are timeless assertions
- SUPPORTED_BY creates provenance chain for canonization verification
- confidence is 0.0-1.0, canon_level is the authoritative status
- Timeline edges (NEXT, BEFORE, AFTER) only apply to Events
Testing Requirements
Minimum coverage: 80%
Unit tests:
- test_create_fact_success: valid params → Fact node created
- test_create_fact_with_provenance: source_ids → SUPPORTED_BY edges
- test_create_fact_with_entities: entity_ids → INVOLVES edges
- test_create_event_with_timeline: timeline params → ordering edges
- test_get_fact_with_relationships: returns full provenance chain
- ... and 4 more
Integration tests:
- test_fact_lifecycle: create with provenance → update → delete
- test_event_timeline: create events → establish ordering → query timeline
References
Documentation:
Generated from /home/sebas/monitor2/docs/use-cases/data-layer/DL-3.yml
Category: data-layer | Epic: 0 | Priority: high
Summary
Implement CRUD operations for Fact and Event nodes in Neo4j with full provenance
tracking. Facts represent canonical truth about the world; Events are temporal
facts with timestamps. Both support SUPPORTED_BY edges to Sources/Snippets/Scenes
and INVOLVES/ABOUT edges to entities.
Acceptance Criteria
Dependencies
This use case depends on:
Blocks
This use case blocks:
Implementation
Layer: 1
Files to create:
packages/data-layer/src/monitor_data/schemas/facts.pypackages/data-layer/tests/test_tools/test_fact_tools.pyFiles to modify:
packages/data-layer/src/monitor_data/tools/neo4j_tools.pypackages/data-layer/src/monitor_data/middleware/auth.pyNEO4J Operations:
neo4j_create_fact(authority: CanonKeeper)neo4j_create_event(authority: CanonKeeper)neo4j_get_fact(authority: *)neo4j_list_facts(authority: *)neo4j_update_fact(authority: CanonKeeper)neo4j_delete_fact(authority: CanonKeeper)Notes:
Testing Requirements
Minimum coverage: 80%
Unit tests:
Integration tests:
References
Documentation:
Code:
packages/data-layer/src/monitor_data/schemas/base.pyGenerated from
/home/sebas/monitor2/docs/use-cases/data-layer/DL-3.yml