Category: data-layer | Epic: 0 | Priority: high
Summary
Implement CRUD operations for EntityArchetype and EntityInstance nodes in Neo4j.
Archetypes are templates (e.g., "Wizard", "Orc"), Instances are specific entities
(e.g., "Gandalf", "Thrall"). Supports state_tags for dynamic status tracking
and DERIVES_FROM relationships between instances and archetypes.
Acceptance Criteria
Dependencies
This use case depends on:
Blocks
This use case blocks:
- DL-3
- DL-7
- DL-14
- M-12
- M-13
Implementation
Layer: 1
Files to create:
packages/data-layer/src/monitor_data/schemas/entities.py
packages/data-layer/tests/test_tools/test_entity_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_entity (authority: CanonKeeper)
neo4j_get_entity (authority: *)
neo4j_list_entities (authority: *)
neo4j_update_entity (authority: CanonKeeper)
neo4j_delete_entity (authority: CanonKeeper)
neo4j_set_state_tags (authority: CanonKeeper)
Notes:
- EntityArchetype vs EntityInstance is distinguished by
is_archetype boolean
- Properties map structure varies by entity_type (see ENTITY_TAXONOMY.md)
- Common state_tags: alive, dead, hostile, friendly, wounded, hidden
Testing Requirements
Minimum coverage: 80%
Unit tests:
- test_create_archetype: is_archetype=true → EntityArchetype node
- test_create_instance: is_archetype=false → EntityInstance node
- test_create_instance_with_archetype: archetype_id → DERIVES_FROM edge
- test_create_entity_all_types: each entity_type works
- test_list_entities_by_type: filter by entity_type
- ... and 4 more
Integration tests:
- test_entity_lifecycle: create archetype → create instance → update → delete
- test_entity_hierarchy: archetype with multiple instances
References
Documentation:
Generated from /home/sebas/monitor2/docs/use-cases/data-layer/DL-2.yml
Category: data-layer | Epic: 0 | Priority: high
Summary
Implement CRUD operations for EntityArchetype and EntityInstance nodes in Neo4j.
Archetypes are templates (e.g., "Wizard", "Orc"), Instances are specific entities
(e.g., "Gandalf", "Thrall"). Supports state_tags for dynamic status tracking
and DERIVES_FROM relationships between instances and archetypes.
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/entities.pypackages/data-layer/tests/test_tools/test_entity_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_entity(authority: CanonKeeper)neo4j_get_entity(authority: *)neo4j_list_entities(authority: *)neo4j_update_entity(authority: CanonKeeper)neo4j_delete_entity(authority: CanonKeeper)neo4j_set_state_tags(authority: CanonKeeper)Notes:
is_archetypebooleanTesting 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-2.yml