Skip to content

Commit

Permalink
Merge pull request #162 from kili-technology/feature/add-logs-and-com…
Browse files Browse the repository at this point in the history
…ment-out-consensus-and-honeypot

Added filetring on project updated_at
  • Loading branch information
marcenacp committed Jun 14, 2020
2 parents b86ff2a + 79288d6 commit 546c2af
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kili/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# -*- coding: utf-8 -*-


__version__ = "2.0.4"
__version__ = "2.0.5"

from kili import mutations, queries, subscriptions
26 changes: 21 additions & 5 deletions kili/queries/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def __init__(self, auth):
'roles.numberOfAnnotations', 'roles.numberOfLabels', 'roles.role', 'roles.starred',
'roles.totalDuration', 'roles.user.email', 'titleAndDescription', 'useHoneyPot']
""")
def projects(self, project_id: str = None, search_query: str = None, skip: int = 0, fields: list = ['consensusMark', 'consensusTotCoverage', 'createdAt', 'description', 'honeypotMark', 'id', 'inputType', 'interfaceCategory', 'jsonInterface', 'maxWorkerCount', 'minAgreement', 'minConsensusSize', 'numberOfAssets', 'numberOfAssetsWithSkippedLabels', 'numberOfRemainingAssets', 'numberOfReviewedAssets', 'numberOfRoles',
'roles.activated', 'roles.consensusMark', 'roles.honeypotMark', 'roles.id', 'roles.lastLabelingAt', 'roles.numberOfAnnotations', 'roles.numberOfLabeledAssets', 'roles.numberOfLabels', 'roles.role', 'roles.starred', 'roles.totalDuration', 'roles.user.email', 'roles.user.id', 'roles.user.name', 'title', 'titleAndDescription', 'updatedAt', 'useHoneyPot'], first: int = 100):
def projects(self, project_id: str = None, search_query: str = None, updated_at_gte: str = None, updated_at_lte: str = None, skip: int = 0, fields: list = ['consensusMark', 'consensusTotCoverage', 'createdAt', 'description', 'honeypotMark', 'id', 'inputType', 'interfaceCategory', 'jsonInterface', 'maxWorkerCount', 'minAgreement', 'minConsensusSize', 'numberOfAssets', 'numberOfAssetsWithSkippedLabels', 'numberOfRemainingAssets', 'numberOfReviewedAssets', 'numberOfRoles',
'roles.activated', 'roles.consensusMark', 'roles.honeypotMark', 'roles.id', 'roles.lastLabelingAt', 'roles.numberOfAnnotations', 'roles.numberOfLabeledAssets', 'roles.numberOfLabels', 'roles.role', 'roles.starred', 'roles.totalDuration', 'roles.user.email', 'roles.user.id', 'roles.user.name', 'title', 'titleAndDescription', 'updatedAt', 'useHoneyPot'], first: int = 100):
"""
Get projects with a search_query
Expand All @@ -45,6 +45,12 @@ def projects(self, project_id: str = None, search_query: str = None, skip: int =
Select a specific project through its project_id
- search_query : str, optional (default = None)
Returned projects have a title or a description that matches this string.
- updated_at_gte : string, optional (default = None)
Returned projects should have a label whose update date is greated or equal to this date.
Formatted string should have format : "YYYY-MM-DD"
- updated_at_lte : string, optional (default = None)
Returned projects should have a label whose update date is lower or equal to this date.
Formatted string should have format : "YYYY-MM-DD"
- skip : int, optional (default = 0)
Number of projects to skip (they are ordered by their creation)
- fields : list of string, optional (default = ['consensusTotCoverage', 'id', 'inputType', 'interfaceCategory', 'jsonInterface', 'maxWorkerCount', 'minAgreement', 'minConsensusSize', 'roles.id', 'roles.role', 'roles.user.email', 'roles.user.id', 'roles.user.name', 'title'])
Expand All @@ -61,15 +67,17 @@ def projects(self, project_id: str = None, search_query: str = None, skip: int =
variables = {
'where': {
'id': project_id,
'searchQuery': search_query
'searchQuery': search_query,
'updatedAtGte': updated_at_gte,
'updatedAtLte': updated_at_lte,
},
'skip': skip,
'first': first
}
result = self.auth.client.execute(GQL_PROJECTS, variables)
return format_result('data', result)

def count_projects(self, project_id: str = None, search_query: str = None):
def count_projects(self, project_id: str = None, search_query: str = None, updated_at_gte: str = None, updated_at_lte: str = None):
"""
Counts the number of projects with a search_query
Expand All @@ -79,6 +87,12 @@ def count_projects(self, project_id: str = None, search_query: str = None):
Select a specific project through its project_id
- search_query : str, optional (default = None)
Returned projects have a title or a description that matches this string.
- updated_at_gte : string, optional (default = None)
Returned projects should have a label whose update date is greated or equal to this date.
Formatted string should have format : "YYYY-MM-DD"
- updated_at_lte : string, optional (default = None)
Returned projects should have a label whose update date is lower or equal to this date.
Formatted string should have format : "YYYY-MM-DD"
Returns
-------
Expand All @@ -87,7 +101,9 @@ def count_projects(self, project_id: str = None, search_query: str = None):
variables = {
'where': {
'id': project_id,
'searchQuery': search_query
'searchQuery': search_query,
'updatedAtGte': updated_at_gte,
'updatedAtLte': updated_at_lte,
}
}
result = self.auth.client.execute(GQL_PROJECTS_COUNT, variables)
Expand Down

0 comments on commit 546c2af

Please sign in to comment.