v1

latestOpenAPI 3.0.22026-07-17373198641.7 KB
document
v1

Create Document Field Params: - document_type: uid of Document Type - code: str - Unique Short name for field, max 50 symbols, should contain only latin letters, digits, and underscores - long_code: str - Unique Calculated field, max 150 symbols - title: str - Verbose name for field, max 100 symbols - description: str - optional - type: str - max 30 symbols (from pre-defined choices) - text_unit_type: str - (from pre-defined choices) default = sentences - value_detection_strategy: str - max 50 chars (from pre-defined choices) - unsure_choice_value: str - max 256 chars, default=null - unsure_thresholds_by_value: json - classifier_init_script: str - formula: str - convert_decimals_to_floats_in_formula_args: bool - depends_on_fields: array of uids, optional - confidence: str - max 100 chars (from pre-defined choices) - requires_text_annotations: bool, default=True - read_only: bool, default=False - category: int - id of DocumentFieldCategory instance - default_value: json - choices: str - \n-separated list of choices - allow_values_not_specified_in_choices: bool - default=False - metadata: json, optional - training_finished: bool, default=False - dirty: bool, default=False - order: integer - default=0 - trained_after_documents_number: integer, default=null - hidden_always: bool - default=False - hide_until_python: str, optional - hide_until_js: str, optional - display_yes_no: bool - default=False

post/api/v1/document/document-fields/

Request body

document_typestring required
codestring required

Field codes must be lowercase, should start with a Latin letter, and contain only Latin letters, digits, underscores. Field codes must be unique to every Document Type.

long_codestring
titlestring required
descriptionstring nullable
type'address' | 'choice' | 'company' | 'date' | 'date_recurring' | 'datetime' | 'duration' | 'float' | 'geography' | 'int' | 'linked_documents' | 'money' | 'multi_choice' | 'percent' | 'person' | 'ratio' | 'related_info' | 'string' | 'string_no_word_wrap' | 'text' required
text_unit_type'sentence' | 'paragraph' | 'section'
value_detection_strategy'disabled' | 'use_regexps_only' | 'use_formula_only' | 'regexp_table' | 'text_based_ml_only' | 'mlflow_model'
classifier_init_scriptstring nullable

Classifier initialization script. Here is how it used: <br /><br />def init_classifier_impl(field_code: str, init_script: str):<br />    if init_script is not None:<br />        init_script = init_script.strip()<br /><br />    if not init_script:<br />        from sklearn import tree as sklearn_tree<br />        return sklearn_tree.DecisionTreeClassifier()<br /><br />    from sklearn import tree as sklearn_tree<br />    from sklearn import neural_network as sklearn_neural_network<br />    from sklearn import neighbors as sklearn_neighbors<br />    from sklearn import svm as sklearn_svm<br />    from sklearn import gaussian_process as sklearn_gaussian_process<br />    from sklearn.gaussian_process import kernels as sklearn_gaussian_process_kernels<br />    from sklearn import ensemble as sklearn_ensemble<br />    from sklearn import naive_bayes as sklearn_naive_bayes<br />    from sklearn import discriminant_analysis as sklearn_discriminant_analysis<br />    from sklearn import linear_model as sklearn_linear_model<br /><br />    eval_locals = {<br />        'sklearn_linear_model': sklearn_linear_model,<br />        'sklearn_tree': sklearn_tree,<br />        'sklearn_neural_network': sklearn_neural_network,<br />        'sklearn_neighbors': sklearn_neighbors,<br />        'sklearn_svm': sklearn_svm,<br />        'sklearn_gaussian_process': sklearn_gaussian_process,<br />        'sklearn_gaussian_process_kernels': sklearn_gaussian_process_kernels,<br />        'sklearn_ensemble': sklearn_ensemble,<br />        'sklearn_naive_bayes': sklearn_naive_bayes,<br />        'sklearn_discriminant_analysis': sklearn_discriminant_analysis<br />    }<br />    return eval_script('classifier init script of field {0}'.format(field_code), init_script, eval_locals)<br />

formulastring nullable
convert_decimals_to_floats_in_formula_argsboolean

Floating point field values are represented in Python Decimal type to avoid rounding problems in machine numbers representations. Use this checkbox for converting them to Python float type before calculating the formula. Float: 0.1 + 0.2 = 0.30000000000000004. Decimal: 0.1 + 0.2 = 0.3.

value_regexpstring nullable

This regular expression is run on the sentence found by a Field Detector and extracts a specific string value from a Text Unit. If the regular expression returns multiple matching groups, then the first matching group will be used by the Field. This is only applicable to String Fields.

depends_on_fieldsstring[]
confidence'High' | 'Medium' | 'Low' nullable
requires_text_annotationsboolean
read_onlyboolean
categoryinteger nullable
familyinteger nullable
default_valueobject nullable

If populated, the Default Value will be displayed for this Field if no other value is found by the chosen Value Detection Strategy. Leave this form blank to have the Field Value remain empty by default. Please wrap entries with quotes, example: “landlord”. This is only applicable to Choice and Multi Choice Fields.

choicesstring nullable

Newline-separated choices. A choice cannot contain a comma.

allow_values_not_specified_in_choicesboolean
metadataobject nullable
training_finishedboolean
dirtyboolean
orderinteger
trained_after_documents_numberinteger
hidden_alwaysboolean
hide_until_pythonstring nullable
        Enter a boolean expression in Python syntax. If this Python expression evaluates to True, then this 
        Document Field will be displayed in the user interface. Likewise, if this Python expression evaluates to 
        False, then this Document Field will be hidden from view. Importantly, if a document’s status is set to 
        complete and this Document Field remains hidden, then this Document Field’s data will be erased. Similarly, 
        this Document Field might contain data that a user can not review if it is hidden and the document has not 
        been set to complete.
hide_until_jsstring nullable

Target expression ("Hide until python" expression converted to JavaScript syntax for frontend). Allowed operators: +, -, *, /, ===, !==, ==, !=, &&, ||, >, <, >=, <=, %

display_yes_noboolean

Checking this box will display “Yes” if Related Info text is found, and display “No” if no text is found.

vectorizer_stop_wordsstring nullable

Stop words for vectorizers user in field-based ML field detection. These stop words are excluded from going into the feature vector part build based on this field. In addition to these words the standard sklearn "english" word list is used. Format: each word on new line

unsure_choice_valuestring nullable

Makes sense for machine learning strategies with "Unsure" category. The strategy will return this value if probabilities of all other categories appear lower than the specified threshold.

unsure_thresholds_by_valueobject nullable

Makes sense for machine learning strategies with "Unsure" category. The strategy will return concrete result (one of choice values) only if the probability of the detected value is greater than this threshold. Otherwise the strategy returns None or the choice value specified in "Unsure choice value" field. Format: { "value1": 0.9, "value2": 0.5, ...}. Default: 0.9

mlflow_model_uristring nullable

MLFlow model URI understandable by the MLFlow artifact downloading routines.

mlflow_detect_on_document_levelboolean

If true - whole document text will be sent to the MLFlow model and the field value will be returned for the whole text with no annotations. If false - each text unit will be sent separately.

warning_messagestring

Example request

{
  "classifier_init_script": "classifier_init_script",
  "vectorizer_stop_words": "vectorizer_stop_words",
  "metadata": "{}",
  "code": "code",
  "allow_values_not_specified_in_choices": true,
  "description": "description",
  "long_code": "long_code",
  "title": "title",
  "type": "address",
  "value_regexp": "value_regexp",
  "trained_after_documents_number": 1280358509,
  "unsure_choice_value": "unsure_choice_value",
  "read_only": true,
  "depends_on_fields": [
    "depends_on_fields",
    "depends_on_fields"
  ],
  "requires_text_annotations": true,
  "hide_until_python": "hide_until_python",
  "document_type": "document_type",
  "order": 4803,
  "convert_decimals_to_floats_in_formula_args": true,
  "dirty": true,
  "confidence": "High",
  "hide_until_js": "hide_until_js",
  "default_value": "{}",
  "unsure_thresholds_by_value": "{}",
  "warning_message": "warning_message",
  "text_unit_type": "sentence",
  "mlflow_model_uri": "mlflow_model_uri",
  "display_yes_no": true,
  "training_finished": true,
  "mlflow_detect_on_document_level": true,
  "formula": "formula",
  "value_detection_strategy": "disabled",
  "hidden_always": true,
  "category": 0,
  "family": 6,
  "choices": "choices"
}

Response

document_typestring required
codestring required

Field codes must be lowercase, should start with a Latin letter, and contain only Latin letters, digits, underscores. Field codes must be unique to every Document Type.

long_codestring
titlestring required
descriptionstring nullable
type'address' | 'choice' | 'company' | 'date' | 'date_recurring' | 'datetime' | 'duration' | 'float' | 'geography' | 'int' | 'linked_documents' | 'money' | 'multi_choice' | 'percent' | 'person' | 'ratio' | 'related_info' | 'string' | 'string_no_word_wrap' | 'text' required
text_unit_type'sentence' | 'paragraph' | 'section'
value_detection_strategy'disabled' | 'use_regexps_only' | 'use_formula_only' | 'regexp_table' | 'text_based_ml_only' | 'mlflow_model'
classifier_init_scriptstring nullable

Classifier initialization script. Here is how it used: <br /><br />def init_classifier_impl(field_code: str, init_script: str):<br />    if init_script is not None:<br />        init_script = init_script.strip()<br /><br />    if not init_script:<br />        from sklearn import tree as sklearn_tree<br />        return sklearn_tree.DecisionTreeClassifier()<br /><br />    from sklearn import tree as sklearn_tree<br />    from sklearn import neural_network as sklearn_neural_network<br />    from sklearn import neighbors as sklearn_neighbors<br />    from sklearn import svm as sklearn_svm<br />    from sklearn import gaussian_process as sklearn_gaussian_process<br />    from sklearn.gaussian_process import kernels as sklearn_gaussian_process_kernels<br />    from sklearn import ensemble as sklearn_ensemble<br />    from sklearn import naive_bayes as sklearn_naive_bayes<br />    from sklearn import discriminant_analysis as sklearn_discriminant_analysis<br />    from sklearn import linear_model as sklearn_linear_model<br /><br />    eval_locals = {<br />        'sklearn_linear_model': sklearn_linear_model,<br />        'sklearn_tree': sklearn_tree,<br />        'sklearn_neural_network': sklearn_neural_network,<br />        'sklearn_neighbors': sklearn_neighbors,<br />        'sklearn_svm': sklearn_svm,<br />        'sklearn_gaussian_process': sklearn_gaussian_process,<br />        'sklearn_gaussian_process_kernels': sklearn_gaussian_process_kernels,<br />        'sklearn_ensemble': sklearn_ensemble,<br />        'sklearn_naive_bayes': sklearn_naive_bayes,<br />        'sklearn_discriminant_analysis': sklearn_discriminant_analysis<br />    }<br />    return eval_script('classifier init script of field {0}'.format(field_code), init_script, eval_locals)<br />

formulastring nullable
convert_decimals_to_floats_in_formula_argsboolean

Floating point field values are represented in Python Decimal type to avoid rounding problems in machine numbers representations. Use this checkbox for converting them to Python float type before calculating the formula. Float: 0.1 + 0.2 = 0.30000000000000004. Decimal: 0.1 + 0.2 = 0.3.

value_regexpstring nullable

This regular expression is run on the sentence found by a Field Detector and extracts a specific string value from a Text Unit. If the regular expression returns multiple matching groups, then the first matching group will be used by the Field. This is only applicable to String Fields.

depends_on_fieldsstring[]
confidence'High' | 'Medium' | 'Low' nullable
requires_text_annotationsboolean
read_onlyboolean
categoryinteger nullable
familyinteger nullable
default_valueobject nullable

If populated, the Default Value will be displayed for this Field if no other value is found by the chosen Value Detection Strategy. Leave this form blank to have the Field Value remain empty by default. Please wrap entries with quotes, example: “landlord”. This is only applicable to Choice and Multi Choice Fields.

choicesstring nullable

Newline-separated choices. A choice cannot contain a comma.

allow_values_not_specified_in_choicesboolean
metadataobject nullable
training_finishedboolean
dirtyboolean
orderinteger
trained_after_documents_numberinteger
hidden_alwaysboolean
hide_until_pythonstring nullable
        Enter a boolean expression in Python syntax. If this Python expression evaluates to True, then this 
        Document Field will be displayed in the user interface. Likewise, if this Python expression evaluates to 
        False, then this Document Field will be hidden from view. Importantly, if a document’s status is set to 
        complete and this Document Field remains hidden, then this Document Field’s data will be erased. Similarly, 
        this Document Field might contain data that a user can not review if it is hidden and the document has not 
        been set to complete.
hide_until_jsstring nullable

Target expression ("Hide until python" expression converted to JavaScript syntax for frontend). Allowed operators: +, -, *, /, ===, !==, ==, !=, &&, ||, >, <, >=, <=, %

display_yes_noboolean

Checking this box will display “Yes” if Related Info text is found, and display “No” if no text is found.

vectorizer_stop_wordsstring nullable

Stop words for vectorizers user in field-based ML field detection. These stop words are excluded from going into the feature vector part build based on this field. In addition to these words the standard sklearn "english" word list is used. Format: each word on new line

unsure_choice_valuestring nullable

Makes sense for machine learning strategies with "Unsure" category. The strategy will return this value if probabilities of all other categories appear lower than the specified threshold.

unsure_thresholds_by_valueobject nullable

Makes sense for machine learning strategies with "Unsure" category. The strategy will return concrete result (one of choice values) only if the probability of the detected value is greater than this threshold. Otherwise the strategy returns None or the choice value specified in "Unsure choice value" field. Format: { "value1": 0.9, "value2": 0.5, ...}. Default: 0.9

mlflow_model_uristring nullable

MLFlow model URI understandable by the MLFlow artifact downloading routines.

mlflow_detect_on_document_levelboolean

If true - whole document text will be sent to the MLFlow model and the field value will be returned for the whole text with no annotations. If false - each text unit will be sent separately.

warning_messagestring

Example response

{
  "classifier_init_script": "classifier_init_script",
  "vectorizer_stop_words": "vectorizer_stop_words",
  "metadata": "{}",
  "code": "code",
  "allow_values_not_specified_in_choices": true,
  "description": "description",
  "long_code": "long_code",
  "title": "title",
  "type": "address",
  "value_regexp": "value_regexp",
  "trained_after_documents_number": 1280358509,
  "unsure_choice_value": "unsure_choice_value",
  "read_only": true,
  "depends_on_fields": [
    "depends_on_fields",
    "depends_on_fields"
  ],
  "requires_text_annotations": true,
  "hide_until_python": "hide_until_python",
  "document_type": "document_type",
  "order": 4803,
  "convert_decimals_to_floats_in_formula_args": true,
  "dirty": true,
  "confidence": "High",
  "hide_until_js": "hide_until_js",
  "default_value": "{}",
  "unsure_thresholds_by_value": "{}",
  "warning_message": "warning_message",
  "text_unit_type": "sentence",
  "mlflow_model_uri": "mlflow_model_uri",
  "display_yes_no": true,
  "training_finished": true,
  "mlflow_detect_on_document_level": true,
  "formula": "formula",
  "value_detection_strategy": "disabled",
  "hidden_always": true,
  "category": 0,
  "family": 6,
  "choices": "choices"
}