feat(notion): Implement relational Competitive Radar import
- Added import_relational_radar.py for bidirectional database structure in Notion. - Added refresh_references.py to populate analysis data with grounded facts via scraping. - Updated documentation for Competitive Radar v2.0.
This commit is contained in:
35
refresh_references.py
Normal file
35
refresh_references.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Path to the orchestrator
|
||||
sys.path.append(os.path.join(os.getcwd(), 'competitor-analysis-app'))
|
||||
|
||||
from competitor_analysis_orchestrator import analyze_single_competitor_references
|
||||
|
||||
async def refresh_references():
|
||||
json_path = 'analysis_robo-planet.de.json'
|
||||
|
||||
with open(json_path, 'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
competitors = data.get('competitors_shortlist', [])
|
||||
if not competitors:
|
||||
competitors = data.get('competitor_candidates', [])
|
||||
|
||||
print(f"Refreshing references for {len(competitors)} competitors...")
|
||||
|
||||
tasks = [analyze_single_competitor_references(c) for c in competitors]
|
||||
results = await asyncio.gather(*tasks)
|
||||
|
||||
# Filter and update
|
||||
data['reference_analysis'] = [r for r in results if r is not None]
|
||||
|
||||
with open(json_path, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
print(f"Successfully updated {json_path} with grounded reference data.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(refresh_references())
|
||||
Reference in New Issue
Block a user