Understanding the Observable/Observation Model
Observable: Understanding the Observable/Observation Model
User Intent
"What's the difference between observables and observations? How does the entity model work?"
Operation
Concept: Entity data model
GraphQL Types: Observable, Observation
Entity Types: Observable (entity), Observation (mention)
Common Use Cases: Understanding entities, entity relationships, provenance tracking
The Model Explained
Observable = The entity itself (e.g., Person "Kirk Marple" with unique ID) Observation = A specific mention/occurrence of that entity in content
Relationship: Content → Many Observations → Many Observables
Why This Architecture?
1. Deduplication
"Kirk Marple" mentioned 100 times across documents → 1 Observable, 100 Observations
2. Confidence Scoring
Each observation has its own confidence level (0.0-1.0)
3. Provenance
Track exactly where each entity was found (page number, bounding box, timestamp)
4. Context
Each observation includes location context (page, coordinates, time)
TypeScript (Canonical)
Data Flow
Key Differences
Observable (Entity)
Characteristics:
One per unique entity
Deduplicated automatically
Has canonical properties
Persistent across content
Observation (Mention)
Characteristics:
One per mention in content
Linked to specific content
Has location context
Has confidence score
Multiple per observable
Example: Same Entity, Multiple Observations
Graph Structure
Querying Patterns
Get Content with Observations
Find All Content Mentioning Entity
Get Observable Details
Entity Resolution (Deduplication)
Automatic at Creation Time
Race Conditions
Note: Parallel ingestion can create duplicates due to race conditions. This is a known limitation with future improvements planned.
Get content with observations
content = await graphlit.getContent('content-id')
print(f"Content: {content.content.name}") print(f"Observations: {len(content.content.observations or [])}")
Iterate observations
for obs in content.content.observations or []: print(f"\nEntity: {obs.observable.name}") print(f"Type: {obs.type}") print(f"Entity ID: {obs.observable.id}")
Get observable
result = await graphlit.client.query_observables( filter={"observables": [{"id": "observable-id"}]} )
observable = (result.observables.results or [None])[0] if observable: print(f"Observable: {observable.observable.name}")
Developer Hints
One Observable, Many Observations
Confidence Thresholds
Observation IDs vs Observable IDs
Common Issues & Solutions
Issue: Same person appearing as multiple entities Solution: Entity resolution happens automatically, but race conditions can create duplicates
Issue: Want to find all mentions of an entity Solution: Query by Observable ID
Issue: Need to access entity properties Solution: Use getObservable, not just the observation
Production Example
Last updated
Was this helpful?