Readers¶
Converting simple structured data from XML or JSON into authorityspoke objects.
These functions will usually be called by functions from the io.loaders module after they import some data from a file.
Construct a
Fact
after loading a dict from JSON.
Turn fields from JSON into a
Factor
object.
Turn fields from JSON into a
Factor
object.
Turn fields from JSON into a
Procedure
object.
Create new
Holding
object from simple datatypes from JSON input.Will yield multiple items if
exclusive: True
is present inrecord
.- Parameters
record (
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
]]) – dict of values for constructingHolding
client (
Optional
[Client
]) – Legislice client for downloading missing fields from recordmany – if True, record represents a list of
Holding
s rather than just one.
- Return type
- Returns
New
Holding
, and an updated dictionary with mentionedFactor
s as keys and theirTextQuoteSelector
s as values.
Lists
Holding
objects with corresponding text selectors.Alias for field number 0
Alias for field number 1
Alias for field number 2
Load a list of
Holdings
s from JSON, with “mentioned” index.- Return type
Load a list of
Holding
s from JSON, with text links.- Parameters
record (
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
]]]) – a list of dicts representing holdings, in the JSON input formatclient (
Optional
[Client
]) – Legislice client for downloading missing fields from recordmany (
bool
) – a bool indicating whether to use the “many” form of the Marshmallow schema (whether there are multiple Holdings)
- Return type
AnchoredHoldings
- Returns
a namedtuple listing
Holding
objects with a list matchingHolding
s to selectors and an index matchingFactor
s to selectors.
Load a list of
Holdings
s from JSON.- Parameters
record (
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
]]]) – a list of dicts representing holdings, in the JSON input format- Parame regime
A collection of
Jurisdiction
s and theCode
s that have been enacted in each. Used for constructingEnactment
s referenced byHolding
s.- Return type
- Returns
a list of
Holding
objects
Create and return one or more
Opinion
objects from a dict API response.Relies on the JSON format from the Caselaw Access Project API.
This function is a more convenient way to call read_opinions with an entire case from the CAP API as a single parameter.
Make
Rule
and “mentioned” index from dict of fields andRegime
.
Make
Rule
from adict
of fields and aRegime
.