In this release `0.3.0`, we again extend our support to cover new API endpoints and increased the compatiblity to the new platform version 6.
**DocumentCollection**
A DocumentCollection can be used to import documents into our platform. The new API endpoints allow to list all document collections, create one, delete one, get the number of document in a collection and to insert documents (plain/text or solr/xml).
python
client = Client(url)
project = client.get_project("my_project")
collection = project.create_document_collection("my_collection")
file_path = "resources/texts/text1.txt"
with open(file_path, "r", encoding="UTF-8") as input_io:
collection.import_documents(input_io)
print(f"Number of documents: {collection.get_number_of_documents()}")
collection.delete()
**Deleting Pipeline**
We introduce a new *experimental* (may change soon) endpoint to delete an existing pipeline.
python
client = Client(url)
pipeline = client.get_project("my_project").get_pipeline("my_pipeline")
pipeline.delete()
**Exporting text analysis**
We introduce a new *experimental* (may change soon) endpoint to extract the result of a text analysis.
python
client = Client(url)
project = client.get_project("my_project")
export = project.export_text_analysis(
document_sources="my_document_sources", process="my_process", annotation_types="*"
)
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
],
}
**Others**
We now support the new schemaVersion 2.0 of the configuration json that are used in platform version 6.
We also provide a more convenient way to generate a new API Token directly in the Client constructor by calling:
python
client = Client('http://localhost:8400/health-discovery', username='YOUR_USERNAME', password='YOUR_PASSWORD')
Please note that this *invalidates* your old API Token!
Please do not hesitate to contact us if you have any questions regarding the new release.