yes-man-today commited on
Commit
24ff7e7
1 Parent(s): a98db89

fixed to put in docket_ids

Browse files
Files changed (1) hide show
  1. regulatory_comments_api.py +6 -79
regulatory_comments_api.py CHANGED
@@ -135,8 +135,9 @@ class RegulationsDataFetcher:
135
 
136
 
137
  class RegCommentsAPIConfig(BuilderConfig):
138
- def __init__(self, api_key=None, **kwargs):
139
  self.api_key = api_key
 
140
  super(RegCommentsAPIConfig, self).__init__(**kwargs)
141
 
142
 
@@ -183,6 +184,7 @@ class RegCommentsAPI(datasets.GeneratorBasedBuilder):
183
  def _split_generators(self, dl_manager):
184
  # Retrieve the API key from the builder's config
185
  api_key = self.config.api_key
 
186
 
187
  # Define your dataset's splits. In this case, only a training split.
188
  return [
@@ -190,89 +192,14 @@ class RegCommentsAPI(datasets.GeneratorBasedBuilder):
190
  name=datasets.Split.TRAIN,
191
  gen_kwargs={
192
  "api_key": api_key, # Pass the API key to the generator function
 
193
  },
194
  ),
195
  ]
196
 
197
- def _generate_examples(self, api_key):
198
  # Iterate over each search term to fetch relevant dockets
199
- dockets = ['FDA-2000-P-0565', 'FDA-1995-P-0018', 'FDA-2010-P-0338',
200
- 'FDA-2017-N-2903', 'FDA-1976-N-0517', 'CDC-2008-0002',
201
- 'DEA-2017-0006', 'DEA-2017-0004', 'DEA-2023-0028',
202
- 'DEA-2007-0060', 'FDA-2005-P-0191', 'CDC-2017-0057',
203
- 'FDA-2003-P-0115', 'FDA-2012-P-1028', 'FDA-1989-P-0003',
204
- 'FDA-2009-P-0415', 'FDA-2007-P-0352', 'FDA-2007-P-0124',
205
- 'FDA-2009-P-0459', 'FDA-2014-P-2168', 'FDA-2014-N-0233',
206
- 'FDA-2002-P-0291', 'DOD-2012-HA-0117', 'FDA-2015-P-1004',
207
- 'DEA-2016-0005', 'FDA-2002-P-0049', 'FDA-2008-P-0327',
208
- 'FDA-2022-D-1847', 'FDA-2015-P-2344', 'FDA-2009-P-0429',
209
- 'FDA-2012-P-0053', 'FDA-2009-P-0289', 'DEA-2023-0106',
210
- 'FDA-1986-P-0002', 'CMS-2019-0090', 'FDA-2018-D-1334',
211
- 'FDA-1975-N-0003', 'FDA-2019-N-5973', 'FDA-2004-P-0101',
212
- 'FDA-2023-N-0148', 'FDA-2000-P-0580', 'FDA-2007-P-0128',
213
- 'FDA-2017-N-5608', 'FDA-1994-P-0014', 'DEA-2016-0018',
214
- 'FDA-2017-P-6918', 'DOD-2013-HA-0085', 'FDA-2003-P-0270',
215
- 'FDA-2011-P-0869', 'FDA-2010-P-0593', 'FDA-2012-P-1251',
216
- 'DEA-2014-0005', 'FDA-1994-P-0003', 'FDA-2021-P-0514',
217
- 'FDA-1987-P-0026', 'FDA-2013-N-1485', 'FDA-1993-N-0363',
218
- 'FDA-2017-P-0428', 'SAMHSA-2023-0001', 'FDA-2012-P-1180',
219
- 'FDA-2019-P-5268', 'DEA-2017-0011', 'FDA-2016-P-3912',
220
- 'DOD-2015-HA-0109', 'FDA-2022-P-1863', 'FDA-2011-N-0802',
221
- 'FDA-1996-P-0154', 'FDA-2021-N-0951', 'DEA-2015-0009',
222
- 'FDA-2022-N-2393', 'FDA-2019-P-1783', 'FDA-2017-N-1094',
223
- 'CDC-2018-0085', 'FDA-2005-P-0327', 'FDA-2014-P-2058',
224
- 'DEA-2020-0031', 'FDA-2018-P-3355', 'FDA-2003-P-0183',
225
- 'FDA-2002-P-0167', 'DOD-2015-OS-0118', 'FDA-2008-P-0401',
226
- 'FDA-2013-P-1606', 'ONDCP_FRDOC_0001', 'FDA-1998-P-0018',
227
- 'FDA-2008-P-0366', 'FDA-2013-D-0045', 'FDA-2013-P-1055',
228
- 'FDA-2017-N-4515', 'FDA-1982-N-0046', 'FDA-2018-P-0673',
229
- 'FDA-2012-P-0818', 'FDA-2019-P-1643', 'FDA-2004-P-0098',
230
- 'FDA-2008-P-0127', 'FDA-2004-P-0096', 'DEA-2019-0014',
231
- 'FDA-2019-N-0299', 'FDA-1994-P-0021', 'FDA-2021-N-0275',
232
- 'CDC-2017-0043', 'SAMHSA-2016-0001', 'VA-2020-VHA-0023',
233
- 'CNCS-2021-0018', 'FDA-2005-P-0054', 'DEA-2017-0005',
234
- 'FDA-2019-P-5593', 'FDA-1997-P-0036', 'FDA-2002-P-0051',
235
- 'SAMHSA-2016-0004', 'FDA-2016-D-0785', 'FDA-2020-N-1561',
236
- 'SAMHSA-2022-0001', 'DEA-2018-0015', 'FDA-2010-P-0082',
237
- 'FDA-2023-P-2656', 'FDA-2004-P-0085', 'FDA-2007-P-0415',
238
- 'DEA-2017-0013', 'DEA-2018-0004', 'FDA-2005-P-0058',
239
- 'FDA-2002-N-0320', 'FDA-2014-P-0752', 'FDA-2002-P-0219',
240
- 'DEA-2013-0010', 'FDA-2003-N-0396', 'FDA-2005-P-0425',
241
- 'CMS-2020-0060', 'FRA-2019-0071', 'FDA-2013-N-0883',
242
- 'FDA-2009-P-0154', 'HHS-OS-2009-0007', 'CDC-2020-0001',
243
- 'FDA-2012-P-0189', 'DEA-2023-0058', 'FDA-2017-P-1911',
244
- 'DOD-2011-HA-0085', 'FDA-2017-P-6307', 'FDA-2004-P-0162',
245
- 'FDA-2001-P-0056', 'FDA-2013-P-0675', 'FDA-1993-P-0018',
246
- 'FDA-2017-P-5370', 'FDA-2012-N-0548', 'FDA-2012-N-0563',
247
- 'FDA-2009-P-0388', 'FDA-2001-P-0416', 'FDA-2005-N-0093',
248
- 'FDA-2002-P-0003', 'FDA-2016-P-1875', 'FDA-1987-P-0012',
249
- 'FDA-2004-P-0216', 'FDA-2007-P-0065', 'FDA-2015-P-0516',
250
- 'FDA-2023-N-3159', 'FDA-2008-P-0156', 'FDA-2021-P-0036',
251
- 'FDA-1995-P-0100', 'FDA-2012-P-1034', 'DEA-2018-0002',
252
- 'FDA-2015-P-1153', 'FDA-1995-P-0004', 'FDA-1985-P-0014',
253
- 'FDA-2016-P-1090', 'FDA-1977-N-0411', 'FDA-2009-P-0325',
254
- 'FDA-2005-P-0440', 'FDA-2019-P-1679', 'FDA-2011-P-0045',
255
- 'DEA-2020-0034', 'DOD-2015-HA-0062', 'FDA-2018-P-1448',
256
- 'FDA-2009-P-0446', 'FDA-2006-P-0279', 'FDA-2013-P-0995',
257
- 'CMS-2022-0191', 'FDA-2009-P-0227', 'FDA-2005-P-0009',
258
- 'USCBP-2013-0002', 'HHS-ASPE-2016-0011', 'FDA-2011-P-0302',
259
- 'FDA-2003-P-0185', 'FDA-2012-E-0152', 'FDA-1994-P-0016',
260
- 'FDA-2016-N-2648', 'CMS-2019-0111', 'FDA-2022-N-2673',
261
- 'FDA-1988-P-0026', 'FDA-1999-P-3513', 'DOT-OST-2016-0189',
262
- 'FDA-2017-P-0663', 'FDA-2003-P-0276', 'FDA-2006-P-0329',
263
- 'FDA-2016-P-4094', 'FDA-1993-P-0041', 'FDA-2005-P-0325',
264
- 'DEA-2020-0002', 'FDA-2007-E-0400', 'FDA-2002-P-0050',
265
- 'VA-2017-VHA-0004', 'FDA-2000-P-0024', 'FDA-2002-P-0528',
266
- 'FDA-2009-P-0252', 'FDA-2017-D-2497', 'CNCS-2021-0011',
267
- 'FDA-2006-P-0148', 'DEA-2008-0012', 'FDA-2018-N-3685',
268
- 'FDA-2023-P-4223', 'FDA-2014-P-1383', 'ONDCP-2020-0001',
269
- 'FDA-2008-P-0134', 'FDA-2007-P-0245', 'FDA-2013-P-1711',
270
- 'FDA-2016-P-1650', 'FDA-2019-P-1364', 'FDA-2015-P-1003',
271
- 'FDA-2007-N-0438', 'FDA-1985-P-0002', 'FDA-2007-P-0062',
272
- 'SAMHSA-2022-0002', 'FDA-2006-P-0016', 'FDA-2010-P-0012',
273
- 'FDA-2006-P-0278', 'FDA-1981-N-0248', 'CMS-2021-0167',
274
- 'FDA-2015-P-1752', 'FDA-2005-P-0055', 'FDA-2004-P-0473',
275
- 'FDA-2001-P-0191', 'FDA-1986-P-0034']
276
 
277
  for docket_id in dockets:
278
  fetcher = RegulationsDataFetcher(docket_id, api_key) # Initialize with the API key
 
135
 
136
 
137
  class RegCommentsAPIConfig(BuilderConfig):
138
+ def __init__(self, api_key=None, docket_ids = None, **kwargs):
139
  self.api_key = api_key
140
+ self.docket_ids = docket_ids
141
  super(RegCommentsAPIConfig, self).__init__(**kwargs)
142
 
143
 
 
184
  def _split_generators(self, dl_manager):
185
  # Retrieve the API key from the builder's config
186
  api_key = self.config.api_key
187
+ docket_ids = self.config.docket_ids
188
 
189
  # Define your dataset's splits. In this case, only a training split.
190
  return [
 
192
  name=datasets.Split.TRAIN,
193
  gen_kwargs={
194
  "api_key": api_key, # Pass the API key to the generator function
195
+ "docket_ids": docket_ids
196
  },
197
  ),
198
  ]
199
 
200
+ def _generate_examples(self, api_key, docket_ids):
201
  # Iterate over each search term to fetch relevant dockets
202
+ dockets = docket_ids
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  for docket_id in dockets:
205
  fetcher = RegulationsDataFetcher(docket_id, api_key) # Initialize with the API key