Downloads the FJC's Biographical Directory of Article III Federal Judges.
The Federal Judicial Center exports its directory every night as six CSV files, one for each category of information about the judges (see https://www.fjc.gov/history/judges/biographical-directory-article-iii-federal-judges-export). They need no account and are a few megabytes together. They are saved under their FJC names in the "raw" folder of the data folder:
data_folder/
└── raw/ demographics.csv, federal-judicial-service.csv, ...
Contents
data_folder: returns the folder where the files are kept. download: downloads the FJC's files. raw_folder: returns the folder of the downloaded files.
data_folder()
¶
Returns the folder where the files are kept.
The folder is the one named by the FJC_BIOGRAPHIES_DATA_DIR environment
variable, if it is set. Otherwise, when fjc_biographies runs from its
repository, it is options._DATA_FOLDER: "data/courts/fjc_biographies"
two folders above the repository, beside the folder of code projects
(where courtpy and fjc-idb keep their files as well). When fjc_biographies
is installed as a package, it is "fjc_biographies" in the user's local
application data folder on Windows ("%LOCALAPPDATA%"), or in
"~/.local/share" (or "$XDG_DATA_HOME") on other systems.
Returns:
| Type | Description |
|---|---|
Path
|
The path of the folder. It is not created. |
Source code in src/fjc_biographies/downloader.py
download(categories=None, folder=None, *, overwrite=False)
¶
Downloads the FJC's files of the directory.
A file that was downloaded before is skipped unless overwrite is True.
The FJC adds new judges and corrects its data as it goes, so overwrite
the files to get the latest data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
categories
|
Iterable[str] | str | None
|
the categories to download ("demographics", "service", "other_service", "education", "career", and "other_nominations"). Defaults to None, in which case every category is downloaded. |
None
|
folder
|
Path | str | None
|
the data folder, whose "raw" folder the files are saved in.
Defaults to None, in which case |
None
|
overwrite
|
bool
|
whether to download a file that is already there. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, Path]
|
The path of each file, by its category. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if a category is not one of the FJC's. |
Examples:
Source code in src/fjc_biographies/downloader.py
raw_folder(folder=None)
¶
Returns the folder of the downloaded files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
Path | str | None
|
the data folder. Defaults to None, in which case
|
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The "raw" folder of the data folder. It is not created. |