
    	]j6                        d Z ddlmZ ddlmZmZmZmZ ddlm	Z	m
Z
mZmZmZ  G d de	      Z G d de	      Z G d	 d
e      Z G d de	      Z G d de	      Z G d de	      Z G d de      Z G d de      Z G d de      Z G d de      Zddddddgdd g d!d"d#gd$Zdd%d&d'd(d)d*dgdd+g d,d-d.gd$Zd/d0dd1gd2d3d4d/d0ej5                         d5d6j7                  ej9                         j;                         D  cg c]  \  } }d7|  d8| d9 c}}       z   d3d0ej=                         d:d6j7                  ej?                         j;                         D  cg c]  \  } }d7|  d8| d9 c}}       z   d3d0d;d6j7                  ej?                         j;                         D  cg c]  \  } }d7|  d8| d9 c}}       z   d<d/d0d=d=d>d?d@d@d>dAdBdCdBdDdEdFdFd>d/dGdHd>d/dIdJd>gdKdLdg dedM   dN   d   dOdPdQddRdNgdSdTZ d/dUgdVdWd/dEd+gdXd3d4dYd?idZdQd-dUgd[d\d/dEd gd]d3d4dYd?id^dQd"dUgd[gd_Z!d4d0ejE                         d`dadQZ#d/e e!e#d$dbdcZ$d/e e!e#d$ddedeZ%yfc c}} w c c}} w c c}} w )gzThis file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
    )Enum)AnyListOptionalUnion)	BaseModel
StrictBoolStrictFloat	StrictInt	StrictStrc                   :    e Zd ZU eeeef   ed<   eeeef   ed<   y)FilterInminmaxN)__name__
__module____qualname__r   r   r
   r   __annotations__     R/root/env/lib/python3.12/site-packages/label_studio/data_manager/prepare_params.pyr   r   	   s&    	y+y0	11	y+y0	11r   r   c                   \    e Zd ZU dZed    ed<   eed<   eed<   eed<   eee	e
eeef   ed<   y)FilterNchild_filterfilteroperatortypevalue)r   r   r   r   r   r   strr   r   r
   r	   r   r   listr   r   r   r   r      s8    '+L(8$+KM
IKY$NOOr   r   c                       e Zd ZdZdZy)ConjunctionEnumorandN)r   r   r   ORANDr   r   r   r"   r"      s    	B
Cr   r"   c                   (    e Zd ZU eed<   ee   ed<   y)FiltersconjunctionitemsN)r   r   r   r"   r   r   r   r   r   r   r(   r(      s      <r   r(   c                   @    e Zd ZU eed<   g Zee   ed<   g Zee   ed<   y)SelectedItemsallincludedexcludedN)	r   r   r   boolr   r.   r   intr/   r   r   r   r,   r,   !   s#    	IHd3iHd3ir   r,   c                       e Zd ZU eeee   f   ed<   g Zee   ed<   dZ	e
e   ed<   dZe
e   ed<   dZe
e   ed<   dZe
e   ed<   edee   fd	       Zedefd
       Zy)PrepareParamsprojectorderingNselectedItemsfiltersdatarequestreturnc                 h    t        | j                  t              r| j                  S | j                  gS )zDGet project IDs as a list, whether single or multiple were provided.)
isinstancer4   r    selfs    r   projectszPrepareParams.projects/   s(     dllD)<<~r   c                 j    t        | j                  t              xr t        | j                        dkD  S )z7Check if this PrepareParams includes multiple projects.   )r<   r4   r    lenr=   s    r   is_multi_projectzPrepareParams.is_multi_project6   s(     $,,-G#dll2Ca2GGr   )r   r   r   r   r1   r   r   r5   r   r6   r   r,   r7   r(   r8   dictr9   r   propertyr?   r0   rC   r   r   r   r3   r3   '   s    3S	>""Hd3i-1M8M*1!%GXg%D(4.!GXc]!$s)   H$ H Hr   r3   c                   2    e Zd Zd Zed        Zed        Zy)
CustomEnumc                      || _         || _        y N)_value_description)r>   r   rK   s      r   __init__zCustomEnum.__init__=   s    &r   c                 R    t        | D cg c]  }|j                   c}      S c c}w rI   )sortedr   clsitems     r   enumszCustomEnum.enumsA   s    c2dtzz2332s   $c                 n    t        | d       D ci c]  }|j                  |j                   c}S c c}w )Nc                     | j                   S rI   r   xs    r   <lambda>z)CustomEnum.descriptions.<locals>.<lambda>G   s    STSZSZ r   key)rN   r   rK   rO   s     r   descriptionszCustomEnum.descriptionsE   s-    9?IZ9[\

D,,,\\\s   2N)r   r   r   rL   classmethodrR   r[   r   r   r   rG   rG   <   s1    ' 4 4 ] ]r   rG   c                       e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZd Zed        Zed        Zed        Zy)Column)idNumberzTask ID)inner_idr`   z0Task Inner ID, it starts from 1 for all projects)ground_truthBooleanz Ground truth status of the tasks)annotations_resultsStringz Annotation results for the tasks)reviewedrc   z6Whether the tasks have been reviewed (Enterprise only))predictions_scorer`   zPrediction score for the task)predictions_model_versionsre   z&Model version used for the predictions)predictions_resultsre   z Prediction results for the tasks)file_uploadre   z-Name of the file uploaded to create the tasks)
created_atDatetimezTime the task was created at)
updated_atrl   zQTime the task was updated at (e.g. new annotation was created, review added, etc))
annotatorsr   zAnnotators that completed the task (Community). Can include assigned annotators (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer)total_predictionsr`   z(Total number of predictions for the task)cancelled_annotationsr`   z7Number of cancelled or skipped annotations for the task)total_annotationsr`   z%Total number of annotations on a task)completed_atrl   z$Time when a task was fully annotated)	agreementr`   zFAgreement for annotation results for a specific task (Enterprise only))	reviewersre   zReviewers that reviewed the task, or assigned reviewers (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer)reviews_rejectedr`   zENumber of annotations rejected for a task in review (Enterprise only))reviews_acceptedr`   zENumber of annotations accepted for a task in review (Enterprise only))commentsr`   zNumber of comments in a task)unresolved_comment_countr`   z'Number of unresolved comments in a taskc                 .    || _         || _        || _        y rI   )rJ   r   rK   )r>   r   
value_typerK   s       r   rL   zColumn.__init__|   s    	&r   c           	      j    t        | D cg c]  }dt        |j                        z    c}      S c c}w )Nfilter:tasks:rN   r   r   rO   s     r   enums_for_filterszColumn.enums_for_filters   s(    SITTZZ8IJJI   0c           	      j    t        | D cg c]  }dt        |j                        z    c}      S c c}w )Nztasks:r}   rO   s     r   enums_for_orderingzColumn.enums_for_ordering   s(    D3tzz?2DEEDr   c                     t        | d       D ci c]-  }d|j                  z   d|j                   d|j                  z   / c}S c c}w )Nc                     | j                   S rI   rU   rV   s    r   rX   z1Column.descriptions_for_filters.<locals>.<lambda>   s
    !'' r   rY   r|   (z) )rN   r   r   rK   rO   s     r   descriptions_for_filterszColumn.descriptions_for_filters   sR     s(9:
 djj(Adii[*;d>N>N*NN
 	
 
s   2AN)r   r   r   IDINNER_IDGROUND_TRUTHANNOTATIONS_RESULTSREVIEWEDPREDICTIONS_SCOREPREDICTIONS_MODEL_VERSIONSPREDICTIONS_RESULTSFILE_UPLOAD
CREATED_AT
UPDATED_AT
ANNOTATORSTOTAL_PREDICTIONSCANCELLED_ANNOTATIONSTOTAL_ANNOTATIONSCOMPLETED_AT	AGREEMENT	REVIEWERSREVIEWS_REJECTEDREVIEWS_ACCEPTEDCOMMENTSUNRESOLVED_COMMENT_COUNTrL   r\   r~   r   r   r   r   r   r^   r^   J   s    	"BWHPL]^HV!q]ZKIJJ
J b
 _ULoII

 DHn'
 K K F F 
 
r   r^   c                   D    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZy)Operator)equalzEqual to)	not_equalzNot equal to)greaterzGreater than)greater_or_equalzGreater than or equal to)lessz	Less than)less_or_equalzLess than or equal to)containsContains)not_containszDoes not contain)existsExists)
not_existszDoes not exist)starts_withzStarts with)	ends_withz	Ends with)inzZIs between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}`)not_inz^Is not between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}`N)r   r   r   EQUAL	NOT_EQUALGREATERGREATER_OR_EQUALLESSLESS_OR_EQUALCONTAINSNOT_CONTAINSEXISTS
NOT_EXISTSSTARTS_WITH	ENDS_WITH
IS_BETWEENNOT_BETWEENr   r   r   r   r      sK    E+I'GED<M%H5LF/J.K(IsJKr   r   c                   $    e Zd ZdZdZdZdZdZdZy)Type)r`   zFloat or Integer)rl   z=Datetime string in `strftime('%Y-%m-%dT%H:%M:%S.%fZ')` format)rc   rc   )re   re   )r   zList of items)Unknownz0Unknown is explicitly converted to string formatN)	r   r   r   r`   rl   rc   re   r   r   r   r   r   r   r      s     )FZH"GF"DKGr   r   r#   zfilter:tasks:idr   r`   {   )r   r   r   r   )r)   r*   T)|   }   ~   )r-   r/   ztasks:total_annotations)r7   r6   r5   zfilter:tasks:completed_atr   rl   z2021-01-01T00:00:00.000Zz2025-01-01T00:00:00.000Z)r   r   F)rA         )r-   r.   z-tasks:completed_atobjectstringr$   a  Logical conjunction for the filters. This conjunction (either "or" or "and") will be applied to all items in the filters list. It is not possible to combine "or" and "and" within one list of filters. All filters will be either combined with "or" or with "and", but not a mix of both.)r   enumrK   arrayaD  Filter identifier, it should start with `filter:tasks:` prefix, e.g. `filter:tasks:agreement`. For `task.data` fields it may look like `filter:tasks:data.field_name`. If you need more info about columns, check the [Get data manager columns](#tag/Data-Manager/operation/api_dm_columns_list) API endpoint. Possible values:<br>z<br>z<li>`z`<br> z</li>z%Filter operator. Possible values:<br>z.Type of the filter value. Possible values:<br>)r   rK   re   )r   titlerK   integerIntegernumberFloatfloat)r   r   formatrK   booleanrc   
DictionaryzBDictionary is used for some operator types, e.g. `in` and `not_in`r   zList of strings or integerszValue to filter by)r   oneOfrK   r7   r*   )r   
propertiesrequiredexamplezList of filter items)r   r*   rK   r)   aF  Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.<br>Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`)r   r   r   rK   r-   a  Task selection by IDs. If filters are applied, the selection will be applied to the filtered tasks.If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br>Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`z
all: falsezNo tasks are selectedr   zList of included task IDs)r   r   r   r   z	all: truezAll tasks are selectedzList of excluded task IDs)r   r   rK   r   )r   r   zList of fields to order by. Fields are similar to filters but without the `filter:` prefix. To reverse the order, add a minus sign before the field name, e.g. `-tasks:created_at`.z*Additional query to filter and order tasks)r   r   rK   zGData payload containing task filters, selected task items, and ordering)r   r   rK   r   N)&__doc__r   r   typingr   r   r   r   pydanticr   r	   r
   r   r   r   r   r"   r(   r,   r3   rG   r^   r   r   example_request_1example_request_2r~   joinr   r*   rR   r[   filters_schemaselected_items_schemar   ordering_schemadata_schemaprepare_params_schema)rZ   descs   00r   <module>r      s    - - M M2y 2
PY Pd 
i 
I HI H*] ]D
T D
Nz (L: L .Ixbefg "?*+   6 "!;D^_	

 #	:&' $  5M8		
   !) & 8 8 :3 %kk 6<5T5T5V5\5\5^!"(1T ',C5tfE$B!"	& !) ( 0C$kkQYQfQfQhQnQnQp qIC5VD6!? q		! !)'W ++W[WhWhWjWpWpWr&s)#tse6$u'E&st(u !)%-QYZ%.S\]%-7cjk%.S\](0)5/s )1)//L"  (<%E6n D,Y7@Cu;x 2}?
KX (	FaVr _
 " )E7Kbc#$i0#> 	
 ! )D6Jbc#$i0#> 	
" L ))+^ ,?Tbqr? ,?Tbqr\ 	 c!" !r 'ts   I* I0,I6