ds-caselaw-marklogic-api-client 41.0.0__py3-none-any.whl → 41.1.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.

@@ -61,6 +61,8 @@ class DocumentFactory:
61
61
  "source_name": "Example Uploader",
62
62
  "source_email": "uploader@example.com",
63
63
  "consignment_reference": "TDR-12345",
64
+ "first_published_datetime": None,
65
+ "has_ever_been_published": False,
64
66
  "assigned_to": "",
65
67
  "versions": [],
66
68
  }
@@ -312,10 +312,37 @@ class Document:
312
312
 
313
313
  @cached_property
314
314
  def first_published_datetime(self) -> Optional[datetime.datetime]:
315
+ """
316
+ Return the database value for the date and time this document was first published.
317
+
318
+ :return: The datetime value in the database for "first published".
319
+ """
315
320
  return self.api_client.get_datetime_property(self.uri, "first_published_datetime")
316
321
 
322
+ @cached_property
323
+ def first_published_datetime_display(self) -> Optional[datetime.datetime]:
324
+ """
325
+ Return the display value for the date and time this document was first published.
326
+
327
+ A value of 1970-01-01 00:00 indicates that the document has been published previously, but the exact date and time is unknown. In this case, return `None`. This can be used alongside `has_ever_been_published` to indicate an "unknown" state.
328
+
329
+ :return: The datetime value to be displayed to end users for "first published".
330
+ """
331
+
332
+ if self.first_published_datetime == datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc):
333
+ return None
334
+
335
+ return self.first_published_datetime
336
+
317
337
  @cached_property
318
338
  def has_ever_been_published(self) -> bool:
339
+ """
340
+ Do we consider this document to have ever been published?
341
+
342
+ This is `True` if either the document is currently published, or if `first_published_datetime` has any value (including the sentinel value).
343
+
344
+ :return: A boolean indicating if the document has ever been published.
345
+ """
319
346
  return self.is_published or self.first_published_datetime is not None
320
347
 
321
348
  @cached_property
@@ -5,5 +5,11 @@ declare variable $uri as xs:string external;
5
5
 
6
6
  let $doc := doc($uri)
7
7
  let $hash := $doc//uk:hash/text()
8
- let $count := count(cts:search(fn:doc(), cts:element-value-query(xs:QName("uk:hash"), $hash)))
9
- return $count = 1
8
+ let $count := count(cts:uris(
9
+ (), (),
10
+ cts:and-query((
11
+ cts:element-value-query(xs:QName("uk:hash"), $hash),
12
+ cts:collection-query("http://marklogic.com/collections/dls/latest-version")
13
+ ))
14
+ ))
15
+ return $count
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ds-caselaw-marklogic-api-client
3
- Version: 41.0.0
3
+ Version: 41.1.1
4
4
  Summary: An API client for interacting with the underlying data in Find Caselaw.
5
5
  Keywords: national archives,caselaw
6
6
  Author: The National Archives
@@ -4,10 +4,10 @@ caselawclient/client_helpers/__init__.py,sha256=eucyUXwUqI72TPw-C5zLcHlMu4GtFY50
4
4
  caselawclient/client_helpers/search_helpers.py,sha256=R99HyRLeYHgsw2L3DOidEqlKLLvs6Tga5rKTuWQViig,1525
5
5
  caselawclient/content_hash.py,sha256=0cPC4OoABq0SC2wYFX9-24DodNigeOqksDxgxQH_hUA,2221
6
6
  caselawclient/errors.py,sha256=JC16fEGq_MRJX-_KFzfINCV2Cqx8o6OWOt3C16rQd84,3142
7
- caselawclient/factories.py,sha256=eGj9TiZpmF3todW-08Ps7bHNMvByHqwEbgujRhvU_Yc,7382
7
+ caselawclient/factories.py,sha256=HXJeWpN7__X462joco07ziNqMOOMr-wUPJ91Y69gFk8,7466
8
8
  caselawclient/identifier_resolution.py,sha256=B5I1sD7o7YjzsXMECjbKjgiGLDda5bGhejsJ-lYpTIg,2429
9
9
  caselawclient/models/__init__.py,sha256=kd23EUpvaC7aLHdgk8farqKAQEx3lf7RvNT2jEatvlg,68
10
- caselawclient/models/documents/__init__.py,sha256=DSHbaFjSZmvGlVoXYPlE3FcMhRHp1Ib52KUF9lr1g-w,23128
10
+ caselawclient/models/documents/__init__.py,sha256=kBgu7V049KP5cBxH0GyePuD1gWoVs5JZFRdTzuMVKrE,24375
11
11
  caselawclient/models/documents/body.py,sha256=pzk3bm9FGIWfI0Hs8dBuzk6RCiA9M4GHfgOYKpNlzyE,8455
12
12
  caselawclient/models/documents/comparison.py,sha256=KwFZQByOcYcZKe8csjAntttACKq4BZb28n2VeV5rK54,1355
13
13
  caselawclient/models/documents/exceptions.py,sha256=te7PPQTDHjZ9EYVg5pVaiZfF00lMBFy333PHj8_mkC4,443
@@ -38,7 +38,7 @@ caselawclient/search_parameters.py,sha256=A-9icXdyFYLDACjUaRQF8mrnaVRlFJ9XCPtu5u
38
38
  caselawclient/types.py,sha256=tf4EtzQyMfHk-eYvLLlRhpSV5iBIEOWxAhcCYBXnaJQ,2744
39
39
  caselawclient/xml_helpers.py,sha256=31cxsDu680SFi3gR35rL7EdBZaW6r6mt4zvWHjJeX9o,1131
40
40
  caselawclient/xquery/break_judgment_checkout.xqy,sha256=rISzoBKxQKrP5ZRdCSoRqOXW8T_NDBSZRFjOXo_H3ns,220
41
- caselawclient/xquery/check_content_hash_unique_by_uri.xqy,sha256=fqSsqm4VFW3aS_DIDn1AIF54k3hs-xvlh_Xpyp-rf-I,386
41
+ caselawclient/xquery/check_content_hash_unique_by_uri.xqy,sha256=_0fxpTxzanuVEh13l18S52qvI_1mwvJMng4XesCX0TM,490
42
42
  caselawclient/xquery/checkin_judgment.xqy,sha256=QeGqO3kL-q0UrjopCVU0lCbkwbyoc5SuNLYFAIbbyMg,197
43
43
  caselawclient/xquery/checkout_judgment.xqy,sha256=aRwVo4KXoEKXfXRZ6IrVfvh0pXK-7pFxVIgEyzE5DRY,385
44
44
  caselawclient/xquery/copy_document.xqy,sha256=GwgafibZhUB4rZ7x5wmHAKi0DO1aEWNVithkguwsVGE,453
@@ -89,7 +89,7 @@ caselawclient/xquery/xslt_transform.xqy,sha256=cccaFiGkCcvSfDv007UriZ3I4ak2nTLP1
89
89
  caselawclient/xquery_type_dicts.py,sha256=f4PM8yZi5RRMdL2lQ8tsLUs0aJjBa5chvd-VVj40fJY,6767
90
90
  caselawclient/xslt/modify_xml_live.xsl,sha256=gNjwBun2-UzOeeuf0wNjFtN3jXm1yrwqv_KT8r1slXw,2370
91
91
  caselawclient/xslt/sample.xsl,sha256=IG-v77stjwqiw25pguh391K-5DTKiX651WqILDZixm0,825
92
- ds_caselaw_marklogic_api_client-41.0.0.dist-info/LICENSE.md,sha256=fGMzyyLuQW-IAXUeDSCrRdsYW536aEWThdbpCjo6ZKg,1108
93
- ds_caselaw_marklogic_api_client-41.0.0.dist-info/METADATA,sha256=56e2Zd_uMIyUmVZd1W82BSHXmjQFEICPkoKzvlHZQQ0,4364
94
- ds_caselaw_marklogic_api_client-41.0.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
95
- ds_caselaw_marklogic_api_client-41.0.0.dist-info/RECORD,,
92
+ ds_caselaw_marklogic_api_client-41.1.1.dist-info/LICENSE.md,sha256=fGMzyyLuQW-IAXUeDSCrRdsYW536aEWThdbpCjo6ZKg,1108
93
+ ds_caselaw_marklogic_api_client-41.1.1.dist-info/METADATA,sha256=LV90kguVTlJhsXibVySNO5OHYitAZssSDi8BbgcHx6s,4364
94
+ ds_caselaw_marklogic_api_client-41.1.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
95
+ ds_caselaw_marklogic_api_client-41.1.1.dist-info/RECORD,,