ds-caselaw-marklogic-api-client 31.1.0__tar.gz → 32.0.0__tar.gz
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.
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/PKG-INFO +1 -1
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/pyproject.toml +1 -1
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/factories.py +14 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/documents/__init__.py +24 -10
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/identifiers/__init__.py +5 -3
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/identifiers/fclid.py +4 -2
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/identifiers/neutral_citation.py +4 -2
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/identifiers/press_summary_ncn.py +4 -2
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/LICENSE.md +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/README.md +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/Client.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/__init__.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/client_helpers/__init__.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/client_helpers/search_helpers.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/content_hash.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/errors.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/identifier_resolution.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/__init__.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/documents/body.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/documents/exceptions.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/documents/statuses.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/documents/transforms/html.xsl +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/documents/xml.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/identifiers/unpacker.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/judgments.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/neutral_citation_mixin.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/press_summaries.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/utilities/__init__.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/utilities/aws.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/utilities/dates.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/models/utilities/move.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/py.typed +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/responses/__init__.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/responses/search_response.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/responses/search_result.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/responses/xsl/search_match.xsl +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/search_parameters.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/types.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xml_helpers.py +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/break_judgment_checkout.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/checkin_judgment.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/checkout_judgment.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/copy_document.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/delete_judgment.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/document_collections.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/document_exists.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_combined_stats_table.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_components_for_document.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_highest_enrichment_version.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_highest_parser_version.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_judgment.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_judgment_checkout_status.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_judgment_version.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_last_modified.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_next_document_sequence_number.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_pending_enrichment_for_version.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_pending_parse_for_version.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_properties_for_search_results.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_property.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_property_as_node.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_recently_enriched.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_recently_parsed.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_version_annotation.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/get_version_created.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/insert_document.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/list_judgment_versions.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/resolve_from_identifier_slug.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/resolve_from_identifier_value.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_boolean_property.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_metadata_citation.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_metadata_court.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_metadata_jurisdiction.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_metadata_name.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_metadata_this_uri.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_metadata_work_expression_date.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_property.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/set_property_as_node.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/update_document.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/update_locked_judgment.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/user_has_privilege.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/user_has_role.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/validate_all_documents.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/validate_document.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/xslt.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery/xslt_transform.xqy +0 -0
- {ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/src/caselawclient/xquery_type_dicts.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ds-caselaw-marklogic-api-client
|
|
3
|
-
Version:
|
|
3
|
+
Version: 32.0.0
|
|
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
|
{ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/pyproject.toml
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "ds-caselaw-marklogic-api-client"
|
|
3
|
-
version = "
|
|
3
|
+
version = "32.0.0"
|
|
4
4
|
description = "An API client for interacting with the underlying data in Find Caselaw."
|
|
5
5
|
authors = ["The National Archives"]
|
|
6
6
|
homepage = "https://github.com/nationalarchives/ds-caselaw-custom-api-client"
|
|
@@ -9,6 +9,8 @@ from caselawclient.Client import MarklogicApiClient
|
|
|
9
9
|
from caselawclient.identifier_resolution import IdentifierResolution, IdentifierResolutions
|
|
10
10
|
from caselawclient.models.documents import Document
|
|
11
11
|
from caselawclient.models.documents.body import DocumentBody
|
|
12
|
+
from caselawclient.models.identifiers import Identifier
|
|
13
|
+
from caselawclient.models.identifiers.fclid import FindCaseLawIdentifier
|
|
12
14
|
from caselawclient.models.judgments import Judgment
|
|
13
15
|
from caselawclient.models.press_summaries import PressSummary
|
|
14
16
|
from caselawclient.responses.search_result import SearchResult, SearchResultMetadata
|
|
@@ -68,8 +70,12 @@ class DocumentFactory:
|
|
|
68
70
|
cls,
|
|
69
71
|
uri: DocumentURIString = DocumentURIString("test/2023/123"),
|
|
70
72
|
api_client: Optional[MarklogicApiClient] = None,
|
|
73
|
+
identifiers: Optional[list[Identifier]] = None,
|
|
71
74
|
**kwargs: Any,
|
|
72
75
|
) -> target_class:
|
|
76
|
+
def _fake_linked_documents(*args: Any, **kwargs: Any) -> list["Document"]:
|
|
77
|
+
return [document]
|
|
78
|
+
|
|
73
79
|
if not api_client:
|
|
74
80
|
api_client = Mock(spec=MarklogicApiClient)
|
|
75
81
|
api_client.get_judgment_xml_bytestring.return_value = DEFAULT_DOCUMENT_BODY_XML.encode(encoding="utf-8")
|
|
@@ -78,6 +84,14 @@ class DocumentFactory:
|
|
|
78
84
|
document = cls.target_class(uri, api_client=api_client)
|
|
79
85
|
document.body = kwargs.pop("body") if "body" in kwargs else DocumentBodyFactory.build()
|
|
80
86
|
|
|
87
|
+
if identifiers is None:
|
|
88
|
+
document.identifiers.add(FindCaseLawIdentifier(value="a1b2c3"))
|
|
89
|
+
else:
|
|
90
|
+
for identifier in identifiers:
|
|
91
|
+
document.identifiers.add(identifier)
|
|
92
|
+
|
|
93
|
+
setattr(document, "linked_documents", _fake_linked_documents)
|
|
94
|
+
|
|
81
95
|
for param_name, default_value in cls.PARAMS_MAP.items():
|
|
82
96
|
value = kwargs.get(param_name, default_value)
|
|
83
97
|
setattr(document, param_name, value)
|
|
@@ -161,7 +161,19 @@ class Document:
|
|
|
161
161
|
"""
|
|
162
162
|
:return: The absolute, public URI at which a copy of this document can be found
|
|
163
163
|
"""
|
|
164
|
-
return f"https://caselaw.nationalarchives.gov.uk/{self.
|
|
164
|
+
return f"https://caselaw.nationalarchives.gov.uk/{self.slug}"
|
|
165
|
+
|
|
166
|
+
@cached_property
|
|
167
|
+
def slug(self) -> str:
|
|
168
|
+
"""
|
|
169
|
+
:return: The best public-facing URL for the judgment, which is the slug
|
|
170
|
+
of the most-preferred identifier, which should either be an NCN or fclid.
|
|
171
|
+
"""
|
|
172
|
+
preferred_identifier = self.identifiers.preferred()
|
|
173
|
+
if preferred_identifier:
|
|
174
|
+
return preferred_identifier.url_slug
|
|
175
|
+
msg = f"No preferred identifier exists for {self.uri}"
|
|
176
|
+
raise RuntimeError(msg)
|
|
165
177
|
|
|
166
178
|
@cached_property
|
|
167
179
|
def is_published(self) -> bool:
|
|
@@ -335,18 +347,13 @@ class Document:
|
|
|
335
347
|
"""
|
|
336
348
|
Request enrichment of a document, if it's sensible to do so.
|
|
337
349
|
"""
|
|
338
|
-
if self.
|
|
350
|
+
if self.enriched_recently is False:
|
|
351
|
+
print("Enrichment requested")
|
|
339
352
|
self.force_enrich()
|
|
340
353
|
return True
|
|
354
|
+
print("Enrichment not requested as document was enriched recently")
|
|
341
355
|
return False
|
|
342
356
|
|
|
343
|
-
@cached_property
|
|
344
|
-
def can_enrich(self) -> bool:
|
|
345
|
-
"""
|
|
346
|
-
Is it sensible to enrich this document?
|
|
347
|
-
"""
|
|
348
|
-
return (self.enriched_recently is False) and self.validates_against_schema
|
|
349
|
-
|
|
350
357
|
@cached_property
|
|
351
358
|
def enriched_recently(self) -> bool:
|
|
352
359
|
"""
|
|
@@ -497,7 +504,7 @@ class Document:
|
|
|
497
504
|
raise AttributeError(f"Neither 'Document' nor 'DocumentBody' objects have an attribute '{name}'")
|
|
498
505
|
|
|
499
506
|
def linked_document_resolutions(self, namespaces: list[str], only_published: bool = True) -> IdentifierResolutions:
|
|
500
|
-
"""Get
|
|
507
|
+
"""Get document resolutions which share the same neutral citation as this document."""
|
|
501
508
|
if not hasattr(self, "neutral_citation") or not self.neutral_citation:
|
|
502
509
|
return IdentifierResolutions([])
|
|
503
510
|
|
|
@@ -513,3 +520,10 @@ class Document:
|
|
|
513
520
|
if resolution.document_uri != self.uri.as_marklogic() and resolution.identifier_namespace in namespaces
|
|
514
521
|
]
|
|
515
522
|
)
|
|
523
|
+
|
|
524
|
+
def linked_documents(self, namespaces: list[str], only_published: bool = True) -> list["Document"]:
|
|
525
|
+
resolutions = self.linked_document_resolutions(namespaces=namespaces, only_published=only_published)
|
|
526
|
+
return [
|
|
527
|
+
Document(resolution.document_uri.as_document_uri(), api_client=self.api_client)
|
|
528
|
+
for resolution in resolutions
|
|
529
|
+
]
|
|
@@ -4,6 +4,8 @@ from uuid import uuid4
|
|
|
4
4
|
|
|
5
5
|
from lxml import etree
|
|
6
6
|
|
|
7
|
+
from caselawclient.types import DocumentIdentifierSlug, DocumentIdentifierValue
|
|
8
|
+
|
|
7
9
|
IDENTIFIER_PACKABLE_ATTRIBUTES: list[str] = [
|
|
8
10
|
"uuid",
|
|
9
11
|
"value",
|
|
@@ -60,7 +62,7 @@ class IdentifierSchema(ABC):
|
|
|
60
62
|
|
|
61
63
|
@classmethod
|
|
62
64
|
@abstractmethod
|
|
63
|
-
def compile_identifier_url_slug(cls, value: str) ->
|
|
65
|
+
def compile_identifier_url_slug(cls, value: str) -> DocumentIdentifierSlug:
|
|
64
66
|
"""Convert an identifier into a precompiled URL slug."""
|
|
65
67
|
pass
|
|
66
68
|
|
|
@@ -71,7 +73,7 @@ class Identifier(ABC):
|
|
|
71
73
|
schema: type[IdentifierSchema]
|
|
72
74
|
|
|
73
75
|
uuid: str
|
|
74
|
-
value:
|
|
76
|
+
value: DocumentIdentifierValue
|
|
75
77
|
|
|
76
78
|
def __init_subclass__(cls: type["Identifier"], **kwargs: Any) -> None:
|
|
77
79
|
"""Ensure that subclasses have the required attributes set."""
|
|
@@ -87,7 +89,7 @@ class Identifier(ABC):
|
|
|
87
89
|
return self.value
|
|
88
90
|
|
|
89
91
|
def __init__(self, value: str, uuid: Optional[str] = None) -> None:
|
|
90
|
-
self.value = value
|
|
92
|
+
self.value = DocumentIdentifierValue(value)
|
|
91
93
|
if uuid:
|
|
92
94
|
self.uuid = uuid
|
|
93
95
|
else:
|
|
@@ -3,6 +3,8 @@ from typing import TYPE_CHECKING
|
|
|
3
3
|
|
|
4
4
|
from sqids import Sqids
|
|
5
5
|
|
|
6
|
+
from caselawclient.types import DocumentIdentifierSlug
|
|
7
|
+
|
|
6
8
|
from . import Identifier, IdentifierSchema
|
|
7
9
|
|
|
8
10
|
if TYPE_CHECKING:
|
|
@@ -35,8 +37,8 @@ class FindCaseLawIdentifierSchema(IdentifierSchema):
|
|
|
35
37
|
return bool(VALID_FCLID_PATTERN.match(value))
|
|
36
38
|
|
|
37
39
|
@classmethod
|
|
38
|
-
def compile_identifier_url_slug(cls, value: str) ->
|
|
39
|
-
return "tna." + value
|
|
40
|
+
def compile_identifier_url_slug(cls, value: str) -> DocumentIdentifierSlug:
|
|
41
|
+
return DocumentIdentifierSlug("tna." + value)
|
|
40
42
|
|
|
41
43
|
@classmethod
|
|
42
44
|
def mint(cls, api_client: "MarklogicApiClient") -> "FindCaseLawIdentifier":
|
|
@@ -3,6 +3,8 @@ import re
|
|
|
3
3
|
from ds_caselaw_utils import neutral_url
|
|
4
4
|
from ds_caselaw_utils.types import NeutralCitationString
|
|
5
5
|
|
|
6
|
+
from caselawclient.types import DocumentIdentifierSlug
|
|
7
|
+
|
|
6
8
|
from . import Identifier, IdentifierSchema
|
|
7
9
|
|
|
8
10
|
VALID_NCN_PATTERN = re.compile(r"(^\[([0-9]{4})\] ([a-zA-Z]+)(?: ([a-zA-Z]+))? ([0-9]+)(?: \(([a-zA-Z]+)\))?$)")
|
|
@@ -38,13 +40,13 @@ class NeutralCitationNumberSchema(IdentifierSchema):
|
|
|
38
40
|
return bool(VALID_NCN_PATTERN.match(value))
|
|
39
41
|
|
|
40
42
|
@classmethod
|
|
41
|
-
def compile_identifier_url_slug(cls, value: str) ->
|
|
43
|
+
def compile_identifier_url_slug(cls, value: str) -> DocumentIdentifierSlug:
|
|
42
44
|
ncn_based_uri_string = neutral_url(
|
|
43
45
|
NeutralCitationString(value)
|
|
44
46
|
) # TODO: At some point this should move out of utils and into this class.
|
|
45
47
|
if not ncn_based_uri_string:
|
|
46
48
|
raise Exception(f"Unable to convert NCN {value} into NCN-based URL slug")
|
|
47
|
-
return ncn_based_uri_string
|
|
49
|
+
return DocumentIdentifierSlug(ncn_based_uri_string)
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
class NeutralCitationNumber(Identifier):
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from caselawclient.types import DocumentIdentifierSlug
|
|
2
|
+
|
|
1
3
|
from .neutral_citation import NeutralCitationNumber, NeutralCitationNumberSchema
|
|
2
4
|
|
|
3
5
|
|
|
@@ -12,8 +14,8 @@ class PressSummaryRelatedNCNIdentifierSchema(NeutralCitationNumberSchema):
|
|
|
12
14
|
base_score_multiplier = 0.5
|
|
13
15
|
|
|
14
16
|
@classmethod
|
|
15
|
-
def compile_identifier_url_slug(cls, value: str) ->
|
|
16
|
-
return super().compile_identifier_url_slug(value) + "/press-summary"
|
|
17
|
+
def compile_identifier_url_slug(cls, value: str) -> DocumentIdentifierSlug:
|
|
18
|
+
return DocumentIdentifierSlug(super().compile_identifier_url_slug(value) + "/press-summary")
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
class PressSummaryRelatedNCNIdentifier(NeutralCitationNumber):
|
{ds_caselaw_marklogic_api_client-31.1.0 → ds_caselaw_marklogic_api_client-32.0.0}/LICENSE.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|