Fast, zero-dependency UK SIC 2007 code lookup, search, and validation
Project description
uk-sic-codes
Fast, zero-dependency UK SIC 2007 code lookup, search, and validation for Python.
Built by BORSCH.AI — UK Business Intelligence Platform covering 5.9M companies with AI-powered risk scores and 50M+ government signals.
Also available as an npm package for Node.js/TypeScript.
Installation
pip install uk-sic-codes
Quick Start
from uk_sic_codes import lookup, search, validate
# Look up a code
info = lookup("62012")
print(info.description) # "Business and domestic software development"
print(info.section) # "J"
print(info.section_name) # "Information and Communication"
# Search by keyword
results = search("restaurant")
for r in results:
print(f"{r.code}: {r.description}")
# Validate
validate("62012") # True
validate("00000") # False
API
lookup(code: str) -> SICCode | None
Look up a SIC code. Accepts 4 or 5 digit codes (auto-pads). Strips whitespace and punctuation.
lookup("62012") # SICCode(code="62012", description="Business and domestic software development", ...)
lookup("1110") # Auto-pads to "01110"
lookup("62.01.2") # Strips dots
lookup("99999") # Dormant Company
search(query: str, limit: int = 20) -> list[SICCode]
Full-text keyword search with relevance scoring. Case-insensitive, multi-word support.
search("software") # Top 20 results
search("coal mining", 5) # Top 5 results
validate(code: str) -> bool
Check if a string is a valid UK SIC 2007 code.
validate("62012") # True
validate("00000") # False
validate("abc") # False
list_section(letter: str) -> list[SICCode]
Get all codes in a section (A-U).
codes = list_section("J") # All Information & Communication codes
list_division(division: str) -> list[SICCode]
Get all codes in a 2-digit division.
codes = list_division("62") # All IT codes
tree() -> list[SICSection]
Full hierarchical tree of all 21 sections with their divisions and codes.
for section in tree():
print(f"{section.letter}: {section.name} ({len(section.codes)} codes)")
sections() -> list[dict]
All 21 section letters and names.
count() -> int
Total number of SIC codes (731).
Data Types
@dataclass
class SICCode:
code: str # 5-digit code, e.g. "62012"
description: str # Full description
section: str # Section letter (A-U)
section_name: str # Section name
division: str # 2-digit division
group: str # 3-digit group
class_code: str # 4-digit class
@dataclass
class SICSection:
letter: str # Section letter
name: str # Section name
divisions: list[str]
codes: list[str]
Data Source
Based on the official ONS UK SIC 2007 condensed classification used by Companies House. Full company data available at borsch.ai.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uk_sic_codes-1.0.0.tar.gz.
File metadata
- Download URL: uk_sic_codes-1.0.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6f6afe1164ea3b75c2d069600e99ec0e5d551134d7e72cd10d514a4fbae3f9e
|
|
| MD5 |
2c2e89a93dbf0623ba950cc6eb766041
|
|
| BLAKE2b-256 |
0d4fc5b598038f317b159a8a3f3313d926f763e3c230150d9983afa14f7b086c
|
File details
Details for the file uk_sic_codes-1.0.0-py3-none-any.whl.
File metadata
- Download URL: uk_sic_codes-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfdf06c43d5f8eed155cd0afdd7dece3cccce97234e73264c35266ae38e3f749
|
|
| MD5 |
9a4fc8c1563d351298d25eba268c9858
|
|
| BLAKE2b-256 |
1d3b42b473228a307ec5fc3ff103aa6717c869a3e47c87948853f9846869e238
|