Loaders¶
Functions to load JSON or XML files for conversion into authorityspoke objects.
Will usually hand off data to the io.readers module to create authorityspoke objects.
Create a new
Code
from an XML filepath.Defers parsing of the XML until later, which makes “read” in the function name misleading.
- Parameters
filename (
Optional
[str
]) – Name of the XML file representing theCode
. Ignored if filepath is given.directory (
Optional
[Path
]) – Directory where the XML file can be found. Ignored if filepath is given.filepath (
Optional
[Path
]) – Complete path to the XML file representing theCode
, including filename.
- Return type
BeautifulSoup
- Returns
new
Code
object that can be used to parse the XML to find text ofEnactment
s.
Load a list of records from JSON to create
Holding
s.- Parameters
filename (
Optional
[str
]) – the name of the JSON file to look in forHolding
data in the format that listsmentioned_factors
followed by a list of holdings.directory (
Optional
[Path
]) – the path of the directory containing the JSON file.filepath (
Optional
[Path
]) – Complete path to the XML file representing theCode
, including filename.
- Parame regime
- Return type
List
[Dict
[str
,Union
[Dict
[str
,Union
[Dict
[str
,Sequence
[Dict
[str
,Union
[Dict
[str
,Union
[str
,bool
]],Sequence
[Any
],str
,bool
]]]],Sequence
[Dict
[str
,Union
[str
,List
[Union
[str
,Dict
[str
,str
]]]]]],str
,bool
]],str
,bool
]]]- Returns
a list of
Holding
s from a JSON file in theexample_data/holdings
subdirectory, from a JSON file.
Read
Rule
s from a file.Even though this function will generate
Rule
s instead ofHolding
s, it uses theload_holding()
function. Some fields that can exist in aHolding
object (rule_valid, decided, exclusive) are not applicable toRule
s.- Parameters
- Return type
Read holdings from a file.
- Parameters
- Return type
Read holdings with factor index from a file.
- Return type
Read holdings from file, with Opinion text anchors for holdings and factors.
- Return type
AnchoredHoldings
Load file containing a judicial decision with one or more opinions.
Relies on the JSON format from the Caselaw Access Project API.
- Parameters
- Return type