-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update submission filter * update submission query * update list submissions * add tests * resolve tests * add docstrings * add test case for input_filename * address comments * fix docstring edit location * add codeowners file * Address comments * fix typing in filter init --------- Co-authored-by: Nathanael Shim <[email protected]>
- Loading branch information
1 parent
dc5e982
commit 1547bd6
Showing
9 changed files
with
331 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @IndicoDataSolutions/pr-be-indicodata-ai |
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,52 @@ | ||
from indico import IndicoClient, IndicoConfig | ||
from indico.filters import DateRangeFilter, SubmissionFilter, and_, or_ | ||
from indico.queries import ListSubmissions | ||
|
||
# Create an Indico API client | ||
my_config = IndicoConfig( | ||
host="try.indico.io", api_token_path="./path/to/indico_api_token.txt" | ||
) | ||
client = IndicoClient(config=my_config) | ||
|
||
workflow_id = 5 | ||
|
||
""" | ||
Example 1 | ||
List all submissions that are COMPLETE or FAILED | ||
""" | ||
sub_filter = or_(SubmissionFilter(status="COMPLETE"), SubmissionFilter(status="FAILED")) | ||
submissions = client.call(ListSubmissions(filters=sub_filter)) | ||
|
||
""" | ||
Example 2 | ||
List all submissions that are COMPLETE and FAILED | ||
""" | ||
sub_filter = and_( | ||
SubmissionFilter(status="COMPLETE"), SubmissionFilter(status="FAILED") | ||
) | ||
submisions = client.call(ListSubmissions(filters=sub_filter)) | ||
|
||
""" | ||
Example 3 | ||
List all submissions that are retrieved and have a filename that contains 'property' | ||
""" | ||
sub_filter = SubmissionFilter(retrieved=True, input_filename="property") | ||
submissions = client.call(ListSubmissions(filters=sub_filter)) | ||
|
||
""" | ||
Example 4 | ||
List all submissions that are created and updated within a certain date range | ||
""" | ||
date_filter = DateRangeFilter(filter_from="2022-01-01", filter_to="2023-01-01") | ||
sub_filter = SubmissionFilter(created_at=date_filter, updated_at=date_filter) | ||
submissions = client.call(ListSubmissions(filters=sub_filter)) | ||
|
||
""" | ||
Example 5 | ||
List all submissions that are not in progress of being reviewed and are completed | ||
""" | ||
submissions = client.call( | ||
ListSubmissions( | ||
filters=SubmissionFilter(status="COMPLETE", review_in_progress=False) | ||
) | ||
) |
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
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
Oops, something went wrong.