Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 99 additions & 55 deletions skills/top10ranking.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# RealRate Top 10 Infographic Generator

Generates a **2160 × 2160 px LinkedIn-ready PNG** from live data at `realrate-archive.com`.
Generates a **1200 × 1500 px portrait LinkedIn infographic** from live data at `realrate-archive.com`, plus a matching LinkedIn caption `.txt`.

Script: `generate_infographic.py`

---
Expand All @@ -11,7 +12,7 @@ Script: `generate_infographic.py`
python generate_infographic.py <industry_slug>
```

Output: `output/<slug>_<year>.png`
Output: `output/<slug>_<year>.png` and `output/linkedin_<slug>_<year>.txt`

## Available slugs

Expand All @@ -30,87 +31,130 @@ Key: `Pillow>=10.0.0`, `pandas>=2.0.0`, `openpyxl>=3.1.0`, `xlrd>=2.0.1`, `reque

---

## Logo fixes
## Infographic design

### Canvas
- **Size**: 1200 × 1500 px (portrait, LinkedIn-optimised)
- **Layout**: 2-column × 5-row ranking cards, header, footer

### Per-industry color rebrand
Every industry gets a distinct background, accent color, card gradient, and bold background pattern. The accent (`I_NEON`) drives all colored elements: borders, glow, icon, subtitle, ECR values, badges, footer.

| Industry | Accent | Background | Pattern |
|---|---|---|---|
| Motor | Racing blue `(30,160,255)` | Carbon black-blue | Speed streaks, speedometer arc |
| Air | Sky blue `(55,210,255)` | Midnight sky | Contrails, horizon arcs, compass rose |
| Software | Matrix green `(0,255,120)` | Dark matrix | Network graph, code rain |
| Computers | Electric indigo `(80,160,255)` | Dark indigo | PCB traces, chip diagram |
| Finance | Gold `(240,168,32)` | Dark amber | Candlestick charts, trend lines |
| Health/Pharma | Medical teal `(0,230,185)` | Dark teal | ECG line, molecular lattice |
| Energy/Petrol | Flame orange `(255,120,0)` | Oil black | Radial streaks, lightning bolt |
| Food | Leaf green `(95,220,45)` | Dark forest | Organic waves, honeycomb |

Background patterns use **bold alpha** (~3× original) so they're clearly visible.

### Header
- Left: RealRate logo with neon glow halo
- Center: Title (extrabold white) + subtitle (`I_NEON` accent)
- Right: Industry icon (142 px, `I_NEON` accent, with glow halo)
- **Motor icon**: F1 steering wheel — double ring, thick spokes, grip notches, filled hub

### Ranking cards
- **Top 3**: deep industry-colored gradient + neon accent border + left glow bar
- **Top-rated rank 4+**: dark glassmorphism + multi-layer neon glow border
- **Standard**: dark glassmorphism + dim border
- Each card: rank badge (accent fill), company name, `ECR X%` (bright label + white value), trend arrow ↑↓–, `★ TOP RATED` pill when applicable

### Color variables in `generate()`
| Variable | Purpose |
|---|---|
| `I_NEON` | Primary accent — borders, icon, subtitle, all glow elements |
| `I_NEON_BRIGHT` | Icon & subtitle bright rendering (= `I_NEON`) |
| `I_NEON_HI` | ECR % value (`I_NEON + 85` per channel) |
| `I_MUTED` | ECR label `(210,225,238,240)` — neutral bright white |
| `I_ACCENT` | Rank badge fill, TOP RATED pill gradient |
| `I_DIM` | Standard card border |
| `I_DARK` | Badge outline / pill gradient end |

**Manual override** — drop a PNG at `assets/logos/<company_name_lowercase_underscores>.png`
Example: `Visteon CORP` → `assets/logos/visteon_corp.png`
---

**Domain hint** — add to `_DOMAIN_HINTS` in `generate_infographic.py`, then delete the bad cached file in `assets/logos/`. Use this whenever a logo is wrong or missing.
## LinkedIn caption (auto-generated)

**White/light logo detection** — `_logo_is_light()` automatically detects logos where ≥60% of visible pixels have brightness >200 (white-on-transparent). These are rendered on a near-black `(18, 18, 18)` background instead of the default white box, so the logo stays visible. No manual action needed — applies to any industry automatically.
Written to `output/linkedin_<slug>_<year>.txt` alongside every PNG.

Current domain overrides:
### Format
```
🏆 TOP 10 US [INDUSTRY] COMPANIES [YEAR]
RealRate Financial Strength Rankings using Artificial Intelligence

| Company | Domain |
|---------|--------|
| Bristow Group Inc | `bristowgroup.com` |
| Allegiant Travel CO | `allegiantair.com` |
| Strata Critical Medical Inc | `stratacritical.com` |
| Abrdn (all ETF trusts) | `abrdn.com` |
[2-sentence industry hook]

---
At RealRate, our explainable AI framework quantifies financial resilience through ECR...

Market average ECR: X%

🥇 #1 Company — ECR: X% TOP RATED
[2-sentence description: ECR vs average + trend]

## LinkedIn post generation
🥈 #2 Company — ECR: X% TOP RATED
[2-sentence description]

**Always generate both** — whenever you write a LinkedIn post, also run `generate_infographic.py` to produce the matching PNG.
🥉 #3 Company — ECR: X% TOP RATED
[2-sentence description]

### Rules
#4 Company — ECR: X% TOP RATED
[1-sentence description: ECR vs average only]

- **Title:** `🏆 TOP 10 US [INDUSTRY] COMPANIES RANKING [CURRENT YEAR]`
- **Subtitle:** `RealRate Financial Strength Rankings using Artificial Intelligence`
- **Data:** Fetch `https://realrate-archive.com/us_{slug}/{latest_year}/website-ranking.json` (use `curl -sk`). ECR = `value` × 100, rounded. Latest year = highest number in the directory listing.
- **Company scope:** Never say "US-listed". Use "US Motor companies", "US Software companies", etc.
- **Hook:** Two sharp, industry-specific sentences ending with *"Here is who is built to last."* Fresh every post — never reuse or echo a previous hook. First sentence must be a specific, surprising insight, not a generic opener.
- **Methodology block** (fixed, verbatim every time):
> At RealRate, we go beyond correlation.
> Our explainable AI framework reveals not just where each company stands, but why. Giving you a clear view of the underlying drivers of financial resilience, risk exposure, and long-term stability. At the core is Economic Capital Ratio (ECR) — a forward-looking metric that measures how efficiently a company converts its economic value into balance sheet strength, enabling true comparability across size and business models.
- **Market average:** One line after methodology block: `Market average ECR: X%`
- **Top 3:** Medal emoji + rank + name + ECR% + 2–3 tight sentences (strength driver, pp above market, rank trend, punchy "so what").
- **Ranks 4–10:** `#4 Name (X%) | #5 Name (X%) | … | #10 Name (X%)`
- **CTA:** One punchy, industry-specific question. Never reuse. No generic filler.
- **Link:** `🔗 https://realrate.ai/rankings/us_[industry]/[current year]`
- **Hashtags:** Exactly 8. Always: `#Finance #AI #Investing #RealRate #FinancialHealth #FinancialAnalysis` + 1 industry tag + 1 company name from top 3. Never use: `#Technology #Innovation #StockMarket #USStocks #TopRated #CloudComputing #Cybersecurity`
Also in the ranking:
#N Company (X%) | ...

### Post template
[Engagement question]

Full ranking + individual company reports:
🔗 https://realrate.ai/rankings/us_[industry]/[year]

#Finance #AI #Investing #RealRate ... [industry hashtags]
```
🏆 TOP 10 US [INDUSTRY] COMPANIES RANKING [YEAR]
RealRate Financial Strength Rankings using Artificial Intelligence

[Hook — two sentences, industry-specific, ends with "Here is who is built to last."]
### Description rules
- **Top 3 (rank 1–3)**: 2 sentences — ECR position vs sector average + trend
- **Top-rated rank 4+**: 1 sentence — ECR position only
- **Non-top-rated**: no description, listed under "Also in the ranking"
- No `★` icon in caption labels (only on the infographic badge)

At RealRate, we go beyond correlation.
Our explainable AI framework reveals not just where each company stands, but why. Giving you a clear view of the underlying drivers of financial resilience, risk exposure, and long-term stability. At the core is Economic Capital Ratio (ECR) — a forward-looking metric that measures how efficiently a company converts its economic value into balance sheet strength, enabling true comparability across size and business models.
### Year logic
- **Title + filename + URL**: `datetime.date.today().year` (current calendar year)
- **Archive fetch**: uses latest year from the archive directory listing

Market average ECR: X%
---

🥇 #1 [Company] — ECR: [X]%
[2–3 sentences.]
## Logo fixes

🥈 #2 [Company] — ECR: [X]%
[2–3 sentences.]
**Manual override** — drop a PNG at `assets/logos/<company_name_lowercase_underscores>.png`
Example: `Visteon CORP` → `assets/logos/visteon_corp.png`

🥉 #3 [Company] — ECR: [X]%
[2–3 sentences.]
**Domain hint** — add to `_DOMAIN_HINTS` in `generate_infographic.py`, then delete the cached file in `assets/logos/`.

Also in the top 10:
#4 [Name] ([X]%) | #5 [Name] ([X]%) | #6 [Name] ([X]%) | #7 [Name] ([X]%) | #8 [Name] ([X]%) | #9 [Name] ([X]%) | #10 [Name] ([X]%)
**White/light logo detection** — `_logo_is_light()` auto-detects logos where ≥60% of visible pixels have brightness >200 and renders them on a near-black `(18,18,18)` box instead of white.

[Fresh CTA]
Current domain overrides:

Full ranking + individual company reports:
🔗 https://realrate.ai/rankings/us_[industry]/[current year]
| Company | Domain |
|---------|--------|
| Bristow Group Inc | `bristowgroup.com` |
| Allegiant Travel CO | `allegiantair.com` |
| Strata Critical Medical Inc | `stratacritical.com` |
| Abrdn (all ETF trusts) | `abrdn.com` |

#Finance #AI #Investing #RealRate #FinancialHealth #FinancialAnalysis #[IndustryTag] #[CompanyName]
```
---

### JSON field reference
## JSON field reference

| Field | Meaning |
|-------|---------|
| `name` | Company name |
| `rank` | Integer rank |
| `value` | ECR as decimal (e.g. `0.85` = 85%) |
| `value` | ECR as decimal (e.g. `1.88` = 188%) |
| `trend` | Rank change (positive = rising) |
| `top_rated` | Boolean — show TOP RATED badge if true |
| `report_text` | HTML narrative — strip `<br/>` tags before use |
| `logo_url_256x256` | Direct archive logo URL (tried first in logo pipeline) |