phase 17: quote reserved word 'window' in all SQL queries across recommendation worker and query API
This commit is contained in:
@@ -208,7 +208,7 @@
|
|||||||
- Debug any Ollama connection or schema validation issues
|
- Debug any Ollama connection or schema validation issues
|
||||||
- _Requirements: 5.1, 5.2, 6.1, 6.2, 6.3_
|
- _Requirements: 5.1, 5.2, 6.1, 6.2, 6.3_
|
||||||
|
|
||||||
- [-] 17.5 Validate aggregation produces trend summaries
|
- [x] 17.5 Validate aggregation produces trend summaries
|
||||||
- Check aggregation worker logs for trend window generation
|
- Check aggregation worker logs for trend window generation
|
||||||
- Verify `trend_windows` table has entries with direction, strength, confidence
|
- Verify `trend_windows` table has entries with direction, strength, confidence
|
||||||
- Verify `trend_evidence` table links trends to contributing documents
|
- Verify `trend_evidence` table links trends to contributing documents
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
- Check the dashboard Trends page shows trend cards with real data
|
- Check the dashboard Trends page shows trend cards with real data
|
||||||
- _Requirements: 7.1, 7.2, 7.3_
|
- _Requirements: 7.1, 7.2, 7.3_
|
||||||
|
|
||||||
- [ ] 17.6 Validate recommendation engine produces paper-trade recommendations
|
- [-] 17.6 Validate recommendation engine produces paper-trade recommendations
|
||||||
- Check recommendation worker logs for recommendation generation
|
- Check recommendation worker logs for recommendation generation
|
||||||
- Verify `recommendations` table has entries with action, confidence, thesis
|
- Verify `recommendations` table has entries with action, confidence, thesis
|
||||||
- Verify `recommendation_evidence` links recommendations to documents
|
- Verify `recommendation_evidence` links recommendations to documents
|
||||||
|
|||||||
+5
-5
@@ -351,13 +351,13 @@ async def list_trends(
|
|||||||
params.append(ticker.upper())
|
params.append(ticker.upper())
|
||||||
idx += 1
|
idx += 1
|
||||||
if window:
|
if window:
|
||||||
conditions.append(f"window = ${idx}")
|
conditions.append(f"\"window\" = ${idx}")
|
||||||
params.append(window)
|
params.append(window)
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
||||||
where = " AND ".join(conditions)
|
where = " AND ".join(conditions)
|
||||||
rows = await pool.fetch(
|
rows = await pool.fetch(
|
||||||
f"""SELECT id, entity_type, entity_id, window, trend_direction,
|
f"""SELECT id, entity_type, entity_id, "window", trend_direction,
|
||||||
trend_strength, confidence, top_supporting_evidence,
|
trend_strength, confidence, top_supporting_evidence,
|
||||||
top_opposing_evidence, dominant_catalysts, material_risks,
|
top_opposing_evidence, dominant_catalysts, material_risks,
|
||||||
contradiction_score, market_context, generated_at
|
contradiction_score, market_context, generated_at
|
||||||
@@ -383,7 +383,7 @@ async def list_trends(
|
|||||||
async def get_trend(trend_id: str):
|
async def get_trend(trend_id: str):
|
||||||
"""Get a single trend summary by ID."""
|
"""Get a single trend summary by ID."""
|
||||||
row = await pool.fetchrow(
|
row = await pool.fetchrow(
|
||||||
"""SELECT id, entity_type, entity_id, window, trend_direction,
|
"""SELECT id, entity_type, entity_id, "window", trend_direction,
|
||||||
trend_strength, confidence, top_supporting_evidence,
|
trend_strength, confidence, top_supporting_evidence,
|
||||||
top_opposing_evidence, dominant_catalysts, material_risks,
|
top_opposing_evidence, dominant_catalysts, material_risks,
|
||||||
contradiction_score, market_context, generated_at, created_at
|
contradiction_score, market_context, generated_at, created_at
|
||||||
@@ -637,7 +637,7 @@ async def get_recommendation_evidence_drilldown(recommendation_id: str):
|
|||||||
generated_at = rec_row["generated_at"]
|
generated_at = rec_row["generated_at"]
|
||||||
if ticker and generated_at:
|
if ticker and generated_at:
|
||||||
trend_row = await pool.fetchrow(
|
trend_row = await pool.fetchrow(
|
||||||
"""SELECT id, entity_type, entity_id, window, trend_direction,
|
"""SELECT id, entity_type, entity_id, "window", trend_direction,
|
||||||
trend_strength, confidence, top_supporting_evidence,
|
trend_strength, confidence, top_supporting_evidence,
|
||||||
top_opposing_evidence, dominant_catalysts, material_risks,
|
top_opposing_evidence, dominant_catalysts, material_risks,
|
||||||
contradiction_score, market_context, generated_at
|
contradiction_score, market_context, generated_at
|
||||||
@@ -691,7 +691,7 @@ async def get_trend_evidence_drilldown(trend_id: str):
|
|||||||
Requirements: 10.4, 6.5
|
Requirements: 10.4, 6.5
|
||||||
"""
|
"""
|
||||||
trend_row = await pool.fetchrow(
|
trend_row = await pool.fetchrow(
|
||||||
"""SELECT id, entity_type, entity_id, window, trend_direction,
|
"""SELECT id, entity_type, entity_id, "window", trend_direction,
|
||||||
trend_strength, confidence, top_supporting_evidence,
|
trend_strength, confidence, top_supporting_evidence,
|
||||||
top_opposing_evidence, dominant_catalysts, material_risks,
|
top_opposing_evidence, dominant_catalysts, material_risks,
|
||||||
contradiction_score, market_context, generated_at
|
contradiction_score, market_context, generated_at
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ WHERE d.id = ANY(
|
|||||||
|| COALESCE(tw.top_opposing_evidence, '[]'::jsonb)
|
|| COALESCE(tw.top_opposing_evidence, '[]'::jsonb)
|
||||||
)::uuid
|
)::uuid
|
||||||
FROM trend_windows tw
|
FROM trend_windows tw
|
||||||
WHERE tw.entity_id = $1 AND tw.window = $2
|
WHERE tw.entity_id = $1 AND tw."window" = $2
|
||||||
ORDER BY tw.generated_at DESC
|
ORDER BY tw.generated_at DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
)
|
)
|
||||||
@@ -117,12 +117,12 @@ async def fetch_data_quality_context(
|
|||||||
|
|
||||||
_LATEST_TREND_QUERY = """
|
_LATEST_TREND_QUERY = """
|
||||||
SELECT
|
SELECT
|
||||||
entity_type, entity_id, window, trend_direction, trend_strength,
|
entity_type, entity_id, "window", trend_direction, trend_strength,
|
||||||
confidence, top_supporting_evidence, top_opposing_evidence,
|
confidence, top_supporting_evidence, top_opposing_evidence,
|
||||||
dominant_catalysts, material_risks, contradiction_score,
|
dominant_catalysts, material_risks, contradiction_score,
|
||||||
disagreement_details, market_context, generated_at
|
disagreement_details, market_context, generated_at
|
||||||
FROM trend_windows
|
FROM trend_windows
|
||||||
WHERE entity_id = $1 AND window = $2
|
WHERE entity_id = $1 AND "window" = $2
|
||||||
ORDER BY generated_at DESC
|
ORDER BY generated_at DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user