venthrive-api / intel /subsector_map.py
GitHub Actions
Sync from GitHub · 2026-10-21 11:53 UTC
b7c46f4
Raw History Blame Contribute Delete
10.3 kB
"""
Overture place categories → VenThrive subsector ids (backend/news/subsectors.json).
Two levels, most specific first: Overture's detailed `taxonomy.primary` when it
pins the business down (a 'barber' inside the broad 'personal_or_beauty_service'),
otherwise its `basic_category`. Anything unmapped gets subsector None — mostly
context places (worship, civic, parks, landmarks), which are kept because they
drive footfall even though they aren't competitors.
Built from the categories actually present in Nigeria's extract (release
2026-09-23.1, 151k places). Known gap: hotels and lodging (~6.8k places) have no
subsector in data/sectors.ts, so they map to 'other_services' — flagged in the
design doc as a sector-taxonomy gap rather than forced into the wrong subsector.
"""
TAXONOMY_TO_SUBSECTOR = {
# personal_or_beauty_service, split properly
"barber": "hair_services", "hair_salon": "hair_services", "hair_extensions": "hair_services",
"hair_replacement": "hair_services", "beauty_salon": "hair_services",
"makeup_artist": "skincare_cosmetics", "skin_care_and_makeup": "skincare_cosmetics",
"nail_salon": "skincare_cosmetics", "tanning_salon": "body_spa", "hair_removal": "body_spa",
"life_coach": "online_coaching", "image_consultant": "management_consulting",
"shoe_repair": "footwear", "tattoo_and_piercing": "other_services",
# professional_service, split properly
"marketing_agency": "digital_services", "advertising_agency": "digital_services",
"internet_marketing_service": "digital_services", "social_media_agency": "digital_services",
"e_commerce_service": "digital_services", "public_relations": "content_media",
"writing_service": "content_media", "employment_agency": "management_consulting",
"career_counseling": "management_consulting", "business_consulting": "management_consulting",
"janitorial_service": "cleaning_services", "merchandising_service": "retail_trade",
# manufacturer, split properly
"industrial_equipment_manufacturer": "industrial_manufacturing", "metal_fabricator": "industrial_manufacturing",
"auto_manufacturer": "industrial_manufacturing", "motorcycle_manufacturer": "industrial_manufacturing",
"plastic_manufacturer": "industrial_manufacturing", "glass_manufacturer": "industrial_manufacturing",
"appliance_manufacturer": "light_manufacturing", "furniture_manufacturer": "light_manufacturing",
"mattress_manufacturing": "light_manufacturing", "textile_manufacturer": "textiles_materials",
"apparel_manufacturer": "clothing_apparel", "shoe_factory_manufacturer": "footwear",
"jewelry_and_watches_manufacturer": "accessories_jewellery",
# corporate_or_business_office, split properly
"information_technology_company": "it_consulting", "telecommunications_company": "it_consulting",
"auto_company": "vehicle_trade", "travel_company": "passenger_transport",
"industrial_company": "industrial_manufacturing", "pharmaceutical_company": "industrial_manufacturing",
"clothing_company": "clothing_apparel", "bottled_water_company": "food_production_processing",
"biotechnology_company": "industrial_manufacturing", "ferry_boat_company": "passenger_transport",
"bags_luggage_company": "accessories_jewellery",
}
BASIC_TO_SUBSECTOR = {
# food
"restaurant": "catering_food_service", "casual_eatery": "catering_food_service",
"fast_food_restaurant": "catering_food_service", "cafe": "catering_food_service",
"coffee_shop": "catering_food_service", "food_service": "catering_food_service",
"food_and_drink": "catering_food_service", "smoothie_juice_bar": "catering_food_service",
"food_truck_stand": "catering_food_service", "non_alcoholic_beverage_venue": "catering_food_service",
"brewery": "food_production_processing", "winery": "food_production_processing",
"distillery": "food_production_processing",
"farm": "agricultural_production",
"agricultural_service": "agri_trade_distribution", "farmers_market": "agri_trade_distribution",
# fashion
"fashion_and_apparel_store": "clothing_apparel",
# tech
"design_service": "digital_services", "technical_service": "hardware_repairs",
"b2b_science_and_technology_service": "it_consulting", "telecommunications_service": "it_consulting",
# health & beauty
"hospital": "healthcare_services", "health_care": "healthcare_services",
"diagnostics_imaging_or_lab_service": "healthcare_services", "dental_clinic": "healthcare_services",
"outpatient_care_facility": "healthcare_services", "medical_service": "healthcare_services",
"vision_or_eye_care_clinic": "healthcare_services", "behavioral_or_mental_health_clinic": "healthcare_services",
"physical_medicine_and_rehabilitation": "healthcare_services", "specialized_medical_facility": "healthcare_services",
"specialized_health_care": "healthcare_services", "reproductive_perinatal_and_womens_care": "healthcare_services",
"primary_care_or_general_clinic": "healthcare_services", "surgery": "healthcare_services",
"emergency_department": "healthcare_services", "emergency_or_urgent_care_facility": "healthcare_services",
"pediatric_clinic": "healthcare_services", "complementary_and_alternative_medicine": "healthcare_services",
"pharmacy_and_drug_store": "healthcare_services", "senior_living_facility": "healthcare_services",
"wellness_service": "wellness_fitness", "gym": "wellness_fitness", "fitness_studio": "wellness_fitness",
"sport_or_fitness_facility": "wellness_fitness",
"personal_or_beauty_service": "hair_services",
"personal_care_and_beauty_store": "skincare_cosmetics",
# education
"place_of_learning": "formal_education", "education": "formal_education",
"college_university": "formal_education", "elementary_school": "formal_education",
"high_school": "formal_education", "middle_school": "formal_education", "preschool": "formal_education",
"educational_facility": "formal_education", "campus_building": "formal_education",
"specialty_school": "skills_vocational", "educational_service": "skills_vocational",
"tutoring_service": "online_coaching",
# money
"financial_service": "financial_services", "bank_or_credit_union": "financial_services", "atm": "financial_services",
# transport & logistics
"shipping_or_delivery_service": "delivery_services",
"b2b_transportation_and_storage_service": "haulage_freight", "storage_facility": "haulage_freight",
"travel_and_transportation": "passenger_transport", "public_transit_facility_or_service": "passenger_transport",
"taxi_or_ride_share_service": "passenger_transport", "travel_service": "passenger_transport",
# property & building
"real_estate_service": "real_estate", "apartment": "real_estate",
"building_or_construction_service": "construction_renovation",
"hardware_home_and_garden_store": "building_materials",
# creative & events
"art_gallery": "visual_arts", "arts_crafts_and_hobby_store": "visual_arts",
"media_service": "content_media", "radio_station": "content_media",
"theatre_venue": "performing_arts", "performing_arts_venue": "performing_arts",
"event_or_party_service": "event_planning", "event_venue": "event_support",
"bar": "entertainment_venues", "lounge": "entertainment_venues", "dance_club": "entertainment_venues",
"nightlife_venue": "entertainment_venues", "alcoholic_beverage_venue": "entertainment_venues",
"music_venue": "entertainment_venues", "movie_theater": "entertainment_venues",
"comedy_club": "entertainment_venues", "gaming_venue": "entertainment_venues", "casino": "entertainment_venues",
"arcade": "entertainment_venues", "amusement_park": "entertainment_venues", "stadium_arena": "entertainment_venues",
# making things
"manufacturer": "light_manufacturing", "printing_service": "light_manufacturing",
"b2b_industrial_and_machine_service": "industrial_manufacturing",
"industrial_facility_or_service": "industrial_manufacturing",
# trade
"shopping": "retail_trade", "electronics_store": "retail_trade", "food_and_beverage_store": "retail_trade",
"convenience_store": "retail_trade", "books_music_and_video_store": "retail_trade",
"flowers_and_gifts_store": "retail_trade", "specialty_store": "retail_trade",
"sporting_goods_store": "retail_trade", "musical_instrument_and_pro_audio_store": "retail_trade",
"office_supply_store": "retail_trade", "second_hand_store": "retail_trade", "department_store": "retail_trade",
"discount_store": "retail_trade", "toys_and_games_store": "retail_trade", "superstore": "retail_trade",
"shopping_mall": "retail_trade", "warehouse_club_store": "retail_trade", "animal_and_pet_store": "retail_trade",
"market": "retail_trade", "gas_station": "retail_trade",
"supplier_or_distributor": "wholesale_distribution", "wholesaler": "wholesale_distribution",
# professional
"attorney_or_law_firm": "legal_compliance", "legal_service": "legal_compliance",
# vehicles
"automotive_service": "vehicle_maintenance", "vehicle_service": "vehicle_maintenance",
"auto_dealer": "vehicle_trade", "vehicle_dealer": "vehicle_trade", "vehicle_parts_store": "vehicle_trade",
# services
"laundry_service": "cleaning_services", "home_service": "home_services",
"hotel": "other_services", "lodging": "other_services", "bed_and_breakfast": "other_services",
"private_lodging": "other_services", "inn": "other_services", "resort": "other_services",
"professional_service": "other_services", "corporate_or_business_office": "other_services",
"b2b_office_and_professional_service": "other_services", "b2b_service": "other_services",
"b2b_energy_and_utility_service": "other_services", "security_service": "other_services",
"animal_or_pet_service": "other_services", "rental_service": "other_services",
"recreational_equipment_rental": "other_services", "environmental_or_ecological_service": "other_services",
}
def subsector_for(basic_category: str | None, taxonomy_primary: str | None) -> str | None:
if taxonomy_primary and taxonomy_primary in TAXONOMY_TO_SUBSECTOR:
return TAXONOMY_TO_SUBSECTOR[taxonomy_primary]
if basic_category:
return BASIC_TO_SUBSECTOR.get(basic_category)
return None