dhravani / domain_subdomain.py
coild's picture
Upload 52 files
70b77f4 verified
domains_and_subdomains = {
"domains": {
"GEN": "General",
"EDU": "Educational",
"JUD": "Judiciary",
"GOV": "Governance",
"SAT": "Science and Technology",
"CLI": "Climate",
"AGRI": "Agriculture",
"TOUR": "Tourism",
"HC": "Healthcare",
},
"subdomains": {
"GEN": [
{"name": "General", "mnemonic": "GGEN"},
{"name": "News", "mnemonic": "NEWS"},
{"name": "Entertainment", "mnemonic": "ENT"},
{"name": "Sports", "mnemonic": "SPRT"},
{"name": "Finance", "mnemonic": "FIN"},
{"name": "Technology", "mnemonic": "TECH"},
{"name": "Health and Wellness", "mnemonic": "HW"},
{"name": "Travel and Adventure", "mnemonic": "TRAV"},
{"name": "Science and Nature", "mnemonic": "SCI"},
{"name": "History and Culture", "mnemonic": "HIST"},
{"name": "Automotive", "mnemonic": "AUTO"},
{"name": "Gaming", "mnemonic": "GAME"},
{"name": "Air Traffic Control", "mnemonic": "ATC"},
{"name": "Police Radio Communications", "mnemonic": "PRC"},
],
"EDU": [
{"name": "Physics", "mnemonic": "PHY"},
{"name": "Chemistry", "mnemonic": "CHEM"},
{"name": "Maths", "mnemonic": "MTH"},
{"name": "Scholarly Articles", "mnemonic": "SCH"},
{"name": "Journal", "mnemonic": "JNL"},
{"name": "Social Sciences", "mnemonic": "SST"},
{"name": "Humanities", "mnemonic": "HSS"},
{"name": "Arts and Culture", "mnemonic": "ART"},
],
"JUD": [
{"name": "Constituional Text", "mnemonic": "CONS"},
{"name": "Legislation", "mnemonic": "LEG"},
{"name": "Rules and Regulation", "mnemonic": "REG"},
{"name": "Case Judgements", "mnemonic": "JUDG"},
{"name": "Arbitration", "mnemonic": "ARB"},
{"name": "Court Transcripts", "mnemonic": "TRNS"},
{"name": "Pleadings", "mnemonic": "PLD"},
{"name": "Court Briefings", "mnemonic": "BRF"},
{"name": "Evidence records", "mnemonic": "EVD"},
{"name": "FIR", "mnemonic": "FIR"},
{"name": "Criminal", "mnemonic": "CMNL"},
{"name": "Forensic Reports", "mnemonic": "FRNS"},
{"name": "Civial", "mnemonic": "CVL"},
{"name": "Contracts and Agreements", "mnemonic": "CNRT"},
{"name": "Affidavits", "mnemonic": "AFDT"},
{"name": "Petitions and Forms", "mnemonic": "PTN"},
],
"GOV": [
{"name": "Government & Policies", "mnemonic": "MEA"},
{"name": "MP GOV", "mnemonic": "MPGOV"},
{"name": "State Budget Speeches", "mnemonic": "SBS"},
{"name": "Union Budget Speeches", "mnemonic": "UBS"},
{"name": "Presidential Address", "mnemonic": "PRA"},
{"name": "PM Speeches", "mnemonic": "PMS"},
{"name": "Lok Sabha Debates", "mnemonic": "LSD"},
{"name": "Niti Ayog Reports", "mnemonic": "NAR"},
{"name": "Press Information Bureau", "mnemonic": "PIB"},
{"name": "Government Information Bulletin", "mnemonic": "GIB"},
{"name": "Department of Health and Family Welfare", "mnemonic": "DHF"},
{"name": "Important Parliamentary Terms", "mnemonic": "IPT"},
{"name": "Rules of Procedure and Conduct of Business in the Council of States (Rajya Sabha)", "mnemonic": "RPR"},
{"name": "Chief Minister speeches", "mnemonic": "CMS"},
{"name": "Tamil press release", "mnemonic": "TPR"},
],
"SAT": [
{"name": "Physics", "mnemonic": "PHY"},
{"name": "Quantum Mechanics", "mnemonic": "QTM"},
{"name": "Electromagnetics", "mnemonic": "EMS"},
{"name": "Optics", "mnemonic": "OPS"},
{"name": "Fluid Dynamics", "mnemonic": "FDY"},
{"name": "Electronics", "mnemonic": "ELEC"},
{"name": "Electromagnetism", "mnemonic": "ETMG"},
{"name": "Chemistry", "mnemonic": "CHEM"},
{"name": "Physical Chemistry", "mnemonic": "PCH"},
{"name": "Organic Chemistry", "mnemonic": "OCH"},
{"name": "Inorganic Chemistry", "mnemonic": "ICH"},
{"name": "Analytical Chemistry", "mnemonic": "ACH"},
{"name": "Mathematics", "mnemonic": "MTH"},
{"name": "Algebra", "mnemonic": "ALG"},
{"name": "Arithmetic", "mnemonic": "ARM"},
{"name": "Calculus", "mnemonic": "CAL"},
{"name": "Geometry", "mnemonic": "GEM"},
{"name": "Number Theory", "mnemonic": "NTH"},
{"name": "Probability", "mnemonic": "PRB"},
{"name": "Statistics", "mnemonic": "STAT"},
{"name": "Trigonometry", "mnemonic": "TRG"},
{"name": "Biology", "mnemonic": "BIO"},
{"name": "Botany", "mnemonic": "BOT"},
{"name": "Zoology", "mnemonic": "ZOO"},
{"name": "Biotechnology", "mnemonic": "BIT"},
{"name": "Biochemistry", "mnemonic": "BCH"},
{"name": "Microbiology", "mnemonic": "MIB"},
{"name": "Virology", "mnemonic": "VLY"},
{"name": "Cell biology", "mnemonic": "CBY"},
{"name": "Genetics", "mnemonic": "GEN"},
{"name": "Computer Science", "mnemonic": "CSC"},
{"name": "Computer Vision", "mnemonic": "COMVI"},
{"name": "Natural Language Processing", "mnemonic": "NLP"},
{"name": "Machine Learning", "mnemonic": "ML"},
{"name": "Network Security", "mnemonic": "NSC"},
{"name": "Algorithm Design", "mnemonic": "ADG"},
],
"CLI": [
{"name": "Global Warming", "mnemonic": "GWR"},
{"name": "Greenhouse Gases", "mnemonic": "GHG"},
{"name": "Carbon Cycle", "mnemonic": "CSC"},
{"name": "Sea Level Rise", "mnemonic": "SLR"},
{"name": "ecology", "mnemonic": "ECO"},
{"name": "weather", "mnemonic": "WTR"},
{"name": "ecosystems", "mnemonic": "ECS"},
{"name": "Climate Action", "mnemonic": "CLA"},
{"name": "Adaptation", "mnemonic": "ADP"},
{"name": "Sustainability", "mnemonic": "SUS"},
{"name": "Decarbonization", "mnemonic": "DEC"},
{"name": "Renewable Energy", "mnemonic": "REW"},
{"name": "Climatology", "mnemonic": "CMY"},
{"name": "flood", "mnemonic": "FLD"},
{"name": "cyclone", "mnemonic": "CYC"},
{"name": "winds", "mnemonic": "WND"},
{"name": "atmospheric pressure", "mnemonic": "ATP"},
{"name": "temperature", "mnemonic": "TMP"},
{"name": "drought", "mnemonic": "DRT"},
{"name": "jet stream", "mnemonic": "JST"},
],
"AGRI": [
{"name": "Farming Practices", "mnemonic": "FARM"},
{"name": "Crops and Cultivation", "mnemonic": "CROP"},
{"name": "Livestock Management", "mnemonic": "LIVE"},
{"name": "Agri-Tech and Innovations", "mnemonic": "ATECH"},
{"name": "Government Schemes and Policies", "mnemonic": "GOV"},
{"name": "Supply Chain and Marketing", "mnemonic": "MKT"},
{"name": "Rural Economy and Employment", "mnemonic": "ECO"},
{"name": "Irrigation and Water Management", "mnemonic": "IRRI"},
{"name": "Soil and Fertilizers", "mnemonic": "SOFT"},
{"name": "Pest and Disease Management", "mnemonic": "PEST"},
],
"TOUR": [
{"name": "Travel Destinations", "mnemonic": "DEST"},
{"name": "Adventure Tourism", "mnemonic": "ADVN"},
{"name": "Cultural Tourism", "mnemonic": "CULT"},
{"name": "Eco and Sustainable Tourism", "mnemonic": "SUS"},
{"name": "Religious Tourism", "mnemonic": "REL"},
{"name": "Medical Tourism", "mnemonic": "MED"},
{"name": "Government Initiatives", "mnemonic": "GOV"},
{"name": "Hospitality and Services", "mnemonic": "HOST"},
{"name": "Food and Culinary Tourism", "mnemonic": "FOOD"},
{"name": "Heritage and Architecture", "mnemonic": "ARCH"},
],
"HC": [
{"name": "Awareness", "mnemonic": "AWR"},
{"name": "Physical health", "mnemonic": "PH"},
{"name": "Digital Health and Medi- engineering", "mnemonic": "DHME"},
{"name": "Medi- Finances", "mnemonic": "MEDFI"},
{"name": "Medical Consents ", "mnemonic": "MCON"},
{"name": "Mental Health", "mnemonic": "MHEAL"},
{"name": "Women health and Maternity", "mnemonic": "WHM"},
{"name": "Child health and welfare", "mnemonic": "CHW"},
{"name": "Pandamic", "mnemonic": "PAN"},
{"name": "Pharma", "mnemonic": "PHAR"},
{"name": "Homeopathy", "mnemonic": "HOM"},
{"name": "Ayurveda", "mnemonic": "AYU"},
],
},
}
def get_all_domains():
"""Return a dictionary of all domain codes and their names."""
return domains_and_subdomains["domains"]
def get_domain_name(domain_code):
"""Get the full name of a domain given its code."""
return domains_and_subdomains["domains"].get(domain_code)
def get_domain_subdomains(domain_code):
"""Get all subdomains for a specific domain."""
return domains_and_subdomains["subdomains"].get(domain_code, [])
def get_subdomain_by_mnemonic(domain_code, subdomain_mnemonic):
"""Get subdomain information by its mnemonic within a domain."""
subdomains = get_domain_subdomains(domain_code)
for subdomain in subdomains:
if subdomain["mnemonic"] == subdomain_mnemonic:
return subdomain
return None
def search_subdomain(query, domain_code=None):
"""Search for a subdomain by name or mnemonic across all domains or a specific domain."""
results = []
query = query.lower()
if domain_code:
domains_to_search = [domain_code]
else:
domains_to_search = domains_and_subdomains["domains"].keys()
for domain in domains_to_search:
subdomains = get_domain_subdomains(domain)
for subdomain in subdomains:
if query in subdomain["name"].lower() or query in subdomain["mnemonic"].lower():
results.append({
"domain": domain,
"domain_name": get_domain_name(domain),
"subdomain": subdomain
})
return results