Skip to content

Commit

Permalink
add justopinion to intersphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Aug 7, 2021
1 parent 0909f7c commit 9d5bc2a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 43 deletions.
2 changes: 1 addition & 1 deletion docs/api/decisions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Decisions
==============

.. autoclass:: authorityspoke.decisions.Decision
.. autoclass:: authorityspoke.decisions.DecisionReading
:members:
:special-members:
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"anchorpoint": ("https://anchorpoint.readthedocs.io/en/latest/", None),
"justopinion": ("https://justopinion.readthedocs.io/en/latest/", None),
"legislice": ("https://legislice.readthedocs.io/en/latest/", None),
"nettlesome": ("https://nettlesome.readthedocs.io/en/latest/", None),
"pint": ("https://pint.readthedocs.io/en/stable/", None),
Expand Down
18 changes: 12 additions & 6 deletions docs/guides/load_yaml_holdings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ citation of the case we want, we'll use the :meth:`~authorityspoke.io.downloads.
... licensing_case.add_opinion(Opinion())
>>> print(licensing_case)
United States v. Mazza-Alaluf, 621 F.3d 205 (2010-09-22)
>>> licensing_case_reading = DecisionReading(decision=licensing_case)

If we had used ``full_case=True``, we would have the option to view the full
text of the majority opinion using the command ``licensing_case.majority.text``.
Expand Down Expand Up @@ -587,12 +586,19 @@ Now when we load a file with this YAML, we'll get both Holdings.
2

Now that we generated this :class:`~authorityspoke.opinions.AnchoredHoldings` object
containing the data from the YAML file, we can use
the :class:`~authorityspoke.decisions.DecisionReading.posit` method to link those
:class:`~authorityspoke.holdings.Holding`\s to the judicial :class:`~authorityspoke.decisions.Decision`
we created from the data we downloaded from the CAP API. Then we can verify that
those two Holdings are now considered the two holdings of the Decision.
containing the data from the YAML file, we can link the :class:`~authorityspoke.holdings.Holding`\s
to the :class:`~justopinion.decisions.Decision` with
a :class:`~authorityspoke.decisions.DecisionReading` object.
While a :class:`~justopinion.decisions.Decision` is a record of what a court actually published,
a :class:`~authorityspoke.decisions.DecisionReading` represents the user's "reading" of the Decision.
The DecisionReading indicates what Holdings are supported by the Decision,
as well as what text passages support each Holding.

We'll use the :meth:`~authorityspoke.decisions.DecisionReading.posit` method to
link the Holdings to the Decision. Then we can verify that those two Holdings
are now considered the two holdings of the Decision.

>>> licensing_case_reading = DecisionReading(decision=licensing_case)
>>> licensing_case_reading.posit(both_holdings_with_anchors)
>>> len(licensing_case_reading.holdings)
2
81 changes: 45 additions & 36 deletions notebooks/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"\n",
"To provide you with legislation text, AuthoritySpoke imports the [Legislice](https://pypi.org/project/legislice/) Python package, which provides an interface to the Legislice API at [authorityspoke.com](https://authorityspoke.com/). This API currently provides access to recent versions of the United States Code, plus the United States Constitution. You'll need to [sign up](https://authorityspoke.com/account/signup/) for an account and then obtain a Legislice API key from your account page. The Legislice API key is not the same as the Caselaw Access Project API key.\n",
"\n",
"As of version 0.4, you mostly have to create your own procedural rule annotations, but the `example_data` folder of the [GitHub repository for AuthoritySpoke](https://github.com/mscarey/AuthoritySpoke) contains example annotations for several cases. The rest of this tutorial depends on having access to the `example_data` folder, so if you're running the tutorial code interactively, you'll need to either clone the AuthoritySpoke repository to your computer and run the tutorial from there, or else run the tutorial from a cloud environment like [Binder](https://mybinder.org/v2/gh/mscarey/AuthoritySpoke/master). If you've only installed AuthoritySpoke from `pip`, you won't have access to the example data files."
"In the current version, you mostly have to create your own procedural rule annotations, but the `example_data` folder of the [GitHub repository for AuthoritySpoke](https://github.com/mscarey/AuthoritySpoke) contains example annotations for several cases. The rest of this tutorial depends on having access to the `example_data` folder, so if you're running the tutorial code interactively, you'll need to either clone the AuthoritySpoke repository to your computer and run the tutorial from there, or else run the tutorial from a cloud environment like [Binder](https://mybinder.org/v2/gh/mscarey/AuthoritySpoke/master). If you've only installed AuthoritySpoke from `pip`, you won't have access to the example data files."
]
},
{
Expand Down Expand Up @@ -84,12 +84,13 @@
"metadata": {},
"outputs": [],
"source": [
"from authorityspoke.io.loaders import load_and_read_decision\n",
"from authorityspoke.io.loaders import load_decision\n",
"from authorityspoke.io.readers import read_decision\n",
"\n",
"if not USE_REAL_CASE_API:\n",
"\n",
" oracle = load_and_read_decision(\"oracle_h.json\")\n",
" lotus = load_and_read_decision(\"lotus_h.json\")"
" oracle_case = read_decision(load_decision(\"oracle_h.json\"))\n",
" lotus_case = read_decision(load_decision(\"lotus_h.json\"))"
]
},
{
Expand Down Expand Up @@ -142,12 +143,11 @@
"metadata": {},
"outputs": [],
"source": [
"from authorityspoke.io.downloads import CAPClient\n",
"from authorityspoke.io.loaders import load_and_read_decision\n",
"from authorityspoke import CAPClient\n",
"\n",
"if USE_REAL_CASE_API:\n",
" case_client = CAPClient(api_token=CAP_API_KEY)\n",
" oracle = case_client.read_cite(cite=\"750 F.3d 1339\")"
" oracle_case = case_client.read_cite(cite=\"750 F.3d 1339\")"
]
},
{
Expand All @@ -174,7 +174,7 @@
}
],
"source": [
"oracle.name"
"oracle_case.name"
]
},
{
Expand All @@ -191,7 +191,7 @@
"outputs": [],
"source": [
"if USE_REAL_CASE_API:\n",
" oracle = case_client.read_cite(\n",
" oracle_case = case_client.read_cite(\n",
" cite=\"750 F.3d 1339\", full_case=True)"
]
},
Expand All @@ -209,7 +209,7 @@
"outputs": [],
"source": [
"if USE_REAL_CASE_API:\n",
" lotus = case_client.read_cite(\n",
" lotus_case = case_client.read_cite(\n",
" cite=\"49 F.3d 807\", full_case=True)"
]
},
Expand All @@ -234,7 +234,7 @@
}
],
"source": [
"print(oracle)"
"print(oracle_case)"
]
},
{
Expand All @@ -251,7 +251,7 @@
}
],
"source": [
"print(lotus)"
"print(lotus_case)"
]
},
{
Expand All @@ -270,12 +270,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"majority Opinion by O’MALLEY, Circuit Judge.\n"
"majority opinion by O’MALLEY, Circuit Judge\n"
]
}
],
"source": [
"print(oracle.majority)"
"print(oracle_case.majority)"
]
},
{
Expand All @@ -287,12 +287,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"majority Opinion by STAHL, Circuit Judge.\n"
"majority opinion by STAHL, Circuit Judge\n"
]
}
],
"source": [
"print(lotus.majority)"
"print(lotus_case.majority)"
]
},
{
Expand All @@ -315,7 +315,7 @@
"metadata": {},
"outputs": [],
"source": [
"from authorityspoke.io.downloads import LegisClient\n",
"from authorityspoke import LegisClient\n",
"from authorityspoke.io.fake_enactments import FakeClient\n",
"\n",
"if USE_REAL_LEGISLICE_API:\n",
Expand Down Expand Up @@ -390,28 +390,28 @@
"data": {
"text/plain": [
"{'outputs': [{'absent': False,\n",
" 'predicate': {'truth': False,\n",
" 'content': '${the_java_api} was copyrightable',\n",
" 'expression': None},\n",
" 'terms': [{'generic': True,\n",
" 'name': 'the Java API',\n",
" 'name': '',\n",
" 'generic': False,\n",
" 'terms': [{'name': 'the Java API',\n",
" 'generic': True,\n",
" 'plural': False,\n",
" 'type': 'Entity'}],\n",
" 'predicate': {'content': '${the_java_api} was copyrightable',\n",
" 'expression': None,\n",
" 'truth': False},\n",
" 'standard_of_proof': None,\n",
" 'generic': False,\n",
" 'name': '',\n",
" 'type': 'Fact'}],\n",
" 'inputs': [{'absent': False,\n",
" 'predicate': {'truth': False,\n",
" 'content': '${the_java_api} was an original work',\n",
" 'expression': None},\n",
" 'terms': [{'generic': True,\n",
" 'name': 'the Java API',\n",
" 'name': '',\n",
" 'generic': False,\n",
" 'terms': [{'name': 'the Java API',\n",
" 'generic': True,\n",
" 'plural': False,\n",
" 'type': 'Entity'}],\n",
" 'predicate': {'content': '${the_java_api} was an original work',\n",
" 'expression': None,\n",
" 'truth': False},\n",
" 'standard_of_proof': None,\n",
" 'generic': False,\n",
" 'name': '',\n",
" 'type': 'Fact'}],\n",
" 'despite': []}"
]
Expand Down Expand Up @@ -447,13 +447,16 @@
"metadata": {},
"outputs": [],
"source": [
"from authorityspoke.decisions import DecisionReading\n",
"from authorityspoke.io.loaders import read_anchored_holdings_from_file\n",
"\n",
"oracle_holdings_with_anchors = read_anchored_holdings_from_file(\"holding_oracle.yaml\", client=legis_client)\n",
"lotus_holdings_with_anchors = read_anchored_holdings_from_file(\"holding_lotus.yaml\", client=legis_client)\n",
"oracle_holdings = read_anchored_holdings_from_file(\"holding_oracle.yaml\", client=legis_client)\n",
"lotus_holdings = read_anchored_holdings_from_file(\"holding_lotus.yaml\", client=legis_client)\n",
"\n",
"oracle.posit(oracle_holdings_with_anchors)\n",
"lotus.posit(lotus_holdings_with_anchors)"
"oracle = DecisionReading(decision=oracle_case)\n",
"oracle.posit(oracle_holdings)\n",
"lotus = DecisionReading(decision=lotus_case)\n",
"lotus.posit(lotus_holdings)"
]
},
{
Expand Down Expand Up @@ -1171,7 +1174,13 @@
"metadata": {},
"outputs": [],
"source": [
"feist = load_and_read_decision(\"feist_h.json\")\n",
"if USE_REAL_CASE_API:\n",
" feist_case = case_client.read_cite('499 U.S. 340')\n",
"\n",
"else:\n",
" feist_case = read_decision(load_decision(\"feist_h.json\"))\n",
"\n",
"feist = DecisionReading(decision=feist_case)\n",
"feist.posit(read_anchored_holdings_from_file(\"holding_feist.json\", client=legis_client))\n"
]
},
Expand Down

0 comments on commit 9d5bc2a

Please sign in to comment.