-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #531 from nationalarchives/feature/awaiting-repars…
…e-report Add API calls to get document parse information
- Loading branch information
Showing
7 changed files
with
102 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
xquery version "1.0-ml"; | ||
|
||
xdmp:to-json(xdmp:sql( | ||
"SELECT enrich_version_string, enrich_major_version | ||
"SELECT enrich_version_string, enrich_major_version, enrich_minor_version | ||
FROM documents.process_data | ||
ORDER BY enrich_major_version DESC | ||
ORDER BY enrich_major_version DESC, enrich_minor_version DESC | ||
LIMIT 1", | ||
"array" | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
xquery version "1.0-ml"; | ||
|
||
xdmp:to-json(xdmp:sql( | ||
"SELECT parser_version_string, parser_major_version, parser_minor_version | ||
FROM documents.process_data | ||
ORDER BY parser_major_version DESC, parser_minor_version DESC | ||
LIMIT 1", | ||
"array" | ||
)) |
20 changes: 15 additions & 5 deletions
20
src/caselawclient/xquery/get_pending_enrichment_for_version.xqy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
xquery version "1.0-ml"; | ||
|
||
declare variable $target_version as xs:int external; | ||
declare variable $target_major_version as xs:int external; | ||
declare variable $target_minor_version as xs:int external; | ||
|
||
xdmp:to-json(xdmp:sql( | ||
"SELECT process_data.uri, enrich_version_string, minutes_since_enrichment_request | ||
FROM ( | ||
SELECT process_data.uri, enrich_version_string, enrich_major_version, DATEDIFF('minute', last_sent_to_enrichment, CURRENT_TIMESTAMP) AS minutes_since_enrichment_request | ||
SELECT | ||
process_data.uri, | ||
enrich_version_string, enrich_major_version, enrich_minor_version, | ||
DATEDIFF('minute', last_sent_to_enrichment, CURRENT_TIMESTAMP) AS minutes_since_enrichment_request | ||
FROM documents.process_data | ||
JOIN documents.process_property_data ON process_data.uri = process_property_data.uri | ||
) | ||
WHERE ((enrich_version_string IS NULL) OR (enrich_major_version < @target_version)) | ||
WHERE ( | ||
(enrich_version_string IS NULL) OR | ||
(enrich_major_version <= @target_major_version AND enrich_minor_version < @target_minor_version) | ||
) | ||
AND (minutes_since_enrichment_request > 43200 OR minutes_since_enrichment_request IS NULL) | ||
ORDER BY enrich_major_version ASC NULLS FIRST", | ||
ORDER BY enrich_major_version ASC NULLS FIRST, enrich_minor_version ASC", | ||
"array", | ||
map:new(map:entry("target_version", $target_version)) | ||
map:new(( | ||
map:entry("target_major_version", $target_major_version), | ||
map:entry("target_minor_version", $target_minor_version) | ||
)) | ||
)) | ||
|
28 changes: 28 additions & 0 deletions
28
src/caselawclient/xquery/get_pending_parse_for_version.xqy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
xquery version "1.0-ml"; | ||
|
||
declare variable $target_major_version as xs:int external; | ||
declare variable $target_minor_version as xs:int external; | ||
|
||
xdmp:to-json(xdmp:sql( | ||
"SELECT process_data.uri, parser_version_string, minutes_since_parse_request | ||
FROM ( | ||
SELECT | ||
process_data.uri, | ||
parser_version_string, parser_major_version, parser_minor_version, | ||
DATEDIFF('minute', last_sent_to_parser, CURRENT_TIMESTAMP) AS minutes_since_parse_request | ||
FROM documents.process_data | ||
JOIN documents.process_property_data ON process_data.uri = process_property_data.uri | ||
) | ||
WHERE ( | ||
(parser_version_string IS NULL) OR | ||
(parser_major_version <= @target_major_version AND parser_minor_version < @target_minor_version) | ||
) | ||
AND (minutes_since_parse_request > 43200 OR minutes_since_parse_request IS NULL) | ||
ORDER BY parser_major_version ASC NULLS FIRST, parser_minor_version ASC", | ||
"array", | ||
map:new(( | ||
map:entry("target_major_version", $target_major_version), | ||
map:entry("target_minor_version", $target_minor_version) | ||
)) | ||
)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters