Datos y fechas en conflicto
Anote los conflictos; las fechas resuelven contradicciones aparentes.
Datos y fechas en conflicto es una lección gratuita de Claude Architect en CoddyKit. Esta es la lección 2 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Claude Architect, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Claude Architect incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
When Sources Disagree
In a multi-agent research system, two subagents can return facts that flatly contradict each other. One source says a company has 8,000 employees; another says 12,000. The naive move is to silently pick one and report it as truth.
That is an anti-pattern. The architect-grade answer is to annotate the conflict and preserve both claims with their provenance, so a human (or a downstream model) can adjudicate. This lesson teaches how conflicting data is surfaced, and how dates often resolve apparent contradictions that look irreconcilable at first glance.
Provenance Is the Foundation
You cannot annotate a conflict you cannot trace. Provenance means keeping a claim → source mapping for every fact: the URL or document name, the exact quote, and crucially the publication date.
Without this mapping, a contradiction is just noise. With it, you can show the user precisely where each number came from and when it was published — the raw material for resolving disagreement.
claim = {
"statement": "Headcount is 12,000",
"source_name": "Q4 2025 Annual Report",
"url": "https://example.com/ar-2025.pdf",
"quote": "As of Dec 31, 2025, we employed 12,000 people.",
"published": "2026-02-15",
}Annotate, Don't Arbitrate
The core rule: annotate conflicting stats rather than arbitrarily picking one. When sources disagree, the system should NOT collapse them into a single "winner" by coin-flip, recency-bias, or whichever subagent answered last.
Instead, render both claims side by side, each tagged with its source and date, and explicitly flag that they conflict. The model's job is to surface the disagreement with enough context that a human can decide — not to hide it.
Dates Resolve Apparent Contradictions
Here is the key insight of this lesson: many "contradictions" are not contradictions at all — they are two correct snapshots from different points in time.
"Revenue is $4.2B" (FY2023) and "Revenue is $5.1B" (FY2025) do not conflict. They are both true, on their own dates. Once you attach publication and as-of dates to each claim, the apparent contradiction dissolves into a timeline. This is why the publication date is a first-class field in provenance.
Structured Output for Conflict Records
To make conflict annotation reliable, force the model into a JSON Schema via tool_use. This eliminates syntax errors and enforces required fields. A conflict record should carry every claim with its value, source, and date — plus a resolution note.
Set tool_choice: "any" when you must guarantee structured output (the model must call some tool rather than reply with free text).
tools = [{
"name": "record_conflict",
"description": "Record two or more conflicting claims with provenance and a date-based resolution.",
"input_schema": {
"type": "object",
"properties": {
"metric": {"type": "string"},
"claims": {"type": "array", "items": {"type": "object"}},
"resolution": {"type": "string"},
},
"required": ["metric", "claims"],
},
}]
# Force structured output
resp = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
tools=tools,
tool_choice={"type": "any"},
messages=messages,
)Never Require a Possibly-Absent Field
A subtle but exam-critical schema rule: mark a field required only if it is always present. If a source genuinely lacks a publication date, do NOT make published required — a required-but-absent field pushes the model to fabricate one, which silently destroys your date-based resolution.
In the conflict schema above, metric and claims are required; resolution and each claim's published date are optional. Better an honest null than a hallucinated date.
"properties": {
"value": {"type": "string"},
"source_name": {"type": "string"},
"published": {"type": "string", "description": "ISO date if stated; omit if absent"},
},
"required": ["value", "source_name"] # published intentionally NOT requiredExplicit Criteria Beat Vague Instructions
How you instruct the model matters. "Be careful with conflicting data" is vague and inconsistent. An explicit criterion is far stronger:
- "Flag two values as conflicting only when they describe the same metric for the same entity."
- "Before flagging, compare their as-of dates; if the dates differ, treat them as a time series, not a contradiction."
Explicit, testable criteria produce repeatable conflict detection. Vague adjectives do not.
Few-Shot the Date Distinction
Conflict-vs-timeline is exactly the kind of ambiguity where 2–4 targeted few-shot examples shine. The model generalizes from them — it doesn't just memorize the specific numbers.
Give one example of a genuine conflict (same date, different values → flag it) and one example of a date-resolved non-conflict (different dates → report as a timeline). The model learns the decision boundary and applies it to unseen metrics.
examples = [
{"a": "Rev $4.2B (FY2023)", "b": "Rev $5.1B (FY2025)",
"verdict": "NOT a conflict — different fiscal years; report as timeline"},
{"a": "Headcount 8,000 (as of 2026-01)", "b": "Headcount 12,000 (as of 2026-01)",
"verdict": "CONFLICT — same date, same metric; annotate both with sources"},
]Keep Dates Verbatim in Case Facts
Long research runs get summarized to fit the context window — and progressive summarization makes numbers, percentages, and dates vague. "Published in early 2026" is useless when the whole resolution hinges on Q1 vs Q3.
The fix: pull transactional facts — exact values, sources, and dates — into a separate "case facts" block kept verbatim outside the summary. Summarize the prose; never summarize the dates you need to resolve conflicts.
case_facts = (
"VERBATIM — DO NOT SUMMARIZE:\n"
"- Headcount 8,000 | src: 10-K | published 2025-03-01\n"
"- Headcount 12,000 | src: Press release | published 2026-02-15\n"
)
# Keep separate from the rolling conversation summarySelf-Correction Detects Discrepancies
To catch conflicts mechanically, have the model extract competing values explicitly rather than emitting a single blended figure. In extraction this is the calculated_total vs stated_total pattern; in research it is value-from-source-A vs value-from-source-B.
Once both are surfaced as distinct fields, a Pydantic-style validator can compare them, detect the mismatch, and trigger the conflict-annotation path — no silent averaging.
from pydantic import BaseModel
class MetricClaim(BaseModel):
source: str
value: float
published: str | None = None
def detect_conflict(a: MetricClaim, b: MetricClaim) -> bool:
if a.published and b.published and a.published != b.published:
return False # date resolves it: timeline, not conflict
return a.value != b.valueRender by Content Type
Once conflicts are annotated and dates reconciled, present the result so a human can adjudicate fast. Match the rendering to the content type:
- Tables for financials and competing numeric claims — one row per source, columns for value, source, and date.
- Prose for news and narrative context.
- Lists for technical findings.
A side-by-side table makes a same-date conflict jump out, and a date-ordered table reveals a timeline instantly — turning raw provenance into an oversight-ready view.
Quick Check: Two Numbers, Two Dates
A research subagent returns: Source X says ARR is $40M (published Mar 2024); Source Y says ARR is $58M (published Feb 2026). Your aggregator must report this to the user. What is the correct architecture-grade behavior?
Recap: Conflicts & Dates
Key takeaways for conflicting data and provenance:
- Annotate, don't arbitrate — surface conflicting claims with sources; never silently pick one.
- Dates resolve apparent contradictions — different as-of dates mean a timeline, not a conflict.
- Provenance is mandatory — keep claim → source mappings with URL, quote, and publication date.
- Keep dates verbatim in a separate case-facts block; summarization makes dates vague.
- Don't require absent fields — an optional null date beats a fabricated one.
- Render by type — tables for numbers so conflicts and timelines are obvious to the human reviewer.
Preguntas frecuentes
¿La lección «Datos y fechas en conflicto» es gratis?
Sí — el texto completo de «Datos y fechas en conflicto» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Claude Architect, actualiza a CoddyKit PRO. El curso de Claude Architect incluye 4 lecciones en total.
¿Qué aprenderé en «Datos y fechas en conflicto»?
Anote los conflictos; las fechas resuelven contradicciones aparentes. Practicas Claude Architect con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Claude Architect?
No se requiere experiencia previa. Claude Architect en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 2 de 4.
¿Cuánto tiempo toma la lección «Datos y fechas en conflicto»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Claude Architect?
Sí. Cada lección de Claude Architect incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Correspondencia entre afirmaciones y fuentes
- Datos y fechas en conflicto
- Las métricas agregadas ocultan fallos
- Muestreo estratificado y calibración