Extracting HCP Campaign KPIs
Markdown--- name: extracting-hcp-campaign-kpis description: Extracts KPIs from pharma HCP (Healthcare Professional) campaign HTML reports, groups related KPIs into tables, and maps the relationships between KPI groups (e.g., engagement KPIs driving ROI KPIs). Use when given an HTML file containing pharma/HCP campaign performance data and the goal is to understand what KPIs exist and how they relate to each other. ---
Given an HTML file with pharma HCP campaign data:
- Parse the HTML and extract every KPI name, value, and the surrounding table/section it belongs to.
- Classify each KPI into a category (e.g., Reach, Engagement, Conversion, ROI/Financial, Compliance).
- Build one small table per category.
- Draw the relationship chain across categories (what feeds what).
- Present: category tables → relationship map → plain-English summary.
Progress:
- Step 1: Open and parse the HTML file (tables, lists, divs, spans — KPIs in pharma reports often sit in
<table>elements or labeled<div>/<span>pairs) - Step 2: Extract every KPI: name, value, unit, time period, and any footnote/definition
- Step 3: Deduplicate and normalize KPI names (e.g., "HCP Reach" vs "Reach (HCPs)" → same KPI)
- Step 4: Categorize KPIs into standard HCP campaign buckets (see below)
- Step 5: Build one table per category with columns: KPI | Value | Definition/Notes
- Step 6: Identify cross-category relationships (causal or sequential flow)
- Step 7: Produce a relationship summary (narrative + simple flow diagram in text)
- Step 8: Flag any KPI that doesn't fit a category or seems orphaned/unexplained
Standard KPI Categories for HCP Campaigns
Use these as default buckets unless the file suggests otherwise:
- Reach/Awareness: HCP Reach, Impressions, Unique HCPs Targeted, Frequency
- Engagement: Email Open Rate, Click-Through Rate, Detailing Visits, Call Attempts, Content Views, Webinar Attendance
- Conversion/Behavior: Prescription Lift, New Rx, Rx Volume, Formulary Adoption, Sample Redemption Rate
- Financial/ROI: Cost per HCP Reached, Cost per Engagement, Marketing ROI, Return on Investment, Cost per Rx
- Compliance/Quality: Opt-out Rate, Consent Rate, MLR (Medical-Legal-Regulatory) Approval Rate
If the file uses different terminology, still map each KPI into the closest matching bucket and note the mapping explicitly.
Finding Relationships
For each pair of category tables, ask: "Does a KPI in Table A causally or sequentially lead to a KPI in Table B?" Typical pharma HCP chains:
Reach → Engagement → Conversion (Rx) → Financial/ROI
↘ Compliance (gates the funnel)
Document relationships as: [KPI A] influences [KPI B] because [reasoning from data/definitions in file].
Example 1: Input: HTML file with a table showing "HCP Reach: 5,000", "Email Open Rate: 32%", "New Rx Written: 420", "Marketing ROI: 3.2x"
Output:
Reach Table:
| KPI | Value |
|-----------|-------|
| HCP Reach | 5,000 |
Engagement Table:
| KPI | Value |
|-----------------|-------|
| Email Open Rate | 32% |
Conversion Table:
| KPI | Value |
|----------------|-------|
| New Rx Written | 420 |
ROI Table:
| KPI | Value |
|--------------|-------|
| Marketing ROI| 3.2x |
Relationships:
- HCP Reach → Email Open Rate: more HCPs reached increases the pool that can engage.
- Email Open Rate → New Rx Written: engaged HCPs are more likely to prescribe, suggesting engagement drives conversion.
- New Rx Written → Marketing ROI: prescriptions generated are the primary revenue driver behind ROI calculation.
Summary: The campaign funnel moves Reach → Engagement → Conversion → ROI, with each upstream KPI acting as a leading indicator for the next.
Example 2: Input: File contains only "Cost per Detailing Visit: $150" and "Formulary Adoption Rate: 18%" with no explicit link.
Output:
Financial Table: Cost per Detailing Visit ($150)
Conversion Table: Formulary Adoption Rate (18%)
Relationship: No direct KPI bridges these two (e.g., no "Detailing Visits per HCP" or "Visits leading to Adoption" metric present).
Flag: Relationship is inferred, not data-backed — recommend requesting a bridging KPI (e.g., visit frequency) to confirm causality.
- Always quote the KPI exactly as it appears in the file before normalizing/renaming it.
- Keep each category table small (3-7 KPIs) — split further if a bucket grows too large.
- State relationships as hypotheses grounded in funnel logic, not assumed facts, unless the file explicitly states causality.
- When a KPI could fit two categories (e.g., "Sample Redemption Rate" could be Engagement or Conversion), pick one and note the ambiguity.
- Preserve time periods/date ranges attached to KPIs — relationships across mismatched time windows are weaker and should be flagged.
- Don't assume correlation shown by adjacent table placement equals causation — verify via definitions/footnotes in the file.
- Don't merge KPIs with similar names but different definitions (e.g., "Reach" at the HCP level vs. impression level).
- Don't ignore compliance/opt-out KPIs — they often gate or suppress other funnel KPIs and are frequently omitted by mistake.
- Don't output one giant table — the goal is small, categorized tables plus an explicit relationship map, not a flat KPI dump.