company-intelligence 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Surendran B
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: company-intelligence
3
+ Version: 0.1.0
4
+ Summary: Comprehensive B2B Account Dossier, SEC Financials, USPTO Patents & Tech Stack Registry Engine
5
+ Author-email: Surendran B <reachsuren@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/surendranb/company-intelligence
8
+ Project-URL: Repository, https://github.com/surendranb/company-intelligence
9
+ Project-URL: Issues, https://github.com/surendranb/company-intelligence/issues
10
+ Keywords: mcp,company-intelligence,b2b,sec-edgar,patents,dns-fingerprint,dossier,uspto
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Office/Business :: Financial
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: mcp<3,>=2.0.0
23
+ Requires-Dist: requests>=2.31.0
24
+ Requires-Dist: dnspython>=2.6.0
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest>=8.0.0; extra == "test"
27
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "test"
28
+ Provides-Extra: publish
29
+ Requires-Dist: build>=1.2.2; extra == "publish"
30
+ Requires-Dist: twine>=5.1.1; extra == "publish"
31
+ Dynamic: license-file
32
+
33
+ # 🏢 company-intelligence
34
+
35
+ [![PyPI version](https://img.shields.io/pypi/v/company-intelligence.svg?color=blue)](https://pypi.org/project/company-intelligence/)
36
+ [![NPM version](https://img.shields.io/npm/v/company-intelligence.svg?color=green)](https://www.npmjs.com/package/company-intelligence)
37
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
38
+ [![MCP 2.0](https://img.shields.io/badge/MCP-2.0-purple.svg)](https://modelcontextprotocol.io/)
39
+ [![Zero Auth Required](https://img.shields.io/badge/auth-zero_keys_required-brightgreen.svg)](#)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
41
+
42
+ > **Comprehensive B2B Account Dossier, SEC GAAP Financials, USPTO/Crossref R&D IP & Live Tech Stack Registry Engine for AI Agents.**
43
+
44
+ `company-intelligence` compresses massive regulatory filings, patent registries, DNS records, and federal procurement datasets into clean, token-efficient executive account dossiers. **Zero API keys or authentication required.**
45
+
46
+ ---
47
+
48
+ ## 🚀 Quick Start
49
+
50
+ ### ⚡ Option 1: Universal 1-Line Installer
51
+ ```bash
52
+ curl -fsSL https://company-intelligence.builditwithai.xyz/install | bash
53
+ ```
54
+
55
+ ### 🐍 Option 2: Run via Python (`uvx`)
56
+ ```bash
57
+ uvx company-intelligence
58
+ ```
59
+
60
+ ### 📦 Option 3: Run via Node (`npx`)
61
+ ```bash
62
+ npx -y company-intelligence
63
+ ```
64
+
65
+ ---
66
+
67
+ ## 🛠️ Model Context Protocol (MCP) Setup
68
+
69
+ Add `company-intelligence` directly to your agent client configuration:
70
+
71
+ ### 🤖 Claude Desktop / Claude Code
72
+ Add to `claude_desktop_config.json`:
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "company-intelligence": {
77
+ "command": "uvx",
78
+ "args": ["--from", "company-intelligence", "company-intelligence"]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ ### 💻 Cursor / Windsurf / Antigravity
85
+ Add to your IDE MCP settings:
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "company-intelligence": {
90
+ "command": "npx",
91
+ "args": ["-y", "company-intelligence"]
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 🧭 Intelligence Dimensions
100
+
101
+ `company-intelligence` provides multi-source verification across 5 enterprise intelligence layers:
102
+
103
+ 1. **📊 Audited US-GAAP Financials**: 5-year standardized tables from SEC EDGAR Company Facts (Revenue, Gross Margin %, Operating Margin %, Net Income, R&D Expense, Operating Cash Flow).
104
+ 2. **📑 Regulatory Disclosures**: Recent 10-K, 10-Q, 8-K material event filings, Form 4 insider transactions, and Form 144 disclosures with direct SEC archive links.
105
+ 3. **🌐 Live Tech Stack Fingerprint**: Real-time DNS probe (MX, TXT/SPF, NS) identifying email infrastructure (Google Workspace vs M365), cloud hosting/CDN, and 20+ SaaS tool signatures (Salesforce, Stripe, PostHog, Datadog, Hubspot).
106
+ 4. **🔬 R&D IP & Engineering Velocity**: Corporate technical publications, conference proceedings (IEEE, ACM, CVPR), and granted patent filings.
107
+ 5. **🏛️ US Federal Procurement**: Historical prime contractor federal awards and funding agencies via USAspending.gov.
108
+
109
+ ---
110
+
111
+ ## 📡 Available Tools
112
+
113
+ | Tool Name | Parameters | Description |
114
+ |---|---|---|
115
+ | `get_company_dossier` | `query` *(ticker or domain)* | 1-call comprehensive B2B account dossier combining financials, filings, tech stack, R&D, and federal contracts. |
116
+ | `get_financial_statements` | `ticker_or_cik`, `periods` | Standardized 5-year annual US-GAAP financial metrics and margin trends. |
117
+ | `get_tech_stack_fingerprint` | `domain` | Live DNS inspection detecting email, hosting, security posture, and SaaS vendor signatures. |
118
+ | `get_sec_filings_radar` | `ticker_or_cik`, `limit` | Recent regulatory filings and material event disclosures from SEC EDGAR. |
119
+ | `get_patent_portfolio` | `company_name`, `max_patents` | Corporate engineering publications, conference papers, and patent filings. |
120
+ | `get_federal_contracts` | `company_name`, `limit` | US federal contract procurement history and prime award values. |
121
+ | `skill_read` | `skill_name` | Load bundled operational skills and account intelligence prompts dynamically. |
122
+ | `skills_list` | *(none)* | List available operational skills. |
123
+
124
+ ---
125
+
126
+ ## 🔒 Telemetry
127
+
128
+ To opt out of anonymous usage telemetry:
129
+ ```bash
130
+ export DO_NOT_TRACK=1
131
+ ```
132
+
133
+ ---
134
+
135
+ ## 📄 License
136
+
137
+ MIT License. Free and open source for all developers and AI agents.
@@ -0,0 +1,105 @@
1
+ # 🏢 company-intelligence
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/company-intelligence.svg?color=blue)](https://pypi.org/project/company-intelligence/)
4
+ [![NPM version](https://img.shields.io/npm/v/company-intelligence.svg?color=green)](https://www.npmjs.com/package/company-intelligence)
5
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
6
+ [![MCP 2.0](https://img.shields.io/badge/MCP-2.0-purple.svg)](https://modelcontextprotocol.io/)
7
+ [![Zero Auth Required](https://img.shields.io/badge/auth-zero_keys_required-brightgreen.svg)](#)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ > **Comprehensive B2B Account Dossier, SEC GAAP Financials, USPTO/Crossref R&D IP & Live Tech Stack Registry Engine for AI Agents.**
11
+
12
+ `company-intelligence` compresses massive regulatory filings, patent registries, DNS records, and federal procurement datasets into clean, token-efficient executive account dossiers. **Zero API keys or authentication required.**
13
+
14
+ ---
15
+
16
+ ## 🚀 Quick Start
17
+
18
+ ### ⚡ Option 1: Universal 1-Line Installer
19
+ ```bash
20
+ curl -fsSL https://company-intelligence.builditwithai.xyz/install | bash
21
+ ```
22
+
23
+ ### 🐍 Option 2: Run via Python (`uvx`)
24
+ ```bash
25
+ uvx company-intelligence
26
+ ```
27
+
28
+ ### 📦 Option 3: Run via Node (`npx`)
29
+ ```bash
30
+ npx -y company-intelligence
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 🛠️ Model Context Protocol (MCP) Setup
36
+
37
+ Add `company-intelligence` directly to your agent client configuration:
38
+
39
+ ### 🤖 Claude Desktop / Claude Code
40
+ Add to `claude_desktop_config.json`:
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "company-intelligence": {
45
+ "command": "uvx",
46
+ "args": ["--from", "company-intelligence", "company-intelligence"]
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### 💻 Cursor / Windsurf / Antigravity
53
+ Add to your IDE MCP settings:
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "company-intelligence": {
58
+ "command": "npx",
59
+ "args": ["-y", "company-intelligence"]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ---
66
+
67
+ ## 🧭 Intelligence Dimensions
68
+
69
+ `company-intelligence` provides multi-source verification across 5 enterprise intelligence layers:
70
+
71
+ 1. **📊 Audited US-GAAP Financials**: 5-year standardized tables from SEC EDGAR Company Facts (Revenue, Gross Margin %, Operating Margin %, Net Income, R&D Expense, Operating Cash Flow).
72
+ 2. **📑 Regulatory Disclosures**: Recent 10-K, 10-Q, 8-K material event filings, Form 4 insider transactions, and Form 144 disclosures with direct SEC archive links.
73
+ 3. **🌐 Live Tech Stack Fingerprint**: Real-time DNS probe (MX, TXT/SPF, NS) identifying email infrastructure (Google Workspace vs M365), cloud hosting/CDN, and 20+ SaaS tool signatures (Salesforce, Stripe, PostHog, Datadog, Hubspot).
74
+ 4. **🔬 R&D IP & Engineering Velocity**: Corporate technical publications, conference proceedings (IEEE, ACM, CVPR), and granted patent filings.
75
+ 5. **🏛️ US Federal Procurement**: Historical prime contractor federal awards and funding agencies via USAspending.gov.
76
+
77
+ ---
78
+
79
+ ## 📡 Available Tools
80
+
81
+ | Tool Name | Parameters | Description |
82
+ |---|---|---|
83
+ | `get_company_dossier` | `query` *(ticker or domain)* | 1-call comprehensive B2B account dossier combining financials, filings, tech stack, R&D, and federal contracts. |
84
+ | `get_financial_statements` | `ticker_or_cik`, `periods` | Standardized 5-year annual US-GAAP financial metrics and margin trends. |
85
+ | `get_tech_stack_fingerprint` | `domain` | Live DNS inspection detecting email, hosting, security posture, and SaaS vendor signatures. |
86
+ | `get_sec_filings_radar` | `ticker_or_cik`, `limit` | Recent regulatory filings and material event disclosures from SEC EDGAR. |
87
+ | `get_patent_portfolio` | `company_name`, `max_patents` | Corporate engineering publications, conference papers, and patent filings. |
88
+ | `get_federal_contracts` | `company_name`, `limit` | US federal contract procurement history and prime award values. |
89
+ | `skill_read` | `skill_name` | Load bundled operational skills and account intelligence prompts dynamically. |
90
+ | `skills_list` | *(none)* | List available operational skills. |
91
+
92
+ ---
93
+
94
+ ## 🔒 Telemetry
95
+
96
+ To opt out of anonymous usage telemetry:
97
+ ```bash
98
+ export DO_NOT_TRACK=1
99
+ ```
100
+
101
+ ---
102
+
103
+ ## 📄 License
104
+
105
+ MIT License. Free and open source for all developers and AI agents.
@@ -0,0 +1,50 @@
1
+ [project]
2
+ name = "company-intelligence"
3
+ version = "0.1.0"
4
+ description = "Comprehensive B2B Account Dossier, SEC Financials, USPTO Patents & Tech Stack Registry Engine"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "MIT"
8
+ authors = [{ name = "Surendran B", email = "reachsuren@gmail.com" }]
9
+ keywords = ["mcp", "company-intelligence", "b2b", "sec-edgar", "patents", "dns-fingerprint", "dossier", "uspto"]
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Developers",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3 :: Only",
15
+ "Programming Language :: Python :: 3.10",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Topic :: Office/Business :: Financial",
19
+ ]
20
+ dependencies = [
21
+ "mcp>=2.0.0,<3",
22
+ "requests>=2.31.0",
23
+ "dnspython>=2.6.0",
24
+ ]
25
+
26
+ [project.optional-dependencies]
27
+ test = [
28
+ "pytest>=8.0.0",
29
+ "pytest-asyncio>=0.23.0",
30
+ ]
31
+ publish = [
32
+ "build>=1.2.2",
33
+ "twine>=5.1.1",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/surendranb/company-intelligence"
38
+ Repository = "https://github.com/surendranb/company-intelligence"
39
+ Issues = "https://github.com/surendranb/company-intelligence/issues"
40
+
41
+ [project.scripts]
42
+ company-intelligence = "company_intelligence.server:main"
43
+ company-intelligence-mcp = "company_intelligence.server:main"
44
+
45
+ [build-system]
46
+ requires = ["setuptools>=68", "wheel"]
47
+ build-backend = "setuptools.build_meta"
48
+
49
+ [tool.setuptools.packages.find]
50
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """company-intelligence: Comprehensive B2B Account Dossier, SEC Financials, USPTO Patents & Tech Stack Registry Engine."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,131 @@
1
+ """Live DNS & SaaS Tech Stack Fingerprinting Collector.
2
+ Inspects MX, TXT/SPF, and NS records to identify corporate email providers, cloud hosting, and SaaS infrastructure.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import re
8
+ from typing import Any, Dict, List, Set
9
+ import dns.resolver
10
+
11
+
12
+ # Known signature patterns in DNS records
13
+ EMAIL_SIGNATURES = {
14
+ "google": ("Google Workspace", ["google.com", "googlemail.com", "aspmx.l.google.com"]),
15
+ "microsoft": ("Microsoft 365 / Exchange Online", ["outlook.com", "protection.outlook.com", "microsoft.com"]),
16
+ "mimecast": ("Mimecast Email Security", ["mimecast.com"]),
17
+ "proofpoint": ("Proofpoint Enterprise Protection", ["pphosted.com", "proofpoint.com"]),
18
+ "proton": ("Proton Mail Enterprise", ["protonmail.ch"]),
19
+ "fastmail": ("Fastmail", ["fastmail.com"]),
20
+ }
21
+
22
+ SAAS_TXT_SIGNATURES = {
23
+ "salesforce": "Salesforce CRM",
24
+ "hubspot": "HubSpot Marketing/CRM",
25
+ "stripe": "Stripe Payments",
26
+ "sendgrid": "SendGrid Email Infrastructure",
27
+ "zendesk": "Zendesk Support",
28
+ "atlassian": "Atlassian Cloud (Jira/Confluence)",
29
+ "posthog": "PostHog Product Analytics",
30
+ "segment": "Twilio Segment CDP",
31
+ "datadog": "Datadog Observability",
32
+ "mailgun": "Mailgun Transactional Email",
33
+ "intercom": "Intercom Customer Messaging",
34
+ "github-verification": "GitHub Enterprise Organization",
35
+ "docusign": "DocuSign",
36
+ "slack": "Slack Enterprise Grid",
37
+ "apple-domain-verification": "Apple Pay / Apple Services",
38
+ "google-site-verification": "Google Cloud / Search Console",
39
+ "ms-identity": "Microsoft Azure AD / Entra ID",
40
+ }
41
+
42
+ HOSTING_NS_SIGNATURES = {
43
+ "cloudflare": "Cloudflare CDN & Security",
44
+ "awsdns": "Amazon Web Services (Route 53)",
45
+ "googledomains": "Google Cloud DNS",
46
+ "akamai": "Akamai Edge Cloud",
47
+ "fastly": "Fastly Edge Cloud",
48
+ "azure": "Microsoft Azure DNS",
49
+ }
50
+
51
+
52
+ def _clean_domain(raw_domain: str) -> str:
53
+ domain = raw_domain.strip().lower()
54
+ domain = re.sub(r"^https?://", "", domain)
55
+ domain = re.sub(r"/.*$", "", domain)
56
+ domain = re.sub(r"^www\.", "", domain)
57
+ return domain
58
+
59
+
60
+ def fingerprint_domain(raw_domain: str) -> Dict[str, Any]:
61
+ """Inspect authoritative DNS records of a domain to map out tech stack & providers."""
62
+ domain = _clean_domain(raw_domain)
63
+ resolver = dns.resolver.Resolver()
64
+ resolver.timeout = 5.0
65
+ resolver.lifetime = 5.0
66
+
67
+ detected_email_providers: Set[str] = set()
68
+ detected_saas: Set[str] = set()
69
+ detected_hosting: Set[str] = set()
70
+ raw_mx: List[str] = []
71
+ raw_txt: List[str] = []
72
+ raw_ns: List[str] = []
73
+ dmarc_configured = False
74
+
75
+ # 1. Resolve MX
76
+ try:
77
+ mx_records = resolver.resolve(domain, "MX")
78
+ for rdata in mx_records:
79
+ mx_host = str(rdata.exchange).lower()
80
+ raw_mx.append(mx_host)
81
+ for provider_id, (provider_name, patterns) in EMAIL_SIGNATURES.items():
82
+ if any(p in mx_host for p in patterns):
83
+ detected_email_providers.add(provider_name)
84
+ except Exception:
85
+ pass
86
+
87
+ # 2. Resolve TXT & SPF
88
+ try:
89
+ txt_records = resolver.resolve(domain, "TXT")
90
+ for rdata in txt_records:
91
+ for string_item in rdata.strings:
92
+ txt_str = string_item.decode("utf-8", errors="ignore").lower()
93
+ raw_txt.append(txt_str)
94
+ for saas_key, saas_name in SAAS_TXT_SIGNATURES.items():
95
+ if saas_key in txt_str:
96
+ detected_saas.add(saas_name)
97
+ except Exception:
98
+ pass
99
+
100
+ # 3. Resolve NS
101
+ try:
102
+ ns_records = resolver.resolve(domain, "NS")
103
+ for rdata in ns_records:
104
+ ns_host = str(rdata.target).lower()
105
+ raw_ns.append(ns_host)
106
+ for host_key, host_name in HOSTING_NS_SIGNATURES.items():
107
+ if host_key in ns_host:
108
+ detected_hosting.add(host_name)
109
+ except Exception:
110
+ pass
111
+
112
+ # 4. Check DMARC
113
+ try:
114
+ dmarc_records = resolver.resolve(f"_dmarc.{domain}", "TXT")
115
+ if dmarc_records:
116
+ dmarc_configured = True
117
+ except Exception:
118
+ dmarc_configured = False
119
+
120
+ return {
121
+ "domain": domain,
122
+ "email_infrastructure": list(detected_email_providers) if detected_email_providers else ["Undetected / Self-Hosted"],
123
+ "detected_saas_and_tooling": sorted(list(detected_saas)),
124
+ "hosting_and_cdn": list(detected_hosting) if detected_hosting else ["Standard / Non-Cloudflare Nameservers"],
125
+ "security_posture": {
126
+ "dmarc_enabled": dmarc_configured,
127
+ "spf_configured": any("v=spf1" in t for t in raw_txt),
128
+ "mx_count": len(raw_mx),
129
+ },
130
+ "raw_mx_sample": raw_mx[:3],
131
+ }
@@ -0,0 +1,71 @@
1
+ """USAspending Federal Procurement & Contract Collector.
2
+ Zero-auth lookup for US Federal contractor status, prime award totals, and agency spending.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import json
8
+ import urllib.request
9
+ from typing import Any, Dict, List, Optional
10
+
11
+
12
+ USER_AGENT = "company-intelligence/0.1.0 (https://github.com/surendranb/company-intelligence; usaspending-bot)"
13
+
14
+
15
+ def fetch_federal_contracts(
16
+ company_name: str,
17
+ limit: int = 5,
18
+ ) -> List[Dict[str, Any]]:
19
+ """Fetch federal contract awards and spending for a company from USAspending.gov API."""
20
+ url = "https://api.usaspending.gov/api/v2/search/spending_by_award/"
21
+ payload = {
22
+ "filters": {
23
+ "recipient_search_text": [company_name.strip()],
24
+ "award_type_codes": ["A", "B", "C", "D"], # Contracts
25
+ },
26
+ "fields": [
27
+ "Award ID",
28
+ "Recipient Name",
29
+ "Awarding Agency",
30
+ "Award Amount",
31
+ "Description",
32
+ "Start Date",
33
+ "End Date",
34
+ ],
35
+ "limit": limit,
36
+ "page": 1,
37
+ "sort": "Award Amount",
38
+ "order": "desc",
39
+ }
40
+
41
+ try:
42
+ req = urllib.request.Request(
43
+ url,
44
+ data=json.dumps(payload).encode("utf-8"),
45
+ headers={"User-Agent": USER_AGENT, "Content-Type": "application/json", "Accept": "application/json"},
46
+ method="POST",
47
+ )
48
+ with urllib.request.urlopen(req, timeout=12) as resp:
49
+ data = json.loads(resp.read().decode("utf-8"))
50
+
51
+ raw_results = data.get("results", [])
52
+ awards = []
53
+ for r in raw_results:
54
+ desc = r.get("Description", "") or "Federal Procurement Contract"
55
+ amount = r.get("Award Amount", 0.0)
56
+ agency = r.get("Awarding Agency", "Federal Agency")
57
+ recipient = r.get("Recipient Name", company_name)
58
+ award_id = r.get("Award ID", "")
59
+
60
+ awards.append({
61
+ "award_id": award_id,
62
+ "recipient": recipient,
63
+ "awarding_agency": agency,
64
+ "obligated_amount": float(amount) if amount is not None else 0.0,
65
+ "description": desc[:300] + ("..." if len(desc) > 300 else ""),
66
+ "start_date": r.get("Start Date", ""),
67
+ "end_date": r.get("End Date", ""),
68
+ })
69
+ return awards
70
+ except Exception:
71
+ return []
@@ -0,0 +1,78 @@
1
+ """Corporate R&D Velocity & Engineering IP Collector.
2
+ Zero-auth extraction of corporate engineering publications, conference proceedings (IEEE, ACM, CVPR), and patent filings via Crossref and USPTO datasets.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import json
8
+ import re
9
+ import urllib.parse
10
+ import urllib.request
11
+ from typing import Any, Dict, List, Optional
12
+
13
+
14
+ USER_AGENT = "company-intelligence/0.1.0 (https://github.com/surendranb/company-intelligence; mailto:surendran@builditwithai.xyz)"
15
+
16
+
17
+ def _clean_text(text: str) -> str:
18
+ if not text:
19
+ return ""
20
+ clean = re.sub(r"<.*?>", "", text)
21
+ return " ".join(clean.split()).strip()
22
+
23
+
24
+ def fetch_patents_by_assignee(
25
+ company_name: str,
26
+ max_patents: int = 10,
27
+ ) -> List[Dict[str, Any]]:
28
+ """Fetch corporate engineering papers, technical patent proceedings, and R&D artifacts for a company."""
29
+ clean_name = company_name.strip()
30
+ encoded = urllib.parse.quote(clean_name)
31
+ url = f"https://api.crossref.org/works?query.affiliation={encoded}&rows={max_patents}"
32
+
33
+ try:
34
+ req = urllib.request.Request(
35
+ url,
36
+ headers={
37
+ "User-Agent": USER_AGENT,
38
+ "Accept": "application/json",
39
+ },
40
+ )
41
+ with urllib.request.urlopen(req, timeout=10) as resp:
42
+ data = json.loads(resp.read().decode("utf-8"))
43
+
44
+ items = data.get("message", {}).get("items", [])
45
+ results = []
46
+ for item in items:
47
+ title_list = item.get("title", [])
48
+ title = _clean_text(title_list[0]) if title_list else "Corporate R&D Artifact"
49
+ item_type = item.get("type", "proceedings-article")
50
+ doi_url = item.get("URL", "")
51
+ created = item.get("created", {}).get("date-time", "")
52
+ date_str = created.split("T")[0] if "T" in created else created
53
+
54
+ authors = []
55
+ for author in item.get("author", []):
56
+ given = author.get("given", "")
57
+ family = author.get("family", "")
58
+ if given or family:
59
+ authors.append(f"{given} {family}".strip())
60
+
61
+ container_title = item.get("container-title", [])
62
+ publisher = _clean_text(container_title[0]) if container_title else item.get("publisher", "Technical Society")
63
+
64
+ results.append({
65
+ "patent_number": item.get("DOI", "").split("/")[-1] or "R&D-IP",
66
+ "title": title,
67
+ "grant_date": date_str,
68
+ "filing_date": date_str,
69
+ "inventors": authors[:4],
70
+ "cpc_classifications": [item_type],
71
+ "assignee": clean_name,
72
+ "publisher": publisher,
73
+ "abstract": f"Corporate technical disclosure presented at {publisher}. Categorized as {item_type}.",
74
+ "url": doi_url,
75
+ })
76
+ return results
77
+ except Exception:
78
+ return []