File size: 9,991 Bytes
70b77f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
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