|
11 | 11 |
|
12 | 12 |
|
13 | 13 | def get_values(series, jurisdiction, date, documentType=None, summary=True, |
14 | | - dateIsRange=True, country=False, agency=None, |
| 14 | + dateIsRange=True, country=False, agency=None, cluster=None, |
15 | 15 | industry=None, filtered=True, industryLevel=None, version=None, |
16 | 16 | download=False, verbose=0): |
17 | 17 | """ |
@@ -84,6 +84,12 @@ def get_values(series, jurisdiction, date, documentType=None, summary=True, |
84 | 84 | elif agency: |
85 | 85 | url_call += f'&agency={agency}' |
86 | 86 |
|
| 87 | + # If multiple clusters are given, parses the list into a string |
| 88 | + if type(cluster) == list: |
| 89 | + url_call += f'&cluster={",".join(str(i) for i in cluster)}' |
| 90 | + elif cluster: |
| 91 | + url_call += f'&cluster={cluster}' |
| 92 | + |
87 | 93 | # If multiple industries are given, parses the list into a string |
88 | 94 | if type(industry) == list: |
89 | 95 | url_call += f'&label={",".join(str(i) for i in industry)}' |
@@ -376,6 +382,17 @@ def list_agencies(jurisdictionID=None, keyword=None): |
376 | 382 | for a in json if a["agencyName"]}.items())) |
377 | 383 |
|
378 | 384 |
|
| 385 | +def list_clusters(): |
| 386 | + """ |
| 387 | + Returns: dictionary containing names of clusters and associated IDs |
| 388 | + """ |
| 389 | + url_call = URL + '/clusters' |
| 390 | + json = requests.get(url_call).json() |
| 391 | + return dict(sorted({ |
| 392 | + a["clusterName"]: a["agencyCluster"] |
| 393 | + for a in json if a["clusterName"]}.items())) |
| 394 | + |
| 395 | + |
379 | 396 | def list_jurisdictions(): |
380 | 397 | """ |
381 | 398 | Returns: dictionary containing names of jurisdictions and associated IDs |
|
0 commit comments