averbis / averbis-python-api

Conveniently access the REST API of Averbis products using Python
Apache License 2.0
12 stars 4 forks source link

Support for experimental text analysis API endpoints in major version 6 (deleting pipeline, text analysis export) #20

Closed DavidHuebner closed 3 years ago

DavidHuebner commented 3 years ago

Is your feature request related to a problem? Please describe. In major version 6, there are two new experimental endpoints for (a) deleting a pipeline and (b) for exporting the result of a text analysis (as a json).

Describe the solution you'd like These endpoints should be supported as experimental endpoints by the API. They should only be available if the client uses the platform version 6, and otherwise a OperationNotSupported() should be thrown.

Deleting Pipeline

client = Client(url)
pipeline = client.get_project("my_project").get_pipeline("my_pipeline")
pipeline.delete()

Exporting text analysis

client = Client(url)
pipeline = client.get_project("my_project")
export = project.export_text_analysis(
    document_sources="my_document_sources", process="my_process"
)

The export (json) looks like this

{ 
  "projectName": "my_project",
  "documentSourceName": "my_document_sources",
  "textAnalysisResultSetName": "my_process",
  "pipelineName": "discharge",
  "textAnalysisResultDtos": [
    {
        "documentName": "abcdef.txt",
        "annotationDtos": [
            {
                "begin": 0,
                "end": 12,
                "type": "uima.tcas.DocumentAnnotation",
                "coveredText": "Hello World",
                "id": 66753,
            }
        ]
        # truncated #
    }
    # truncated #
  ],
}

I will prepare a pull request.

DavidHuebner commented 3 years ago

Ready to be reviewed.

DavidHuebner commented 3 years ago

Closed with Pull-Request https://github.com/averbis/averbis-python-api/pull/22.