feat(notion): Finalize Competitive Radar v3.0 (Level 3 Relational Model)

- Extended import_relational_radar.py to include a 'Products' database.
- Implemented full dual-way relations for Companies <-> Landmines, References, Products.
- Updated documentation to reflect the 4-database architecture.
This commit is contained in:
2026-01-11 12:14:45 +00:00
parent e1d115e0ba
commit 9a769f62a0
3 changed files with 50 additions and 13 deletions

View File

@@ -6,12 +6,13 @@ import sys
# Configuration
JSON_FILE = 'analysis_robo-planet.de.json'
TOKEN_FILE = 'notion_token.txt'
PARENT_PAGE_ID = "2e088f42-8544-8024-8289-deb383da3818"
PARENT_PAGE_ID = "2e088f42-8544-8024-8289-deb383da3818"
# Database Titles
DB_TITLE_HUB = "📦 Competitive Radar (Companies)"
DB_TITLE_LANDMINES = "💣 Competitive Radar (Landmines & Intel)"
DB_TITLE_REFS = "🏆 Competitive Radar (References)"
DB_TITLE_PRODUCTS = "🤖 Competitive Radar (Products)"
def load_json_data(filepath):
try:
@@ -81,7 +82,7 @@ def main():
token = load_notion_token(TOKEN_FILE)
data = load_json_data(JSON_FILE)
print("🚀 Starting Relational Import...")
print("🚀 Starting Relational Import (Level 3 - Full Radar)...")
# --- STEP 1: Define & Create Competitors Hub DB ---
props_hub = {
@@ -130,6 +131,19 @@ def main():
}
refs_db_id = create_database(token, PARENT_PAGE_ID, DB_TITLE_REFS, props_refs)
# Products DB
props_products = {
"Product Name": {"title": {}},
"Purpose / Description": {"rich_text": {}},
"Related Competitor": {
"relation": {
"database_id": hub_db_id,
"dual_property": {"synced_property_name": "Related Products"}
}
}
}
products_db_id = create_database(token, PARENT_PAGE_ID, DB_TITLE_PRODUCTS, props_products)
# --- STEP 3: Import Competitors (and store IDs) ---
competitor_map = {} # Maps Name -> Notion Page ID
@@ -156,10 +170,10 @@ def main():
# Create Page
props = {
"Name": {"title": [{"text": {"content": c_name}}]},
"Portfolio Summary": {"rich_text": [{"text": {"content": portfolio_text[:2000]}}]},
"Portfolio Summary": {"rich_text": [{"text": {"content": portfolio_text[:2000]}}]}, # Limit length
"USPs": {"rich_text": [{"text": {"content": usps[:2000]}}]},
"Silver Bullet": {"rich_text": [{"text": {"content": silver_bullet[:2000]}}]},
"Target Industries": {"multi_select": [{"name": i.replace(',', '')} for i in industries]},
"Target Industries": {"multi_select": [{"name": i.replace(',', '')} for i in industries]}
}
if c_url: props["Website"] = {"url": c_url}
@@ -185,10 +199,8 @@ def main():
create_page(token, landmines_db_id, props)
# 2. Weaknesses
# The JSON has "strengths_vs_weaknesses" combined. We'll import them as general Intel points.
for point in card.get('strengths_vs_weaknesses', []):
# Try to guess type based on text, or just default to Weakness context from Battlecard
p_type = "Competitor Weakness" # Assuming these are points for us to exploit
p_type = "Competitor Weakness"
props = {
"Statement / Question": {"title": [{"text": {"content": point}}]},
"Type": {"select": {"name": p_type}},
@@ -224,7 +236,30 @@ def main():
count_refs += 1
print(f" - {count_refs} References imported.")
print("\n✅ Relational Import Complete!")
# --- STEP 6: Import Products (Portfolio) ---
print("\nImporting Products...")
count_prods = 0
for analysis in data.get('analyses', []):
c_name = analysis.get('competitor', {}).get('name')
comp_page_id = competitor_map.get(c_name)
if not comp_page_id: continue
for prod in analysis.get('portfolio', []):
p_name = prod.get('product', 'Unknown Product')
p_purpose = prod.get('purpose', '')
props = {
"Product Name": {"title": [{"text": {"content": p_name}}]},
"Purpose / Description": {"rich_text": [{"text": {"content": p_purpose[:2000]}}]},
"Related Competitor": {"relation": [{"id": comp_page_id}]}
}
create_page(token, products_db_id, props)
count_prods += 1
print(f" - {count_prods} Products imported.")
print("\n✅ Relational Import Complete (Level 3)!")
if __name__ == "__main__":
main()
main()