ds-caselaw-marklogic-api-client 21.0.0__py3-none-any.whl → 22.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ds-caselaw-marklogic-api-client might be problematic. Click here for more details.

@@ -62,6 +62,7 @@ if TYPE_CHECKING:
62
62
 
63
63
 
64
64
  DocumentURIString = NewType("DocumentURIString", str)
65
+ CourtIdentifierString = NewType("CourtIdentifierString", str)
65
66
 
66
67
 
67
68
  class CannotPublishUnpublishableDocument(Exception):
@@ -209,8 +210,11 @@ class Document:
209
210
  )
210
211
 
211
212
  @property
212
- def court_and_jurisdiction(self) -> str:
213
- return "/".join((self.court, self.jurisdiction))
213
+ def court_and_jurisdiction_identifier_string(self) -> CourtIdentifierString:
214
+ if self.jurisdiction != "":
215
+ return CourtIdentifierString("/".join((self.court, self.jurisdiction)))
216
+ else:
217
+ return CourtIdentifierString(self.court)
214
218
 
215
219
  @cached_property
216
220
  def document_date_as_string(self) -> str:
@@ -435,7 +439,9 @@ class Document:
435
439
  @cached_property
436
440
  def has_valid_court(self) -> bool:
437
441
  try:
438
- return bool(courts.get_by_code(self.court))
442
+ return bool(
443
+ courts.get_by_code(self.court_and_jurisdiction_identifier_string)
444
+ )
439
445
  except CourtNotFoundException:
440
446
  return False
441
447
 
@@ -192,13 +192,29 @@ class SearchResult:
192
192
  """
193
193
  :return: The court of the search result
194
194
  """
195
-
195
+ court = None
196
196
  court_code = self._get_xpath_match_string("search:extracted/uk:court/text()")
197
- try:
198
- court = courts.get_by_code(court_code)
199
- except CourtNotFoundException:
200
- court = None
201
-
197
+ jurisdiction_code = self._get_xpath_match_string(
198
+ "search:extracted/uk:jurisdiction/text()"
199
+ )
200
+ if jurisdiction_code:
201
+ court_code_with_jurisdiction = "%s/%s" % (court_code, jurisdiction_code)
202
+ try:
203
+ court = courts.get_by_code(court_code_with_jurisdiction)
204
+ except CourtNotFoundException:
205
+ logging.warning(
206
+ "Court not found with court code %s and jurisdiction code %s for judgment with NCN %s, falling back to court."
207
+ % (court_code, jurisdiction_code, self.neutral_citation)
208
+ )
209
+ if court is None:
210
+ try:
211
+ court = courts.get_by_code(court_code)
212
+ except CourtNotFoundException:
213
+ logging.warning(
214
+ "Court not found with court code %s for judgment with NCN %s, returning None."
215
+ % (court_code, self.neutral_citation)
216
+ )
217
+ court = None
202
218
  return court
203
219
 
204
220
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ds-caselaw-marklogic-api-client
3
- Version: 21.0.0
3
+ Version: 22.0.1
4
4
  Summary: An API client for interacting with the underlying data in Find Caselaw.
5
5
  Home-page: https://github.com/nationalarchives/ds-caselaw-custom-api-client
6
6
  Keywords: national archives,caselaw
@@ -14,7 +14,7 @@ Requires-Dist: boto3 (>=1.26.112,<2.0.0)
14
14
  Requires-Dist: certifi (>=2022.12.7,<2024.0.0)
15
15
  Requires-Dist: charset-normalizer (>=3.0.0,<4.0.0)
16
16
  Requires-Dist: django-environ (>=0.11.0,<0.12.0)
17
- Requires-Dist: ds-caselaw-utils (>=1.3.3,<2.0.0)
17
+ Requires-Dist: ds-caselaw-utils (>=1.4.1,<2.0.0)
18
18
  Requires-Dist: idna (>=3.4,<4.0)
19
19
  Requires-Dist: lxml (>=5.0.0,<6.0.0)
20
20
  Requires-Dist: memoization (>=0.4.0,<0.5.0)
@@ -5,7 +5,7 @@ caselawclient/client_helpers/search_helpers.py,sha256=DYgUltPq8fFI2KkLRqH1-8zpbb
5
5
  caselawclient/content_hash.py,sha256=DF7ujrQPNf1bTSbK0mIIaC5qx6CmF5I0xlQ7uIG0zYI,2236
6
6
  caselawclient/errors.py,sha256=3rsbOQ11hIhm7-UABcHNMcs9XgcrIzytAP0koyZBLWM,3195
7
7
  caselawclient/models/__init__.py,sha256=kd23EUpvaC7aLHdgk8farqKAQEx3lf7RvNT2jEatvlg,68
8
- caselawclient/models/documents.py,sha256=6w_U3Lwuve0ffJLJW78Lt5uojIbzD6I3PKWGWWLYFUU,20365
8
+ caselawclient/models/documents.py,sha256=NZautWi38T-hlhyyotiHr31hafFL4obCSHc7NuZW_e4,20658
9
9
  caselawclient/models/judgments.py,sha256=TcAsn27K--QQAfaaUZ8biybB9OeVS__91FRlwaG16HY,1020
10
10
  caselawclient/models/neutral_citation_mixin.py,sha256=G9QS5XZ0tf_VXTxt4Uryy_gZ4eBDsmChqEClLAntIwI,1810
11
11
  caselawclient/models/press_summaries.py,sha256=5c1jpVhVtmIMN8AeHMywGXvz4H55kKAIUaaaVims6Tw,994
@@ -15,7 +15,7 @@ caselawclient/models/utilities/move.py,sha256=_SKzO1UVXHFIVvWfT4nuCwdov7acp8tYzz
15
15
  caselawclient/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  caselawclient/responses/__init__.py,sha256=2-5NJn_PXPTje_W4dHeHYaNRN6vXK4UcB9eLLNUAKa4,67
17
17
  caselawclient/responses/search_response.py,sha256=OlzXOEnCg-4HdfOYfeIMdk-UfROOI_Nz-etfznFffok,1335
18
- caselawclient/responses/search_result.py,sha256=M6BSzkGRn0TY2Qs17bplv1RbhBHECAypUjnXnoslltc,7198
18
+ caselawclient/responses/search_result.py,sha256=BSVE2zBy-sy93fghd_kqwkhgwcnx1mFHY1_HTj-qO70,8096
19
19
  caselawclient/responses/xsl/search_match.xsl,sha256=4Sv--MrwBd7J48E9aI7jlFSXGlNi4dBqgzJ3bdMJ_ZU,1018
20
20
  caselawclient/search_parameters.py,sha256=nR-UC1aWZbdXzXBrVDaHECU4Ro8Zi4JZATtgrpAVsKY,3342
21
21
  caselawclient/xml_helpers.py,sha256=Ihy6OxdEHm7LFePX0XF6uzpyp6yo7U13zyP0nhpBguU,582
@@ -58,7 +58,7 @@ caselawclient/xquery/validate_all_documents.xqy,sha256=z_0YEXmRcZ-FaJM0ouKiTjdI4
58
58
  caselawclient/xquery/xslt.xqy,sha256=w57wNijH3dkwHkpKeAxqjlghVflQwo8cq6jS_sm-erM,199
59
59
  caselawclient/xquery/xslt_transform.xqy,sha256=smyFFxqmtkuOzBd2l7uw6K2oAsYctudrP8omdv_XNAM,2463
60
60
  caselawclient/xquery_type_dicts.py,sha256=A7yNusrb3lMKg6tmMrTOPZcjuJEijWHiBk4hk6eKCMM,5278
61
- ds_caselaw_marklogic_api_client-21.0.0.dist-info/LICENSE.md,sha256=fGMzyyLuQW-IAXUeDSCrRdsYW536aEWThdbpCjo6ZKg,1108
62
- ds_caselaw_marklogic_api_client-21.0.0.dist-info/METADATA,sha256=OTHWjjgvwMlUUY-YxoHCgoSBclZSlwjYs6FfXf-xrgc,4006
63
- ds_caselaw_marklogic_api_client-21.0.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
64
- ds_caselaw_marklogic_api_client-21.0.0.dist-info/RECORD,,
61
+ ds_caselaw_marklogic_api_client-22.0.1.dist-info/LICENSE.md,sha256=fGMzyyLuQW-IAXUeDSCrRdsYW536aEWThdbpCjo6ZKg,1108
62
+ ds_caselaw_marklogic_api_client-22.0.1.dist-info/METADATA,sha256=g3BQ1XWePR6qvtg4VFpuy9hhJGFmWHammOcJtnatxC4,4006
63
+ ds_caselaw_marklogic_api_client-22.0.1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
64
+ ds_caselaw_marklogic_api_client-22.0.1.dist-info/RECORD,,