Detect annotations in engineering diagrams. Note: All users in a CDF project with assets read-all and files read access to the requested files can access data sent to this endpoint.
Supported input file mime_types are application/pdf, image/jpeg, image/png, image/tiff. Also note that the header of a successful response contains an X-Job-Token
which allows to fetch the result of the
job at /context/diagram/detect/{jobId}
without requiring 'assetsAcl:READ'.
Success
The response for a failed request.
from cognite.client.data_classes.contextualization import FileReference detect_job = client.diagrams.detect( entities=[ {"userDefinedField": "21PT1017","ignoredField": "AA11"}, {"userDefinedField": "21PT1018"}], search_field="userDefinedField", partial_match=True, min_tokens=2, file_ids=[101], file_external_ids=["Test1"], file_references=[ FileReference(id=20, first_page=1, last_page=10), FileReference(external_id="ext_20", first_page=11, last_page=20) ]) result = detect_job.result print(result) from cognite.client.data_classes.contextualization import ConnectionFlags, DiagramDetectConfig config = DiagramDetectConfig( remove_leading_zeros=True, connection_flags=ConnectionFlags( no_text_inbetween=True, natural_reading_order=True, ) ) job = client.diagrams.detect(entities=[{"name": "A1"}], file_id=123, config=config)
{- "items": [
- {
- "pageRange": {
- "begin": 51,
- "end": 100
}, - "fileId": 1234
}
], - "jobId": 123,
- "status": "Queued",
- "createdTime": 1730204346000,
- "startTime": 1730204346000,
- "statusTime": 1730204346000,
- "errorMessage": null,
- "searchField": "userDefinedField",
- "partialMatch": false,
- "minTokens": 2,
- "configuration": {
- "annotationExtract": true,
- "caseSensitive": true,
- "connectionFlags": [
- "string"
], - "customizeFuzziness": {
- "minChars": 0,
- "maxBoxes": 0,
- "fuzzyScore": 1
}, - "directionDelta": 180,
- "directionWeights": {
- "left": 1,
- "right": 1,
- "up": 1,
- "down": 1
}, - "minFuzzyScore": 0.85,
- "readEmbeddedText": true,
- "removeLeadingZeros": true,
- "substitutions": {
- "property1": [
- "string"
], - "property2": [
- "string"
]
}
}, - "patternMode": true
}