mirror of
https://github.com/JHUAPL/PINE.git
synced 2026-01-09 14:38:06 -05:00
Updates from internal development branch.
This includes two main features: 1. Add/fix status/train/predict endpoints for pipelines. 2. Add OpenAPI specification for backend API.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,6 +11,7 @@
|
||||
|
||||
# Python
|
||||
**/__pycache__
|
||||
**/.pytest_cache
|
||||
|
||||
# Logs
|
||||
backend/pine/backend/logs
|
||||
|
||||
14
README.md
14
README.md
@@ -150,6 +150,20 @@ Once the dev stack is up and running, the following ports are accessible:
|
||||
2. `./generate_documentation.sh`
|
||||
3. Generated documentation can then be found in `./docs/build`.
|
||||
|
||||
### Backend OpenAPI Specification
|
||||
|
||||
The backend API is documented using an [OpenAPI specification](https://swagger.io/specification/).
|
||||
This specification covers the main REST API used by PINE. A copy of the
|
||||
[Swagger UI](https://swagger.io/tools/swagger-ui/) is hosted at `http[s]://<backendURL>/api/ui` and
|
||||
the specification itself is hosted at `http[s]://<backendURL>/api/openapi.yaml`.
|
||||
|
||||
This specification is found in the source code at `backend/pine/backend/api/openapi.yaml`.
|
||||
*NOTE* however that this file is autogenerated by the `./update_openapi.sh` script. The "base"
|
||||
file is located at `backend/pine/backend/api/base.yaml` which then pulls in information from other
|
||||
files. ALL changes to the backend API should result in updates to the specification, as it is *NOT*
|
||||
automatically updated or generated based on code changes. The `./update_openapi.sh` script requires
|
||||
Docker to run and standard Linux tools (find, grep, awk, sort) but no other dependencies.
|
||||
|
||||
### Testing Data
|
||||
|
||||
To import testing data, run the dev stack and then run:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
from flask import Blueprint, jsonify, request, Response
|
||||
from flask import Blueprint, jsonify, request
|
||||
import requests
|
||||
from werkzeug import exceptions
|
||||
|
||||
@@ -29,7 +29,7 @@ def get_user(user_id):
|
||||
"""
|
||||
return jsonify(users.get_user(user_id))
|
||||
|
||||
@bp.route("/users/<user_id>/password", methods = ["POST", "PUT", "PATCH"])
|
||||
@bp.route("/users/<user_id>/password", methods = ["PUT"])
|
||||
@auth.admin_required
|
||||
def update_user_password(user_id):
|
||||
"""
|
||||
@@ -48,7 +48,7 @@ def update_user_password(user_id):
|
||||
resp = service.put("users/" + user_id, json = user, headers = {"If-Match": etag})
|
||||
return service.convert_response(resp)
|
||||
|
||||
@bp.route("/users/<user_id>", methods = ["PUT", "PATCH"])
|
||||
@bp.route("/users/<user_id>", methods = ["PUT"])
|
||||
@auth.admin_required
|
||||
def update_user(user_id):
|
||||
"""
|
||||
@@ -98,7 +98,13 @@ def add_user():
|
||||
|
||||
body["_id"] = body["id"]
|
||||
del body["id"]
|
||||
if body["description"] == None:
|
||||
|
||||
# check other fields as required by eve schema
|
||||
if not "firstname" in body or not body["firstname"] or "lastname" not in body or not body["lastname"]:
|
||||
raise exceptions.BadRequest(description = "Missing firstname or lastname in body JSON data.")
|
||||
if not "roles" in body or not body["roles"]:
|
||||
raise exceptions.BadRequest(description = "Missing/empty roles in body JSON data.")
|
||||
if "description" in body and body["description"] == None:
|
||||
del body["description"]
|
||||
|
||||
# post to data server
|
||||
|
||||
361
backend/pine/backend/admin/openapi.yaml
Normal file
361
backend/pine/backend/admin/openapi.yaml
Normal file
@@ -0,0 +1,361 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
security:
|
||||
- cookieAuth: []
|
||||
|
||||
tags:
|
||||
- name: admin
|
||||
description: >
|
||||
Operations in the "admin" blueprint. These operations are generally only available when the
|
||||
"eve" auth module is running and are only accessible to logged-in users that are
|
||||
administrators.
|
||||
|
||||
components:
|
||||
|
||||
schemas:
|
||||
|
||||
UserRoles:
|
||||
description: The role (for permissions) of the user.
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum: [administrator, user]
|
||||
|
||||
NewUserData:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
passwd:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
firstname:
|
||||
type: string
|
||||
lastname:
|
||||
type: string
|
||||
role:
|
||||
$ref: "#/components/schemas/UserRoles"
|
||||
required:
|
||||
- id
|
||||
- email
|
||||
- passwd
|
||||
- firstname
|
||||
- lastname
|
||||
- roles
|
||||
|
||||
UpdateUserData:
|
||||
type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
_etag:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
firstname:
|
||||
type: string
|
||||
lastname:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
description: If this is not included, you wont be able to log in.
|
||||
passwdhash:
|
||||
type: string
|
||||
description: Setting this manually might break the password.
|
||||
role:
|
||||
$ref: "#/components/schemas/UserRoles"
|
||||
required:
|
||||
- _id
|
||||
- _etag
|
||||
- firstname
|
||||
- lastname
|
||||
- passwdhash
|
||||
- role
|
||||
|
||||
paths:
|
||||
|
||||
/admin/users:
|
||||
get:
|
||||
summary: Get All User Information
|
||||
description: |
|
||||
Get a list of all users (and details: id, email, password hash).
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/admin/users --cookie admin.cookie`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_get_users
|
||||
tags: [admin]
|
||||
responses:
|
||||
"200":
|
||||
description: Returned list of user details.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/UserInfo"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
post:
|
||||
summary: Create New User
|
||||
description: |
|
||||
Create a new user.
|
||||
|
||||
Example: `curl -X Post http://localhost:5000/admin/users -d '{"id":"joe", "passwd":"mypass", "email":"joe@pine.jhuapl.edu", "description": "", "firstname":"joe", "lastname":"jones"}' -H "Content-type:application/json" --cookie admin.cookie`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_add_user
|
||||
tags: [admin]
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/NewUserData"
|
||||
responses:
|
||||
"200":
|
||||
description: Return id info of newly created user.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
"409":
|
||||
description: User with that ID/email already exists.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/admin/users/{user_id}:
|
||||
get:
|
||||
summary: Get User Details
|
||||
description: |
|
||||
Get details (id, email, password hash...) of a certain user.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/admin/users/ada --cookie admin.cookie`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_get_user
|
||||
tags: [admin]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/userIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found the user and returned their details.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/UserInfo"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
"404":
|
||||
description: No user found with that ID.
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
put:
|
||||
summary: Update user details.
|
||||
description: |
|
||||
Update user details.
|
||||
|
||||
Example: `curl -X PUT http://localhost:5000/admin/users/ada -d '{"_id":"ada","description":"newdesc", "firstname":"newada", "lastname":"adalast", "_etag":"1c12354ee74f5d5732231ac5034f7915fb167244", "email":"ada@pine.jhuapl.edu"}' -H "Content-type:application/json" --cookie admin.cookie`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_update_user
|
||||
tags: [admin]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/userIdParam"
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/UpdateUserData"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully changed user information
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
"404":
|
||||
description: No user found with that ID.
|
||||
"412":
|
||||
$ref: "../api/components.yaml#/responses/MismatchedEtag"
|
||||
"422":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
delete:
|
||||
summary: Delete User
|
||||
description: |
|
||||
Delete a user.
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_delete_user
|
||||
tags: [admin]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/userIdParam"
|
||||
responses:
|
||||
"204":
|
||||
description: Successfully deleted user.
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
"404":
|
||||
description: No user found with that ID.
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/admin/users/{user_id}/password:
|
||||
put:
|
||||
summary: Update User Password
|
||||
description: |
|
||||
Update the password of a user.
|
||||
|
||||
Example: `curl -X post http://localhost:5000/admin/users/ada/password -d '{"passwd":"newpass"}' -H "Content-type:application/json" --cookie admin.cookie`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_update_user_password
|
||||
tags: [admin]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/userIdParam"
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
passwd:
|
||||
type: string
|
||||
required:
|
||||
- passwd
|
||||
responses:
|
||||
"200":
|
||||
description: "Successfully changed user password"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
"404":
|
||||
description: No user found with that ID.
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/admin/system/export:
|
||||
get:
|
||||
summary: Export Database
|
||||
description: |
|
||||
Export the database to a zip file.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/admin/system/export --cookie admin.cookie -v --output out.zip`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_system_export
|
||||
tags: [admin]
|
||||
responses:
|
||||
"200":
|
||||
description: "Successfully exported database"
|
||||
content:
|
||||
application/gzip: {}
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/admin/system/import:
|
||||
put:
|
||||
summary: Import Database (Update)
|
||||
description: |
|
||||
Import the database given in request body. This will _update_ and not _replace_ the
|
||||
database.
|
||||
|
||||
Example: `curl -X PUT http://localhost:5000/admin/system/import --cookie admin.cookie -F "file=@/home/pine/out.zip"`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_system_import_put
|
||||
tags: [admin]
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
format: binary
|
||||
required:
|
||||
- file
|
||||
responses:
|
||||
"200":
|
||||
$ref: "../api/components.yaml#/responses/Success"
|
||||
"400":
|
||||
description: The loading of data was wrong. Should be a gz, like what is exported.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
"422":
|
||||
description: The file argument was not present.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
post:
|
||||
summary: Import Database (Replace)
|
||||
description: |
|
||||
Import the database given in request body. This will _replace_ and not _update_ the
|
||||
database.
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/admin/system/import --cookie admin.cookie -F "file=@/home/pine/out.zip"`
|
||||
|
||||
_Note_: this endpoint requires the logged in user to be an admin and is only relevant if
|
||||
the auth module supports it.
|
||||
operationId: admin_system_import_post
|
||||
tags: [admin]
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
format: binary
|
||||
required:
|
||||
- file
|
||||
responses:
|
||||
"200":
|
||||
$ref: "../api/components.yaml#/responses/Success"
|
||||
"400":
|
||||
description: The loading of data was wrong. Should be a gz, like what is exported.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorizedOrNotAdmin"
|
||||
"422":
|
||||
description: The file argument was not present.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
@@ -204,7 +204,7 @@ def _add_or_update_annotation(new_annotation):
|
||||
|
||||
return new_annotation["_id"]
|
||||
|
||||
@bp.route("/mine/by_document_id/<doc_id>", methods = ["POST", "PUT"])
|
||||
@bp.route("/mine/by_document_id/<doc_id>", methods = ["POST"])
|
||||
def save_annotations(doc_id):
|
||||
"""
|
||||
Save new NER annotations and labels to the database as an entry for the logged in user, for the document. If there
|
||||
@@ -254,7 +254,7 @@ def save_annotations(doc_id):
|
||||
|
||||
return jsonify(resp)
|
||||
|
||||
@bp.route("/mine/by_collection_id/<collection_id>", methods = ["POST", "PUT"])
|
||||
@bp.route("/mine/by_collection_id/<collection_id>", methods = ["POST"])
|
||||
def save_collection_annotations(collection_id: str):
|
||||
# If you change input or output, update client modules pine.client.models and pine.client.client
|
||||
collection = service.get_item_by_id("collections", collection_id, params=service.params({
|
||||
@@ -277,6 +277,9 @@ def save_collection_annotations(collection_id: str):
|
||||
|
||||
skip_document_updates = json.loads(request.args.get("skip_document_updates", "false"))
|
||||
update_iaa = json.loads(request.args.get("update_iaa", "true"))
|
||||
# Batch mode should only be used when all documents being annotated haven't been
|
||||
# annotated before, otherwise eve's versioning will be messed up.
|
||||
batch_mode = json.loads(request.args.get("batch_mode", "true"))
|
||||
|
||||
# make sure all the documents actually belong to that collection
|
||||
collection_ids = list(documents.get_collection_ids_for(doc_annotations.keys()))
|
||||
@@ -284,7 +287,6 @@ def save_collection_annotations(collection_id: str):
|
||||
raise exceptions.Unauthorized()
|
||||
user_id = auth.get_logged_in_user()["id"]
|
||||
|
||||
# first try batch mode
|
||||
new_annotations = []
|
||||
for (doc_id, body) in doc_annotations.items():
|
||||
(doc_labels, ner_annotations) = _make_annotations(body)
|
||||
@@ -295,24 +297,35 @@ def save_collection_annotations(collection_id: str):
|
||||
"document_id": doc_id,
|
||||
"annotation": doc_labels + ner_annotations
|
||||
})
|
||||
resp = service.post("annotations", json=new_annotations)
|
||||
if resp.ok:
|
||||
for (i, created_annotation) in enumerate(resp.json()["_items"]):
|
||||
new_annotations[i]["_id"] = created_annotation["_id"]
|
||||
if not skip_document_updates:
|
||||
set_document_to_annotated_by_user(new_annotations[i]["document_id"],
|
||||
new_annotations[i]["creator_id"])
|
||||
log.access_flask_annotate_documents(new_annotations)
|
||||
if update_iaa:
|
||||
success = pineiaa.update_iaa_report_by_collection_id(collection_id)
|
||||
if not success:
|
||||
logger.error("Unable to update IAA report but will not return an error")
|
||||
return jsonify([annotation["_id"] for annotation in new_annotations])
|
||||
|
||||
if batch_mode:
|
||||
# first try batch mode (should only be done if the document doesn't have annotations already)
|
||||
resp = service.post("annotations", json=new_annotations)
|
||||
if resp.ok:
|
||||
resp_json = resp.json()
|
||||
# Changing a single document will not have _items
|
||||
if "_items" in resp_json:
|
||||
for (i, created_annotation) in enumerate(resp_json["_items"]):
|
||||
new_annotations[i]["_id"] = created_annotation["_id"]
|
||||
if not skip_document_updates:
|
||||
set_document_to_annotated_by_user(new_annotations[i]["document_id"],
|
||||
new_annotations[i]["creator_id"])
|
||||
else:
|
||||
new_annotations[0]["_id"] = resp_json["_id"]
|
||||
if not skip_document_updates:
|
||||
set_document_to_annotated_by_user(new_annotations[0]["document_id"],
|
||||
new_annotations[0]["creator_id"])
|
||||
log.access_flask_annotate_documents(new_annotations)
|
||||
if update_iaa:
|
||||
success = pineiaa.update_iaa_report_by_collection_id(collection_id)
|
||||
if not success:
|
||||
logger.error("Unable to update IAA report but will not return an error")
|
||||
return jsonify([annotation["_id"] for annotation in new_annotations])
|
||||
|
||||
# fall back on individual mode
|
||||
added_ids = []
|
||||
for annotation in new_annotations:
|
||||
added_id = _add_or_update_annotation(annotation["document_id"], user_id, annotation)
|
||||
added_id = _add_or_update_annotation(annotation)
|
||||
if added_id:
|
||||
added_ids.append(added_id)
|
||||
if update_iaa:
|
||||
|
||||
211
backend/pine/backend/annotations/openapi.yaml
Normal file
211
backend/pine/backend/annotations/openapi.yaml
Normal file
@@ -0,0 +1,211 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
security:
|
||||
- cookieAuth: []
|
||||
|
||||
tags:
|
||||
- name: annotations
|
||||
description: Operations in the "annotations" blueprint.
|
||||
|
||||
components:
|
||||
|
||||
schemas:
|
||||
|
||||
WrappedAnnotations:
|
||||
type: object
|
||||
properties:
|
||||
_items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/UserDocumentAnnotation"
|
||||
_links:
|
||||
$ref: "../api/components.yaml#/schemas/EveLinks"
|
||||
|
||||
paths:
|
||||
|
||||
/annotations/mine/by_document_id/{doc_id}:
|
||||
get:
|
||||
summary: Get My Document Annotations
|
||||
description: |
|
||||
Get a list of annotations done by the logged in user on a document.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/annotations/mine/by_document_id/60d08052f2cb44c51e0af0f1 --cookie session.cookie`
|
||||
operationId: annotations_get_mine
|
||||
tags: [annotations]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found document and got annotations.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedAnnotations"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
post:
|
||||
summary: Save My Annotations
|
||||
description: |
|
||||
Change annotations of a document.
|
||||
|
||||
Example: `curl -X PUT http://localhost:5000/annotations/mine/by_document_id/60d08052f2cb44c51e0af0f1 --cookie session.cookie -H "Content-type: application/json" -d '{"doc":["sci.crypt", "talk.politics.misc"],"ner":[{"end":365,"start":346, "label":"sci.med"}, {"start":475, "end":530, "label":"alt.atheism"}]}'`
|
||||
|
||||
_Note_: start or end indices in the middle of words might make the UI not show the label.
|
||||
Also, invalid labels are not checked and might cause the UI to freeze.
|
||||
operationId: annotations_save_mine
|
||||
tags: [annotations]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
- name: update_iaa
|
||||
in: query
|
||||
required: false
|
||||
description: Whether to also update IAA reports.
|
||||
schema:
|
||||
type: boolean
|
||||
default: true
|
||||
requestBody:
|
||||
description: The labels to add to the document.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/DocumentAnnotations"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found document and changed annotations (returns doc_id).
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/annotations/mine/by_collection_id/{collection_id}:
|
||||
post:
|
||||
summary: Set Collection Annotations
|
||||
description: |
|
||||
Modify annotations of certain documents in a given collection.
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/annotations/mine/by_collection_id/60d32ba28d34cf656fed503f --cookie session.cookie -H "Content-type: application/json" -d '{"60d32ba48d34cf656fed504b": {"doc":["sci.crypt", "talk.politics.misc"],"ner":[[0,4,"sci.med"], [0,4,"alt.atheism"]]}, "60d32ba48d34cf656fed504c": {"doc":[], "ner":[[0,4,"sci.med"]]}}'`
|
||||
operationId: annotations_collection
|
||||
tags: [annotations]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
- name: batch_mode
|
||||
required: true
|
||||
description: |
|
||||
Whether or not to send all annotations to the database as one batch or individually.
|
||||
|
||||
_Note_: Batch mode should ONLY be used if all of the documents have not already been annotated.
|
||||
|
||||
The versioning of eve will be messed up if batch mode annotates a document with pre-existing annotations (even if old).
|
||||
|
||||
To be clear, even if a document had annotations that were deleted, using batch mode on that document will cause problems.
|
||||
|
||||
Conversely, using individual mode (batch_mode = False) can always be done, but will be slower.
|
||||
|
||||
Another issue with individual mode is with many documents, there will be many backend queries, possibly getting rate limited.
|
||||
schema:
|
||||
type: boolean
|
||||
default: true
|
||||
in: query
|
||||
- name: update_iaa
|
||||
in: query
|
||||
required: false
|
||||
description: Whether to also update IAA reports.
|
||||
schema:
|
||||
type: boolean
|
||||
default: true
|
||||
requestBody:
|
||||
description: The labels to add to the document.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
description: Mapping from document ID to annotations object.
|
||||
type: object
|
||||
additionalProperties:
|
||||
$ref: "../api/components.yaml#/schemas/DocumentAnnotations"
|
||||
example:
|
||||
{"60d47b4bdbfddb3ca87c7971": {"doc": ["label1", "label2"],
|
||||
"ner": [[0, 10, "label1"], [15, 18, "label2"]]}}
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found document and changed annotations (returns annotation ids).
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/annotations/others/by_document_id/{doc_id}:
|
||||
get:
|
||||
summary: Get Others' Document Annotations
|
||||
description: |
|
||||
Get a list of annotations done by everyone but me on a document.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/annotations/others/by_document_id/60d08052f2cb44c51e0af0f1 --cookie session.cookie`
|
||||
operationId: annotations_others
|
||||
tags: [annotations]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found document and got annotations.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedAnnotations"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/annotations/by_document_id/{doc_id}:
|
||||
get:
|
||||
summary: Get All Document Annotations
|
||||
description: |
|
||||
Get a list of annotations done by everyone on a document.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/annotations/by_document_id/60d08052f2cb44c51e0af0f1 --cookie session.cookie`
|
||||
operationId: annotations_all
|
||||
tags: [annotations]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found document and got annotations.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedAnnotations"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
3
backend/pine/backend/api/.gitignore
vendored
Normal file
3
backend/pine/backend/api/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
*.tar.gz
|
||||
4
backend/pine/backend/api/__init__.py
Normal file
4
backend/pine/backend/api/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
"""This module implements all methods required for SwaggerUI to run on the
|
||||
backend of PINE."""
|
||||
34
backend/pine/backend/api/base.yaml
Normal file
34
backend/pine/backend/api/base.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
info:
|
||||
title: "PINE"
|
||||
description: |
|
||||
PINE: Pmap Interface for Nlp Experimentation
|
||||
|
||||
PINE is a Natural Language Processing (NLP) tool designed for integration with the
|
||||
Precision Medicine Analytics Platform (PMAP), developed at the Johns Hopkins University Applied
|
||||
Physics Laboratory (JHU/APL).
|
||||
|
||||
PINE consists of a web UI along with backing services.
|
||||
version: "1.0.1"
|
||||
contact:
|
||||
name: "Michael Harrity"
|
||||
email: "Michael.Harrity@jhuapl.edu"
|
||||
license:
|
||||
name: "AGPL-3.0"
|
||||
url: https://github.com/JHUAPL/PINE/blob/master/LICENSE
|
||||
|
||||
servers:
|
||||
- url: http://localhost:5000
|
||||
- url: https://localhost:8888/api
|
||||
- url: https://dev-nlpannotator.pm.jh.edu/api
|
||||
|
||||
paths: {}
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
cookieAuth:
|
||||
$ref: "./components.yaml#/securitySchemes/cookieAuth"
|
||||
schemas: {}
|
||||
34
backend/pine/backend/api/bp.py
Normal file
34
backend/pine/backend/api/bp.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
import logging
|
||||
|
||||
from flask import redirect, render_template, request, send_file, url_for, Blueprint
|
||||
|
||||
bp = Blueprint("api", __name__, url_prefix = "/api", template_folder="swagger-ui")
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# Return the openapi specification for SwaggerUI
|
||||
@bp.route("/openapi.yaml", methods=["GET"])
|
||||
def openapi_spec():
|
||||
# Specify statically where the openapi file is, relative path
|
||||
return send_file("api/openapi.yaml", mimetype='text/yaml', as_attachment=False)
|
||||
|
||||
@bp.route("/ui", methods=["GET"], strict_slashes=False)
|
||||
def swagger_ui_index():
|
||||
# forward to /api/ui/index.html, taking proxy prefix into account if set
|
||||
url = request.headers.get("X-Forwarded-Prefix", "") + url_for("api.swagger_ui", file="index.html")
|
||||
LOGGER.info("Redirecting to {}".format(url))
|
||||
return redirect(url)
|
||||
|
||||
@bp.route("/ui/<file>", methods=["GET"])
|
||||
def swagger_ui(file: str):
|
||||
if file == "index.html":
|
||||
# get url for /api/openapi.yaml, taking proxy prefix into account if set
|
||||
url = request.headers.get("X-Forwarded-Prefix", "") + url_for("api.openapi_spec")
|
||||
LOGGER.info("Grabbing spec from {}".format(url))
|
||||
return render_template("index.html", spec_url=url)
|
||||
else:
|
||||
return send_file("api/swagger-ui/{}".format(file))
|
||||
|
||||
def init_app(app):
|
||||
app.register_blueprint(bp)
|
||||
611
backend/pine/backend/api/components.yaml
Normal file
611
backend/pine/backend/api/components.yaml
Normal file
@@ -0,0 +1,611 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
securitySchemes:
|
||||
|
||||
cookieAuth:
|
||||
description: |
|
||||
This an example command to provision and print the session key using eve:
|
||||
|
||||
`curl -X POST -H "Content-Type:application/json" -d '{"username":"ada@pine.jhuapl.edu","password":"ada@pine.jhuapl.edu"}' http://localhost:5000/auth/login --cookie-jar - --output /dev/null --silent | grep -o -P "session\s.+" | sed -e 's/session\s/session=/' -`
|
||||
type: apiKey
|
||||
in: cookie
|
||||
name: session
|
||||
|
||||
parameters:
|
||||
|
||||
userIdParam:
|
||||
name: user_id
|
||||
in: path
|
||||
required: true
|
||||
description: ID of the user on which to operate.
|
||||
schema:
|
||||
type: string
|
||||
|
||||
docIdParam:
|
||||
name: doc_id
|
||||
in: path
|
||||
required: true
|
||||
description: The id of the document on which to operate.
|
||||
schema:
|
||||
type: string
|
||||
|
||||
collectionIdParam:
|
||||
name: collection_id
|
||||
in: path
|
||||
required: true
|
||||
description: The id of the collection on which to operate.
|
||||
schema:
|
||||
type: string
|
||||
|
||||
pipelineIdParam:
|
||||
name: pipeline_id
|
||||
in: path
|
||||
required: true
|
||||
description: The id of the pipeline on which to operate.
|
||||
schema:
|
||||
type: string
|
||||
|
||||
classifierIdParam:
|
||||
name: classifier_id
|
||||
in: path
|
||||
required: true
|
||||
description: The id of the classifier on which to operate.
|
||||
schema:
|
||||
type: string
|
||||
|
||||
schemas:
|
||||
|
||||
DocumentAnnotations:
|
||||
type: object
|
||||
properties:
|
||||
doc:
|
||||
description: Document-level annotations.
|
||||
type: array
|
||||
items:
|
||||
description: Annotation label.
|
||||
type: string
|
||||
ner:
|
||||
description: NER annotations.
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
start:
|
||||
description: Start index, inclusive.
|
||||
type: integer
|
||||
end:
|
||||
description: End index, exclusive.
|
||||
type: integer
|
||||
label:
|
||||
description: Annotation label.
|
||||
type: string
|
||||
example:
|
||||
doc: ["label1", "label2"]
|
||||
ner: [{"start":0, "end":10, "label":"in-text-label"}]
|
||||
|
||||
AuthUser:
|
||||
type: object
|
||||
properties:
|
||||
display_name:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
is_admin:
|
||||
type: boolean
|
||||
username:
|
||||
type: string
|
||||
example:
|
||||
display_name: Ada Lovelace
|
||||
id: ada
|
||||
is_admin: false
|
||||
username: ada@pine.jhuapl.edu
|
||||
|
||||
AuthUserDetails:
|
||||
type: object
|
||||
properties:
|
||||
description:
|
||||
type: string
|
||||
first_name:
|
||||
type: string
|
||||
last_name:
|
||||
type: string
|
||||
example:
|
||||
first_name: Ada
|
||||
last_name: Lovelace
|
||||
description: The first computer programmer.
|
||||
|
||||
EveLinks:
|
||||
type: object
|
||||
properties:
|
||||
parent:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
href:
|
||||
type: string
|
||||
self:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
href:
|
||||
type: string
|
||||
|
||||
EveBase:
|
||||
type: object
|
||||
properties:
|
||||
_etag:
|
||||
type: string
|
||||
|
||||
EveBaseWithVersion:
|
||||
allOf:
|
||||
- $ref: "#/schemas/EveBase"
|
||||
- type: object
|
||||
properties:
|
||||
_version:
|
||||
type: integer
|
||||
_latest_version:
|
||||
type: integer
|
||||
|
||||
Document:
|
||||
type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
creator_id:
|
||||
type: string
|
||||
collection_id:
|
||||
type: string
|
||||
overlap:
|
||||
type: integer
|
||||
format: int64
|
||||
metadata:
|
||||
type: object
|
||||
# This means accept any type for key/val
|
||||
additionalProperties: {}
|
||||
text:
|
||||
type: string
|
||||
has_annotated:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: boolean
|
||||
|
||||
DocumentDeletionResponse:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
description: Whether the operation was successful.
|
||||
changed_objs:
|
||||
type: object
|
||||
description: What database objects were changed during operation.
|
||||
properties:
|
||||
next_instances:
|
||||
type: object
|
||||
properties:
|
||||
updated:
|
||||
description: IDs of next_instance objects that were updated.
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
annotations:
|
||||
type: object
|
||||
properties:
|
||||
deleted:
|
||||
description: IDs of annotation objects that were deleted.
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
documents:
|
||||
type: object
|
||||
properties:
|
||||
deleted:
|
||||
description: IDs of document objects that were deleted.
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
|
||||
UserDocumentAnnotation:
|
||||
description: >
|
||||
This is the log of annotations by a specific user. A document might have 0, 1, or multiple of
|
||||
these based on how many users annotated.
|
||||
allOf:
|
||||
- $ref: "#/schemas/EveBaseWithVersion"
|
||||
- type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
creator_id:
|
||||
type: string
|
||||
collection_id:
|
||||
type: string
|
||||
document_id:
|
||||
type: string
|
||||
annotation:
|
||||
type: array
|
||||
items:
|
||||
anyOf:
|
||||
- type: string
|
||||
example: documentlabel
|
||||
description: String for labels on the entire document.
|
||||
- type: array
|
||||
items:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: integer
|
||||
example:
|
||||
[1, 2, "textlabel"]
|
||||
description: Array for individual annotations [start_index, end_index, label]
|
||||
|
||||
Collection:
|
||||
type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
creator_id:
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
configuration:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
labels:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
viewers:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
annotators:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
archived:
|
||||
type: boolean
|
||||
|
||||
CollectionDownload:
|
||||
description: Collection download is Collection with a list of all docs inside (and no eve info)
|
||||
type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
creator_id:
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
configuration:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
labels:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
viewers:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
annotators:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
archived:
|
||||
type: boolean
|
||||
documents:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Document'
|
||||
|
||||
UserPermissions:
|
||||
type: object
|
||||
properties:
|
||||
add_documents:
|
||||
type: boolean
|
||||
add_images:
|
||||
type: boolean
|
||||
annotate:
|
||||
type: boolean
|
||||
archive:
|
||||
type: boolean
|
||||
download_data:
|
||||
type: boolean
|
||||
modify_document_metadata:
|
||||
type: boolean
|
||||
modify_labels:
|
||||
type: boolean
|
||||
modify_users:
|
||||
type: boolean
|
||||
view:
|
||||
type: boolean
|
||||
|
||||
UserInfo:
|
||||
type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
_created:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
firstname:
|
||||
type: string
|
||||
lastname:
|
||||
type: string
|
||||
passwdhash:
|
||||
type: string
|
||||
role:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
|
||||
IDInfo:
|
||||
description: >
|
||||
This object is returned when doing actions like modifying a document or collection. It
|
||||
contains the ID of the object and some other information from the database.
|
||||
allOf:
|
||||
- $ref: "#/schemas/EveBase"
|
||||
- type: object
|
||||
properties:
|
||||
_status:
|
||||
type: string
|
||||
_id:
|
||||
type: string
|
||||
_updated:
|
||||
type: string
|
||||
format: date-time
|
||||
_created:
|
||||
type: string
|
||||
format: date-time
|
||||
_links:
|
||||
$ref: "#/schemas/EveLinks"
|
||||
|
||||
ErrorResponse:
|
||||
description: Error message from the server.
|
||||
type: string
|
||||
example: Error message from the server.
|
||||
|
||||
Pipeline:
|
||||
allOf:
|
||||
- $ref: "#/schemas/EveBase"
|
||||
- type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
parameters:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
example:
|
||||
cutoff: "integer"
|
||||
iterations: " integer"
|
||||
n_iter: "integer"
|
||||
dropout: "float"
|
||||
max_left: "integer"
|
||||
use_class_feature: [true, false]
|
||||
use_word: [true, false]
|
||||
use_ngrams: [true, false]
|
||||
no_mid_ngrams: [true, false]
|
||||
max_ngram_length: "integer"
|
||||
use_prev: [true, false]
|
||||
use_next: [true, false]
|
||||
use_disjunctive: [true, false]
|
||||
use_sequences: [true, false]
|
||||
use_prev_sequences: [true, false]
|
||||
use_type_seqs: [true, false]
|
||||
use_type_seqs2: [true, false]
|
||||
use_type_y_sequences: [true, false]
|
||||
_updated:
|
||||
type: string
|
||||
format: date-time
|
||||
_created:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
CollectionMetric:
|
||||
type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
collection_id:
|
||||
type: string
|
||||
classifier_id:
|
||||
type: string
|
||||
# Not positive what elements can be in these array so leaving blank
|
||||
documents:
|
||||
type: array
|
||||
items: {}
|
||||
annotations:
|
||||
type: array
|
||||
items: {}
|
||||
folds:
|
||||
type: array
|
||||
items: {}
|
||||
metrics:
|
||||
type: array
|
||||
items: {}
|
||||
_updated:
|
||||
type: string
|
||||
_created:
|
||||
type: string
|
||||
_version:
|
||||
type: integer
|
||||
_etag:
|
||||
type: string
|
||||
_links:
|
||||
type: object
|
||||
properties:
|
||||
self:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
href:
|
||||
type: string
|
||||
|
||||
InterAnnotatorAgreement:
|
||||
allOf:
|
||||
- $ref: "#/schemas/EveBaseWithVersion"
|
||||
- type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
collection_id:
|
||||
type: string
|
||||
num_of_annotators:
|
||||
type: integer
|
||||
num_of_agreement_docs:
|
||||
type: integer
|
||||
num_of_labels:
|
||||
type: integer
|
||||
per_doc_agreement:
|
||||
type: object
|
||||
properties:
|
||||
doc_id:
|
||||
type: string
|
||||
avg:
|
||||
type: number
|
||||
format: double
|
||||
stddev:
|
||||
type: integer
|
||||
per_label_agreement:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
avg:
|
||||
type: number
|
||||
format: double
|
||||
stddev:
|
||||
type: integer
|
||||
overall_agreement:
|
||||
type: object
|
||||
properties:
|
||||
mean:
|
||||
type: number
|
||||
format: double
|
||||
sd:
|
||||
type: integer
|
||||
heatmap_data:
|
||||
type: object
|
||||
properties:
|
||||
matrix:
|
||||
type: array
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
format: float
|
||||
minItems: 2
|
||||
maxItems: 2
|
||||
example:
|
||||
[1, .666666]
|
||||
annotators:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
["ada", "margaret"]
|
||||
labels_per_annotator:
|
||||
# Dictionary of dictionaries per annotator
|
||||
type: object
|
||||
additionalProperties:
|
||||
# Dictionary of number of each label
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: integer
|
||||
example:
|
||||
{"ada": {"label1": 1, "label2": 4}, "margaret": {"label1": 3, "label2": 2}}
|
||||
_updated:
|
||||
type: string
|
||||
format: date-time
|
||||
_created:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
responses:
|
||||
|
||||
Success:
|
||||
description: Whether the operation succeeded or failed.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
|
||||
NotAuthorized:
|
||||
description: >
|
||||
Authentication failed: not logged in or user doesn't have the permissions for this operation.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
NotAuthorizedOrNotAdmin:
|
||||
description: Authentication failed, not logged in or not an admin.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
InvalidInputParameters:
|
||||
description: Input parameters are missing/invalid.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
DocumentNotFound:
|
||||
description: Document with given ID was not found.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
CollectionNotFound:
|
||||
description: Collection with given ID was not found.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
PipelineNotFound:
|
||||
description: Pipeline with given ID was not found.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
ClassifierNotFound:
|
||||
description: Classifier with given ID was not found.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
MismatchedEtag:
|
||||
description: Given etag did not match the most updated stored one.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
|
||||
UnexpectedServerError:
|
||||
description: Unexpected error, check server logs.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/schemas/ErrorResponse"
|
||||
22
backend/pine/backend/api/download_swagger_ui.sh
Executable file
22
backend/pine/backend/api/download_swagger_ui.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
set -ex
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
VERSION=$(curl --silent "https://api.github.com/repos/swagger-api/swagger-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
if [[ ${VERSION} = v* ]]; then
|
||||
VERSION=${VERSION:1}
|
||||
fi
|
||||
else
|
||||
VERSION="$1"
|
||||
fi
|
||||
|
||||
if [[ ! -f swagger-ui-${VERSION}.tar.gz ]]; then
|
||||
wget "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${VERSION}.tar.gz" -O swagger-ui-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
rm -rf swagger-ui/
|
||||
tar xzf swagger-ui-${VERSION}.tar.gz swagger-ui-${VERSION}/dist/ --transform "s|swagger-ui-${VERSION}/dist|swagger-ui|"
|
||||
sed -i 's|https://petstore.swagger.io/v2/swagger.json|{{spec_url}}|' swagger-ui/index.html
|
||||
echo ${VERSION} > swagger-ui/VERSION
|
||||
4325
backend/pine/backend/api/openapi.yaml
Normal file
4325
backend/pine/backend/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
1
backend/pine/backend/api/swagger-ui/VERSION
Normal file
1
backend/pine/backend/api/swagger-ui/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
3.50.0
|
||||
BIN
backend/pine/backend/api/swagger-ui/favicon-16x16.png
Normal file
BIN
backend/pine/backend/api/swagger-ui/favicon-16x16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 665 B |
BIN
backend/pine/backend/api/swagger-ui/favicon-32x32.png
Normal file
BIN
backend/pine/backend/api/swagger-ui/favicon-32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 628 B |
60
backend/pine/backend/api/swagger-ui/index.html
Normal file
60
backend/pine/backend/api/swagger-ui/index.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
||||
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||
<style>
|
||||
html
|
||||
{
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after
|
||||
{
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
margin:0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// Begin Swagger UI call region
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "{{spec_url}}",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
});
|
||||
// End Swagger UI call region
|
||||
|
||||
window.ui = ui;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
75
backend/pine/backend/api/swagger-ui/oauth2-redirect.html
Normal file
75
backend/pine/backend/api/swagger-ui/oauth2-redirect.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<title>Swagger UI: OAuth2 Redirect</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
function run () {
|
||||
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||
var sentState = oauth2.state;
|
||||
var redirectUrl = oauth2.redirectUrl;
|
||||
var isValid, qp, arr;
|
||||
|
||||
if (/code|token|error/.test(window.location.hash)) {
|
||||
qp = window.location.hash.substring(1);
|
||||
} else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
|
||||
arr = qp.split("&");
|
||||
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
||||
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||
function (key, value) {
|
||||
return key === "" ? value : decodeURIComponent(value);
|
||||
}
|
||||
) : {};
|
||||
|
||||
isValid = qp.state === sentState;
|
||||
|
||||
if ((
|
||||
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorization_code"
|
||||
) && !oauth2.auth.code) {
|
||||
if (!isValid) {
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "warning",
|
||||
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||
});
|
||||
}
|
||||
|
||||
if (qp.code) {
|
||||
delete oauth2.state;
|
||||
oauth2.auth.code = qp.code;
|
||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||
} else {
|
||||
let oauthErrorMsg;
|
||||
if (qp.error) {
|
||||
oauthErrorMsg = "["+qp.error+"]: " +
|
||||
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||
}
|
||||
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "error",
|
||||
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
run();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
3
backend/pine/backend/api/swagger-ui/swagger-ui-bundle.js
Normal file
3
backend/pine/backend/api/swagger-ui/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
backend/pine/backend/api/swagger-ui/swagger-ui.css
Normal file
4
backend/pine/backend/api/swagger-ui/swagger-ui.css
Normal file
File diff suppressed because one or more lines are too long
1
backend/pine/backend/api/swagger-ui/swagger-ui.css.map
Normal file
1
backend/pine/backend/api/swagger-ui/swagger-ui.css.map
Normal file
File diff suppressed because one or more lines are too long
3
backend/pine/backend/api/swagger-ui/swagger-ui.js
Normal file
3
backend/pine/backend/api/swagger-ui/swagger-ui.js
Normal file
File diff suppressed because one or more lines are too long
1
backend/pine/backend/api/swagger-ui/swagger-ui.js.map
Normal file
1
backend/pine/backend/api/swagger-ui/swagger-ui.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -105,4 +105,7 @@ def create_app(test_config = None):
|
||||
from .pineiaa import bp as iaabp
|
||||
iaabp.init_app(app)
|
||||
|
||||
from .api import bp as apibp
|
||||
apibp.init_app(app)
|
||||
|
||||
return app
|
||||
|
||||
@@ -59,6 +59,7 @@ def flask_get_logged_in_user() -> Response:
|
||||
return jsonify(module.get_logged_in_user())
|
||||
|
||||
@bp.route("/logged_in_user_details", methods = ["GET"])
|
||||
@login_required
|
||||
def flask_get_logged_in_user_details() -> Response:
|
||||
return jsonify(module.get_logged_in_user_details().to_dict())
|
||||
|
||||
@@ -67,10 +68,9 @@ def flask_get_login_form() -> Response:
|
||||
return jsonify(module.get_login_form().to_dict())
|
||||
|
||||
@bp.route("/logout", methods = ["POST"])
|
||||
@login_required
|
||||
def flask_post_logout() -> Response:
|
||||
user = module.get_logged_in_user()
|
||||
if user == None:
|
||||
raise exceptions.BadRequest()
|
||||
module.logout()
|
||||
log.access_flask_logout(user)
|
||||
return Response(status = 200)
|
||||
|
||||
410
backend/pine/backend/auth/openapi.yaml
Normal file
410
backend/pine/backend/auth/openapi.yaml
Normal file
@@ -0,0 +1,410 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
tags:
|
||||
- name: auth
|
||||
description: Operations in the "auth" blueprint.
|
||||
- name: auth_eve
|
||||
description: These operations are only available if using "eve" auth module.
|
||||
- name: auth_vegas
|
||||
description: These operations are only available if using "vegas" auth module.
|
||||
|
||||
components:
|
||||
|
||||
schemas:
|
||||
|
||||
LoginForm:
|
||||
description: Information needed to display a login form.
|
||||
type: object
|
||||
properties:
|
||||
button_text:
|
||||
description: Text to set in the login button.
|
||||
type: string
|
||||
fields:
|
||||
description: Form fields to use.
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
display:
|
||||
description: Display name.
|
||||
type: string
|
||||
name:
|
||||
description: Form name.
|
||||
type: string
|
||||
type:
|
||||
description: Form type.
|
||||
type: string
|
||||
example:
|
||||
button_text: Login
|
||||
fields:
|
||||
- display: Username or email
|
||||
name: username
|
||||
type: text
|
||||
- display: Password
|
||||
name: password
|
||||
type: password
|
||||
|
||||
EveLogin:
|
||||
description: Only for eve login.
|
||||
type: object
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
|
||||
EvePasswordChange:
|
||||
type: object
|
||||
properties:
|
||||
current_password:
|
||||
type: string
|
||||
new_password:
|
||||
type: string
|
||||
|
||||
VegasAuthToken:
|
||||
description: An auth token obtained by Vegas out-of-band from PINE.
|
||||
type: object
|
||||
properties:
|
||||
auth_token:
|
||||
type: string
|
||||
token_type:
|
||||
type: string
|
||||
additionalProperties: {}
|
||||
|
||||
paths:
|
||||
|
||||
# Endpoints available for all auth modules.
|
||||
|
||||
/auth/module:
|
||||
get:
|
||||
summary: Get Auth Module
|
||||
description: |
|
||||
Get the current auth module being used (vegas or eve).
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/auth/module`
|
||||
operationId: auth_get_module
|
||||
tags: [auth]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully got the auth module.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
enum: [eve, vegas]
|
||||
|
||||
/auth/flat:
|
||||
get:
|
||||
summary: Get Auth Is Flat
|
||||
description: |
|
||||
Return true if the current auth module is flat.
|
||||
|
||||
"Flat" auth means, generally, there are no administrators and permissions are generally on
|
||||
the same "level". Collection-level permissions for viewing/annotating still apply, however.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/auth/flat`
|
||||
operationId: auth_get_flat
|
||||
tags: [auth]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully return a boolean if the auth module was flat.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
|
||||
/auth/can_manage_users:
|
||||
get:
|
||||
summary: Get Auth Can Manage Users
|
||||
description: |
|
||||
Return true if the current auth module supports managing users.
|
||||
|
||||
If `true`, the auth module can change, add, and delete users. If `false`, users are managed
|
||||
by an external system.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/auth/flat`
|
||||
operationId: auth_get_manage
|
||||
tags: [auth]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully return a boolean if the auth module supports managing users.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
|
||||
/auth/logged_in_user:
|
||||
get:
|
||||
summary: Get Logged In User
|
||||
description: |
|
||||
Get the currently logged in user (checks based on the session - need the session cookie sent).
|
||||
If there is no user logged, in `null` is returned.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/auth/logged_in_user --cookie session.cookie`
|
||||
operationId: auth_logged_in_user
|
||||
tags: [auth]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully returned the logged in user (or null if no session cookie).
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
oneOf:
|
||||
- type: string
|
||||
nullable: true
|
||||
default: null
|
||||
- $ref: "../api/components.yaml#/schemas/AuthUser"
|
||||
|
||||
/auth/logged_in_user_details:
|
||||
get:
|
||||
summary: Get Logged In User Details
|
||||
description: |
|
||||
Get the currently logged in user's details.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/auth/logged_in_user_details --cookie session.cookie`
|
||||
operationId: auth_user_details
|
||||
security:
|
||||
- cookieAuth: []
|
||||
tags: [auth]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully returned the logged in user details.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/AuthUserDetails"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
|
||||
# Eve-specific post.
|
||||
post:
|
||||
summary: Update Logged In User Details with Eve
|
||||
description: |
|
||||
Updates the user details for the logged in user.
|
||||
|
||||
_Note_: this endpoint is only exposed if using "eve" auth module.
|
||||
operationId: auth_eve_update_user_details
|
||||
security:
|
||||
- cookieAuth: []
|
||||
tags: [auth_eve]
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/AuthUserDetails"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully updated user details.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
|
||||
/auth/login_form:
|
||||
get:
|
||||
summary: Get the login form.
|
||||
description: |
|
||||
For auth modules that use a form to login, this endpoint will return the information needed
|
||||
to present that form to the user and send back the necessary info in a subsequent login
|
||||
call.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/auth/login_form`
|
||||
operationId: auth_login_form
|
||||
tags: [auth]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully returned the login form.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/LoginForm"
|
||||
|
||||
/auth/logout:
|
||||
post:
|
||||
summary: Logout
|
||||
description: |
|
||||
Logout of the current session.
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/auth/logout --cookie session.cookie`
|
||||
operationId: auth_logout
|
||||
tags: [auth]
|
||||
security:
|
||||
- cookieAuth: []
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully logged out.
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
|
||||
/auth/login:
|
||||
post:
|
||||
summary: Login User
|
||||
description: |
|
||||
Logs in user. How this works depends on the auth module used.
|
||||
|
||||
For eve: this takes a request body consisting of the login form data.
|
||||
|
||||
For vegas: this takes in no parameters and returns the URL the caller should redirect to.
|
||||
operationId: auth_login
|
||||
tags: [auth_eve, auth_vegas]
|
||||
parameters:
|
||||
- name: return_to
|
||||
in: query
|
||||
required: false
|
||||
description: For vegas auth only, a URL to return to after auth flow.
|
||||
schema:
|
||||
type: string
|
||||
format: url
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/EveLogin"
|
||||
responses:
|
||||
"200":
|
||||
description: |
|
||||
For eve: successfully logged in, returns user information.
|
||||
|
||||
For vegas: starts auth flow and returns the URL that the caller should redirect to.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
oneOf:
|
||||
- $ref: "../api/components.yaml#/schemas/AuthUser"
|
||||
- type: string
|
||||
format: url
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
description: Given user doesn't exist, password isn't set, or password doesn't match.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/ErrorResponse"
|
||||
|
||||
# Eve-specific endpoints.
|
||||
|
||||
/auth/users:
|
||||
get:
|
||||
summary: Get Eve Users
|
||||
description: |
|
||||
Gets all users that are registered with eve.
|
||||
|
||||
_Note_: this endpoint is only exposed if using "eve" auth module.
|
||||
operationId: auth_eve_users
|
||||
tags: [auth_eve]
|
||||
security:
|
||||
- cookieAuth: []
|
||||
responses:
|
||||
"200":
|
||||
description: Returns all users.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/AuthUser"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
|
||||
/auth/logged_in_user_password:
|
||||
post:
|
||||
summary: Update Eve User Password
|
||||
description: |
|
||||
Updates the password of the currently logged in eve user.
|
||||
|
||||
_Note_: this endpoint is only exposed if using "eve" auth module.
|
||||
operationId: auth_eve_update_password
|
||||
tags: [auth_eve]
|
||||
security:
|
||||
- cookieAuth: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/EvePasswordChange"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully changed password.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
description: Not logged in, or current password doesn't match.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/ErrorResponse"
|
||||
|
||||
# Vegas-specific endpoints.
|
||||
|
||||
/auth/authorize:
|
||||
get:
|
||||
summary: Authorize From Fragment
|
||||
description: |
|
||||
Part of the OAuth flow, this will authorize based on passed-in query parameters.
|
||||
|
||||
_Note_: this endpoint is only exposed if using "vegas" auth module.
|
||||
operationId: auth_vegas_authorize_get
|
||||
tags: [auth_vegas]
|
||||
parameters:
|
||||
- name: fragment
|
||||
in: query
|
||||
required: true
|
||||
description: OAuth flow fragment.
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully logged in, returns user information.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/AuthUser"
|
||||
"400":
|
||||
description: Fragment is not valid, or parsed token is not valid.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/ErrorResponse"
|
||||
|
||||
post:
|
||||
summary: Authorize From Token
|
||||
description: |
|
||||
Authorize diretly based on an obtained vegas token, outside the normal OAuth flow.
|
||||
This is meant to make it easy to authenticate using vegas and then use this API outside of
|
||||
the web UI.
|
||||
|
||||
_Note_: this endpoint is only exposed if using "vegas" auth module.
|
||||
operationId: auth_vegas_authorize_post
|
||||
tags: [auth_vegas]
|
||||
requestBody:
|
||||
description: Token obtained from Vegas.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/VegasAuthToken"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully logged in, returns user information.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/AuthUser"
|
||||
"400":
|
||||
description: Token is not valid.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/ErrorResponse"
|
||||
@@ -3,4 +3,4 @@
|
||||
"""This module contains the api methods required to interact with, organize, create, and display collections in the
|
||||
front-end and store the collections in the backend"""
|
||||
|
||||
from .bp import user_permissions_projection, get_user_permissions, get_user_permissions_by_id, get_user_permissions_by_ids
|
||||
from .bp import user_permissions_projection, get_user_permissions, get_user_permissions_by_id, get_user_permissions_by_ids, get_overlap_ids
|
||||
|
||||
@@ -135,12 +135,13 @@ def archive_or_unarchive_collection(collection_id, archive):
|
||||
collection = resp.json()
|
||||
if not get_user_permissions(collection).archive:
|
||||
raise exceptions.Unauthorized()
|
||||
collection["archived"] = archive
|
||||
headers = {"If-Match": collection["_etag"]}
|
||||
service.remove_nonupdatable_fields(collection)
|
||||
resp = service.put(["collections", collection_id], json = collection, headers = headers)
|
||||
if not resp.ok:
|
||||
abort(resp.status_code)
|
||||
if collection["archived"] != archive:
|
||||
collection["archived"] = archive
|
||||
headers = {"If-Match": collection["_etag"]}
|
||||
service.remove_nonupdatable_fields(collection)
|
||||
resp = service.put(["collections", collection_id], json = collection, headers = headers)
|
||||
if not resp.ok:
|
||||
abort(resp.status_code)
|
||||
return get_collection(collection_id)
|
||||
|
||||
@bp.route("/archive/<collection_id>", methods = ["PUT"])
|
||||
@@ -368,7 +369,7 @@ def add_viewer_to_collection(collection_id):
|
||||
abort(resp.status_code, resp.content)
|
||||
return service.convert_response(resp)
|
||||
else:
|
||||
abort(409, "Annotator already exists in collection")
|
||||
abort(409, "Viewer already exists in collection")
|
||||
|
||||
|
||||
@bp.route("/add_label/<collection_id>", methods=["POST"])
|
||||
@@ -393,10 +394,10 @@ def add_label_to_collection(collection_id):
|
||||
abort(resp.status_code, resp.content)
|
||||
return service.convert_response(resp)
|
||||
else:
|
||||
abort(409, "Annotator already exists in collection")
|
||||
abort(409, "Label already exists in collection")
|
||||
|
||||
|
||||
def get_overlap_ids(collection_id):
|
||||
def get_overlap_ids(collection_id: str):
|
||||
"""
|
||||
Return the list of ids for overlapping documents for the collection matching the provided collection id.
|
||||
:param collection_id: str
|
||||
@@ -714,7 +715,7 @@ def _upload_collection_image_file(collection_id, path, image_file):
|
||||
image_file.save(image_filename)
|
||||
return "/" + path
|
||||
|
||||
@bp.route("/image/<collection_id>/<path:path>", methods=["POST", "PUT"])
|
||||
@bp.route("/image/<collection_id>/<path:path>", methods=["POST"])
|
||||
@auth.login_required
|
||||
def post_collection_image(collection_id, path):
|
||||
if not is_cached_last_collection(collection_id):
|
||||
|
||||
715
backend/pine/backend/collections/openapi.yaml
Normal file
715
backend/pine/backend/collections/openapi.yaml
Normal file
@@ -0,0 +1,715 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
security:
|
||||
- cookieAuth: []
|
||||
|
||||
tags:
|
||||
- name: collections
|
||||
description: Operations in the "collections" blueprint.
|
||||
|
||||
components:
|
||||
|
||||
schemas:
|
||||
|
||||
WrappedCollections:
|
||||
type: object
|
||||
properties:
|
||||
_items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/Collection"
|
||||
|
||||
NewCollection:
|
||||
type: object
|
||||
properties:
|
||||
collection:
|
||||
description: "At minimum, this must include creator_id, annotators, viewers and labels. All other args or sub-args should be deleted or set to null value.\n\ncreator_id MUST be a valid user, otherwise 500 Error will occur."
|
||||
type: object
|
||||
properties:
|
||||
creator_id:
|
||||
type: string
|
||||
annotators:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
viewers:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
labels:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
archived:
|
||||
type: boolean
|
||||
default: false
|
||||
metadata:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
subject:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
publisher:
|
||||
type: string
|
||||
contributor:
|
||||
type: string
|
||||
date:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
format:
|
||||
type: string
|
||||
identifier:
|
||||
type: string
|
||||
source:
|
||||
type: string
|
||||
language:
|
||||
type: string
|
||||
relation:
|
||||
type: string
|
||||
coverage:
|
||||
type: string
|
||||
rights:
|
||||
type: string
|
||||
configuration:
|
||||
type: object
|
||||
properties:
|
||||
allow_overlapping_ner_annotations:
|
||||
type: boolean
|
||||
default: true
|
||||
example:
|
||||
{"creator_id": "ada",
|
||||
"annotators": ["ada"],
|
||||
"viewers": ["ada", "margaret"],
|
||||
"labels": ["label1", "label2"],
|
||||
"archived": false,
|
||||
"metadata": {"title": "Test", "subject": "testcoll",
|
||||
"description": "test collection", "publisher": "ada",
|
||||
"contributor": "ada", "date": "1/1/21", "type": "sometype",
|
||||
"format": "HTML", "identifier": "ABCD", "source": "apl",
|
||||
"language": "english", "relation": "family", "coverage": "some",
|
||||
"rights": "all of them"},
|
||||
"configuration": {"allow_overlapping_ner_annotations": true}}
|
||||
train_every:
|
||||
description: Should be an integer >= 5.
|
||||
type: integer
|
||||
minimum: 5
|
||||
overlap:
|
||||
description: |
|
||||
Should be a float between 0 and 1.
|
||||
|
||||
WARNING: You MUST put double quotation marks (`""`) around the number for the backend to
|
||||
parse it correctly.
|
||||
|
||||
Ex: enter `".5"` instead of just `.5`
|
||||
type: number
|
||||
format: float
|
||||
minimum: 0.0
|
||||
maximum: 1.0
|
||||
pipelineId:
|
||||
type: string
|
||||
description: |
|
||||
WARNING: You MUST put double quotation marks (`""`) around the id for the backend to
|
||||
parse it correctly.
|
||||
|
||||
Ex: enter `"123abc..."` instead of just `123abc...`
|
||||
classifierParameters:
|
||||
type: string
|
||||
format: object
|
||||
default: null
|
||||
required:
|
||||
- collection
|
||||
- train_every
|
||||
- overlap
|
||||
- pipelineId
|
||||
|
||||
paths:
|
||||
|
||||
/collections/unarchived:
|
||||
get:
|
||||
summary: Get Unarchived Collections
|
||||
description: |
|
||||
Get all unarchived collections for logged in user.
|
||||
|
||||
Example: `curl http://localhost:5000/collections/unarchived --cookie session.cookie`
|
||||
operationId: collections_get_unarchived_all
|
||||
tags: [collections]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully retrieved relevant collections.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedCollections"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/unarchived/{page}:
|
||||
get:
|
||||
summary: Get Paginated Unarchived Collections
|
||||
description: |
|
||||
Get unarchived user collections (either all or a certain page).
|
||||
|
||||
Example: `curl http://localhost:5000/collections/unarchived --cookie session.cookie`
|
||||
operationId: collections_get_unarchived_paginated
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- name: page
|
||||
in: path
|
||||
required: true
|
||||
description: >
|
||||
Optional page number for specifying which collections. "all" for all pages or a page
|
||||
number.
|
||||
schema:
|
||||
oneOf:
|
||||
- type: string
|
||||
default: "all"
|
||||
- type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully retrieved relevant collections.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedCollections"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/archived:
|
||||
get:
|
||||
summary: Get Archived Collections
|
||||
description: |
|
||||
Get all archived user collections.
|
||||
|
||||
Example: `curl http://localhost:5000/collections/archived --cookie session.cookie`
|
||||
operationId: collections_get_archived_all
|
||||
tags: [collections]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully retrieved relevant collections.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedCollections"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/archived/{page}:
|
||||
get:
|
||||
summary: Get Paginated Archived Collections
|
||||
description: |
|
||||
Get archived user collections (either all or a certain page).
|
||||
|
||||
Example: `curl http://localhost:5000/collections/archived --cookie session.cookie`
|
||||
operationId: collections_get_archived_paginated
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- name: page
|
||||
in: path
|
||||
required: true
|
||||
description: >
|
||||
Optional page number for specifying which collections. "all" for all pages or a page
|
||||
number.
|
||||
schema:
|
||||
oneOf:
|
||||
- type: string
|
||||
default: "all"
|
||||
- type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully retrieved relevant collections.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedCollections"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/archive/{collection_id}:
|
||||
put:
|
||||
summary: Archive Collection
|
||||
description: |
|
||||
Archive a collection with a certain ID.
|
||||
|
||||
Example: `curl -X PUT http://localhost:5000/collections/archive/60c7b7375b72bf4ed6523bf0 --cookie session.cookie`
|
||||
operationId: collections_archive
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully archived the chosen collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/Collection"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/unarchive/{collection_id}:
|
||||
put:
|
||||
summary: Unarchive Collection
|
||||
description: |
|
||||
Unarchive a collection with a certain ID.
|
||||
|
||||
Example: `curl -X PUT http://localhost:5000/collections/unarchive/60c7b7375b72bf4ed6523bf0 --cookie session.cookie`
|
||||
operationId: collections_unarchive
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully unarchived the chosen collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/Collection"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/by_id/{collection_id}:
|
||||
get:
|
||||
summary: Get Collection
|
||||
description: |
|
||||
Retrieve a collection by its ID.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/collections/by_id/60c7b7375b72bf4ed6523bf0 --cookie session.cookie`
|
||||
operationId: collections_get
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found and rerieved the chosen collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/Collection"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/by_id/{collection_id}/download:
|
||||
get:
|
||||
summary: Download Collection Data
|
||||
description: |
|
||||
Download a collection's data by its ID.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/collections/by_id/60c7b7375b72bf4ed6523bf0/download --cookie session.cookie`
|
||||
operationId: collections_download
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found and downloaded the chosen collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/Collection"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/add_annotator/{collection_id}:
|
||||
post:
|
||||
summary: Add Collection Annotator
|
||||
description: |
|
||||
Add an annotator by user_id to a specific collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X POST "http://localhost:5000/collections/add_annotator/60c7453d5b72bf4ed65239e9" -F 'user_id="\"bob\""'`
|
||||
|
||||
Notice the quotes around the user_id value, NEEDS to be like that to include the "" in the
|
||||
request session.cookie is a file containing: "Set-cookie: session=.eJy...(rest of cookie)".
|
||||
operationId: collections_add_annotator
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
user_id:
|
||||
type: string
|
||||
description: >
|
||||
Note: You must put double quotation marks (`""`) around the user_id for the
|
||||
backend to parse it correctly as it is a JSON string. For example, enter
|
||||
`"ada"` instead of just `ada`.
|
||||
required:
|
||||
- user_id
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully added the user as an annotator to the collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"400":
|
||||
description: Request malformed, probably missisng user_id arg.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
"409":
|
||||
description: Specified user is already an annotator.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"500":
|
||||
description: Internal server error - the form data was probably malformed.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
|
||||
/collections/add_viewer/{collection_id}:
|
||||
post:
|
||||
summary: Add Collection Viewer
|
||||
description: |
|
||||
Add a viewer by user_id to a specific collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X POST "http://localhost:5000/collections/add_viewer/60c7453d5b72bf4ed65239e9" -F 'user_id="\"bob\""'`
|
||||
|
||||
Notice the quotes around the user_id value, NEEDS to be like that to include the "" in the
|
||||
request. session.cookie is a file containing: "Set-cookie: session=.eJy...(rest of cookie)"
|
||||
operationId: addViewerToCollection
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
user_id:
|
||||
type: string
|
||||
description: "Note: You must put double quotation marks (\"\") around the user_id for the backend to parse it correctly.
|
||||
\n\nEx: enter \"ada\" instead of just ada"
|
||||
required:
|
||||
- user_id
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully added the user as a viewer to the collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"400":
|
||||
description: Request malformed, probably missisng user_id arg.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
"409":
|
||||
description: Specified user is already an viewer.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"500":
|
||||
description: Internal server error - the form data was probably malformed.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
|
||||
/collections/add_label/{collection_id}:
|
||||
post:
|
||||
summary: Add Collection Label
|
||||
description: |
|
||||
Add a label to a specific collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X POST "http://localhost:5000/collections/add_label/60c7453d5b72bf4ed65239e9" -F 'new_label="\"testlabel\""'`
|
||||
|
||||
Notice the quotes around the new_label value, NEEDS to be like that to include the "" in the
|
||||
request. session.cookie is a file containing: "Set-cookie: session=.eJy...(rest of cookie)"
|
||||
operationId: collections_add_label
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
new_label:
|
||||
type: string
|
||||
description: >
|
||||
Note: You must put double quotation marks (`""`) around the new_label for the
|
||||
backend to parse it correctly. Ex: enter `"MyLabel"` instead of just `MyLabel`
|
||||
required:
|
||||
- new_label
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully added the label to the collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"400":
|
||||
description: Request malformed, probably missisng new_label arg.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
"409":
|
||||
description: Specified label is already in collection.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"500":
|
||||
description: Internal server error - the form data was probably malformed.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
|
||||
/collections:
|
||||
post:
|
||||
summary: Create Collection
|
||||
description: |
|
||||
Create a new collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X POST "http://localhost:5000/collections" -F 'collection={"creator_id":"ada", "annotators":["ada"], "labels":["label1", "labellll"],"metadata":{"title":"newcoll11","subject":null,"description":"describe blahblah"}}' -F 'overlap="\".9\""' -F 'train_every="\"100\""' -F 'pipelineId="\"5babb6ee4eb7dd2c39b9671d\""'`
|
||||
|
||||
Notice the quotes around some value, NEEDS to be like that to include the "" in the request
|
||||
to be parsed as a JSON string. session.cookie is a file containing:
|
||||
"Set-cookie: session=.eJy...(rest of cookie)"
|
||||
operationId: collections_create
|
||||
tags: [collections]
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
$ref: "#/components/schemas/NewCollection"
|
||||
responses:
|
||||
"201":
|
||||
description: Successfully created the collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"400":
|
||||
description: Request malformed.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"401":
|
||||
description: Authentication failed, not logged in.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"500":
|
||||
description: Error in syntax of the request - OR Wekzeug Authentication Failure.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
|
||||
/collections/static_images/{collection_id}:
|
||||
get:
|
||||
summary: Get Collection Static Images
|
||||
description: |
|
||||
Retrieve all static images used in a collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X GET "http://localhost:5000/collections/static_images/60c745395b72bf4ed6523821"`
|
||||
operationId: collections_get_static_images
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found the collection and got any relevant static images.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
description: An array of static image paths.
|
||||
items:
|
||||
type: string
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/images/{collection_id}:
|
||||
get:
|
||||
summary: Get Collection Images
|
||||
description: |
|
||||
Retrieve all (non-static) images used in a collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X GET "http://localhost:5000/collections/images/60c745395b72bf4ed6523821"`
|
||||
operationId: collections_get_images
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found the collection and got any relevant images.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
description: An array of image paths.
|
||||
items:
|
||||
type: string
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/image_exists/{collection_id}/{path}:
|
||||
get:
|
||||
summary: Check Collection Image
|
||||
description: |
|
||||
Checks whether the given image exists in the given collection.
|
||||
|
||||
Example: `curl -X GET "http://localhost:5000/collections/image_exists/60c745395b72bf4ed6523821/static%2Fapl.png" -H "accept: application/json" --cookie session.cookie`
|
||||
operationId: collections_image_exists
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
- name: path
|
||||
in: path
|
||||
required: true
|
||||
description: Path of the image to check (same as returned from images/static_images).
|
||||
schema:
|
||||
type: string
|
||||
example: "static/apl.jpg"
|
||||
responses:
|
||||
"200":
|
||||
description: Returns whether the collection holds the image.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/image/{collection_id}/{path}:
|
||||
get:
|
||||
summary: Get Collection Image
|
||||
description: |
|
||||
Download an image from a collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X GET "http://localhost:5000/collections/image/60c745395b72bf4ed6523821/static/apl.png" -v --output - > apl.png`
|
||||
operationId: collections_image
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
- name: path
|
||||
in: path
|
||||
required: true
|
||||
description: Path of the image to download (same as returned from images/static_images).
|
||||
schema:
|
||||
type: string
|
||||
example: "static/apl.jpg"
|
||||
responses:
|
||||
"200":
|
||||
description: "Successfully found the collection and returns image data."
|
||||
content:
|
||||
image/*:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
post:
|
||||
summary: Upload Collection Image
|
||||
description: |
|
||||
Upload an image to a collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X POST "http://localhost:5000/collections/image/60c745395b72bf4ed6523821/static/dog.jpeg" -F 'file=@/home/pine/Downloads/dog.jpeg'`
|
||||
operationId: collections_image_upload
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
- name: path
|
||||
in: path
|
||||
required: true
|
||||
description: |
|
||||
Path to place the image at.
|
||||
|
||||
Note: This path piece should NOT start with / (Ex: static/dog.jpg, not /static/dog.jpg).
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
format: binary
|
||||
required:
|
||||
- file
|
||||
responses:
|
||||
"100":
|
||||
description: Couldn't read the image, probably bad permissions or bad path.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"200":
|
||||
description: "Successfully uploaded image (Will return the path)."
|
||||
# This is the same as error response but isn't an error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
"400":
|
||||
description: Did not include the image in the request form.
|
||||
content: {application/json: {schema: {$ref: "../api/components.yaml#/schemas/ErrorResponse"}}}
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/collections/user_permissions/{collection_id}:
|
||||
get:
|
||||
summary: Get Collection User Permissions
|
||||
description: |
|
||||
Get the current user permissions of a collection.
|
||||
|
||||
Example: `curl --cookie session.cookie -X GET "http://localhost:5000/collections/user_permissions/60c745395b72bf4ed6523821" -v`
|
||||
operationId: collections_permissions
|
||||
tags: [collections]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Returns collection permissions for logged in user.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/UserPermissions"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
329
backend/pine/backend/documents/openapi.yaml
Normal file
329
backend/pine/backend/documents/openapi.yaml
Normal file
@@ -0,0 +1,329 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
security:
|
||||
- cookieAuth: []
|
||||
|
||||
tags:
|
||||
- name: documents
|
||||
description: Operations in the "documents" blueprint.
|
||||
|
||||
components:
|
||||
|
||||
schemas:
|
||||
|
||||
WrappedDocuments:
|
||||
type: object
|
||||
properties:
|
||||
_items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/Document"
|
||||
|
||||
NewDocument:
|
||||
description: Arguments for the new document (at least collection_id, creator_id, text).
|
||||
type: object
|
||||
properties:
|
||||
collection_id:
|
||||
type: string
|
||||
creator_id:
|
||||
type: string
|
||||
text:
|
||||
type: string
|
||||
overlap:
|
||||
type: number
|
||||
format: double
|
||||
metadata:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
has_annotated:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: boolean
|
||||
required:
|
||||
- collection_id
|
||||
- creator_id
|
||||
- text
|
||||
|
||||
paths:
|
||||
|
||||
/documents/by_id/{doc_id}:
|
||||
get:
|
||||
summary: Get Document
|
||||
description: |
|
||||
Retrieve a document based on its ID.
|
||||
|
||||
Example: `curl http://localhost:5000/documents/by_id/60c7453f5b72bf4ed65239ee --cookie session.cookie`
|
||||
operationId: documents_get
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found the document based on the ID.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/Document"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
"500":
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
delete:
|
||||
summary: Delete Document
|
||||
description: |
|
||||
Delete a document based on its ID.
|
||||
|
||||
This endpoint deletes a document and any annotations. It also updates any next_instances so
|
||||
that the document will not be returned for annotation in any "get next instance" calls in
|
||||
the future. It does NOT delete document data from any pipeline models or update any IAA
|
||||
reports or pipeline metrics. These will be updated next time they are requested.
|
||||
|
||||
Example: `curl -X DELETE http://localhost:5000/documents/by_id/60c7453f5b72bf4ed65239ee --cookie session.cookie`
|
||||
operationId: documents_delete
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Deletion successful, response has IDs of changed objects.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/DocumentDeletionResponse"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
"500":
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/documents/by_ids:
|
||||
delete:
|
||||
summary: Delete Documents
|
||||
description: |
|
||||
Delete documents based on their IDs.
|
||||
|
||||
This endpoint deletes documents and any associated annotations. It also updates any next_instances so
|
||||
that the documents will not be returned for annotation in any "get next instance" calls in
|
||||
the future. It does NOT delete document data from any pipeline models or update any IAA
|
||||
reports or pipeline metrics. These will be updated next time they are requested.
|
||||
|
||||
Example: `curl -X DELETE http://localhost:5000/documents/by_ids?ids=60c7453f5b72bf4ed65239ee,60c7453f5b72bf4ed65239ef --cookie session.cookie`
|
||||
operationId: documents_delete_multiple
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- name: ids
|
||||
in: query
|
||||
required: true
|
||||
description: The IDs of the document to delete, comma-separated.
|
||||
schema:
|
||||
type: string
|
||||
example: "60c7453f5b72bf4ed65239ee,60c7453f5b72bf4ed65239ef"
|
||||
responses:
|
||||
"200":
|
||||
description: Deletion successful, response has IDs of changed objects.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/DocumentDeletionResponse"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
"500":
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/documents/count_by_collection_id/{collection_id}:
|
||||
get:
|
||||
summary: Get Collection Document Count
|
||||
description: |
|
||||
Count the number of documents in a collection.
|
||||
|
||||
Example: `curl http://localhost:5000/documents/count_by_collection_id/60c7453d5b72bf4ed65239e9 --cookie session.cookie`
|
||||
operationId: documents_count_by_collection
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found collection and counted number of documents inside.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: integer
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/documents/by_collection_id_all/{collection_id}:
|
||||
get:
|
||||
summary: Get All Collection Documents
|
||||
description: |
|
||||
Get all documents that are in a collection with a given collection id.
|
||||
|
||||
Example: `curl http://localhost:5000/documents/by_collection_id_all/60c7453d5b72bf4ed65239e9 --cookie session.cookie`
|
||||
operationId: documents_get_by_collection
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found collection and retrieved all related documents.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedDocuments"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/documents/by_collection_id_paginated/{collection_id}:
|
||||
get:
|
||||
summary: Get Paginated Collection Documents
|
||||
description: |
|
||||
Get a variable page of variable size of documents.
|
||||
|
||||
Example: `curl "http://localhost:5000/documents/by_collection_id_paginated/60c7453d5b72bf4ed65239e9?page=1&pageSize=5" --cookie session.cookie`
|
||||
operationId: documents_get_by_collection_paginated
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
- name: page
|
||||
in: query
|
||||
required: true
|
||||
description: >
|
||||
The page number to get by 0 indexing (Will have documents page_num*pageSize ->
|
||||
page_num*pageSize+pageSize-1 in the collection if there are any.)
|
||||
schema:
|
||||
type: integer
|
||||
- name: pageSize
|
||||
in: query
|
||||
required: true
|
||||
description: The number of documents to put in each page.
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: >
|
||||
Successfully found collection and retrieved any (if any) associated documents (Could
|
||||
return no documents if page number too high).
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WrappedDocuments"
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/documents/user_permissions/{doc_id}:
|
||||
get:
|
||||
summary: Get User Document Permissions
|
||||
description: |
|
||||
Get the permission that the logged in user has for this document.
|
||||
|
||||
Example: `curl http://localhost:5000/documents/user_permissions/60c7453f5b72bf4ed65239ee --cookie session.cookie`
|
||||
operationId: documents_permissions
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found document and retrieved user permissions.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/UserPermissions"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/documents/metadata/{doc_id}:
|
||||
put:
|
||||
summary: Update Document Metadata
|
||||
description: |
|
||||
Change/Replace the metadata of a certain document (does not add).
|
||||
|
||||
Example: `curl -X PUT http://localhost:5000/documents/metadata/60c7453f5b72bf4ed65239ee -d '{"test":"this"}' --cookie session.cookie -H Content-Type:application/json`
|
||||
|
||||
Note: you need the content type header to specify json.
|
||||
operationId: documents_update_metadata
|
||||
tags: [documents]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
requestBody:
|
||||
description: The metadata in json form in the body.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found document and changed the metadata.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/DocumentNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/documents:
|
||||
post:
|
||||
summary: Create Document
|
||||
description: |
|
||||
Create a new document in a collection.
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/documents/ -d '{"collection_id":"6ada", "text":"blah"}' --cookie session.cookie -H Content-Type:application/json`
|
||||
operationId: documents_create
|
||||
tags: [documents]
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
oneOf:
|
||||
- $ref: "#/components/schemas/NewDocument"
|
||||
- type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/NewDocument"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully created the new document in the collection.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/IDInfo"
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
@@ -18,6 +18,7 @@ import os
|
||||
import platform
|
||||
import secrets
|
||||
import time
|
||||
import typing
|
||||
import uuid
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from datetime import datetime, timedelta
|
||||
@@ -34,6 +35,22 @@ config = ConfigBuilder.get_config()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ServiceJob(object):
|
||||
"""
|
||||
Data class for a service job.
|
||||
"""
|
||||
|
||||
def __init__(self, job_id: str, request_body: dict, request_response: dict):
|
||||
""""Constructor.
|
||||
|
||||
:param job_id: str: job ID
|
||||
:param request_body: dict: job request body
|
||||
:param request_response: dict: job request response
|
||||
"""
|
||||
self.job_id: str = job_id
|
||||
self.request_body: dict = request_body
|
||||
self.request_response: dict = request_response
|
||||
|
||||
class ServiceManager(object):
|
||||
# Redis Client
|
||||
logger.info("Using redis host {}:{}".format(config.REDIS_HOST, config.REDIS_PORT))
|
||||
@@ -48,6 +65,14 @@ class ServiceManager(object):
|
||||
redis_work_queue_key_prefix = redis_key_prefix + "work-queue:"
|
||||
redis_work_mutex_key_prefix = redis_key_prefix + "work-mutex:"
|
||||
redis_handler_mutex_key_prefix = redis_key_prefix + "handler-mutex:"
|
||||
|
||||
@classmethod
|
||||
def get_results_key(cls, service_name: str, job_id: str) -> str:
|
||||
return "{}{}:work-results:{}".format(config.REDIS_PREFIX, service_name, job_id)
|
||||
|
||||
@classmethod
|
||||
def get_running_jobs_key(cls, service_name: str) -> str:
|
||||
return "{}{}:running-jobs".format(config.REDIS_PREFIX, service_name)
|
||||
|
||||
# Redis Key TTL (Used by Expire Calls)
|
||||
|
||||
@@ -160,7 +185,38 @@ class ServiceManager(object):
|
||||
return final_values
|
||||
|
||||
@classmethod
|
||||
def send_service_request(cls, service_name, data, job_id=None, encoder=None):
|
||||
def _get_service_details(cls, service_name: str, retry_count = 10) -> dict:
|
||||
registered_services = cls.get_registered_services(include_details=False)
|
||||
retries = 1
|
||||
while service_name not in set(registered_services) and retries <= retry_count:
|
||||
logger.warning("Unable to retrieve service; sleeping 2s and trying again.")
|
||||
time.sleep(2)
|
||||
registered_services = cls.get_registered_services(include_details=False)
|
||||
retries += 1
|
||||
if service_name not in set(registered_services):
|
||||
raise Exception("Unable to retrieve service for " + service_name)
|
||||
service_details = cls.r_conn.get(cls.redis_reg_key_prefix + service_name)
|
||||
if not service_details:
|
||||
raise Exception("Unable to retrieve service details for " + service_name)
|
||||
try:
|
||||
service_details = json.loads(service_details)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
raise Exception("Unable to retrieve service details for " + service_name)
|
||||
return service_details
|
||||
|
||||
@classmethod
|
||||
def _get_service_channel(cls, service_name: str) -> str:
|
||||
service_details = cls._get_service_details(service_name)
|
||||
if service_details == None:
|
||||
return None
|
||||
service_channel = pydash.get(service_details, "channel", None)
|
||||
if not isinstance(service_channel, str):
|
||||
logger.warning("Unable to load service details.")
|
||||
return None
|
||||
return service_channel
|
||||
|
||||
@classmethod
|
||||
def send_service_request(cls, service_name: str, data, job_id=None, encoder=None):
|
||||
"""
|
||||
Queue's a job for the requested service.
|
||||
:type service_name: str
|
||||
@@ -169,22 +225,8 @@ class ServiceManager(object):
|
||||
:type encoder: json.JSONEncoder
|
||||
:rtype: None | dict
|
||||
"""
|
||||
registered_services = cls.get_registered_services(include_details=False)
|
||||
if service_name not in set(registered_services):
|
||||
logger.warning("Unable to retrieve service.")
|
||||
return None
|
||||
service_details = cls.r_conn.get(cls.redis_reg_key_prefix + service_name)
|
||||
if not service_details:
|
||||
logger.warning("Unable to retrieve service details.")
|
||||
return None
|
||||
try:
|
||||
service_details = json.loads(service_details)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
logger.warning("Unable to load service details.")
|
||||
return None
|
||||
service_channel = pydash.get(service_details, "channel", None)
|
||||
if not isinstance(service_channel, str):
|
||||
logger.warning("Unable to load service details.")
|
||||
service_channel = cls._get_service_channel(service_name)
|
||||
if service_name == None:
|
||||
return None
|
||||
redis_queue_key = cls.redis_work_queue_key_prefix + service_name
|
||||
job_id_to_use = job_id if isinstance(job_id, str) else uuid.uuid4().hex
|
||||
@@ -196,6 +238,7 @@ class ServiceManager(object):
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
logger.warning("Unable to encode data.")
|
||||
return None
|
||||
cls.r_conn.sadd(cls.get_running_jobs_key(service_name), job_id_to_use)
|
||||
with cls.r_conn.pipeline() as pipe:
|
||||
pipe.rpush(redis_queue_key, request_body_queue)
|
||||
# if nothing is processed in "redis_queue_key_ttl" minutes since last insert, the queue will be deleted
|
||||
@@ -211,6 +254,53 @@ class ServiceManager(object):
|
||||
return None
|
||||
return request_body
|
||||
|
||||
@classmethod
|
||||
def get_job_response(cls, service_name: str, job_id: str, timeout_in_s: int):
|
||||
"""
|
||||
Waits for a response for the given job and returns it.
|
||||
:param service_name: str: service name
|
||||
:param job_id: str: job ID
|
||||
:param timeout_in_s: int: wait timeout in seconds
|
||||
:rtype None | dict
|
||||
"""
|
||||
redis_queue_key = cls.get_results_key(service_name, job_id)
|
||||
logger.info("Waiting for {} seconds for a response on {}".format(timeout_in_s, redis_queue_key))
|
||||
response = cls.r_conn.blpop(redis_queue_key, timeout_in_s)
|
||||
if response:
|
||||
response = json.loads(response[1])
|
||||
return response
|
||||
|
||||
@classmethod
|
||||
def send_service_request_and_get_response(cls, service_name: str, data, timeout_in_s: int,
|
||||
job_id=None, encoder=None) -> ServiceJob:
|
||||
"""
|
||||
Sends a service requests, waits for a response, and returns job data.
|
||||
:param service_name: str: service name
|
||||
:param data: job data
|
||||
:param timeout_in_s: int: wait timeout in seconds
|
||||
:param job_id: str: optional job ID (or None to auto-generate one)
|
||||
:param encoder: optional JSON encoder for job data
|
||||
:rtype None | ServiceJob
|
||||
"""
|
||||
request_body = cls.send_service_request(service_name, data, job_id=job_id, encoder=encoder)
|
||||
if request_body == None:
|
||||
return ServiceJob(job_id=job_id,
|
||||
request_body=None,
|
||||
request_response=None)
|
||||
actual_job_id = request_body["job_id"]
|
||||
request_response = cls.get_job_response(service_name, actual_job_id, timeout_in_s)
|
||||
return ServiceJob(job_id=actual_job_id,
|
||||
request_body=request_body,
|
||||
request_response=request_response)
|
||||
|
||||
@classmethod
|
||||
def get_running_jobs(cls, service_name: str) -> typing.List[str]:
|
||||
"""Returns running jobs.
|
||||
:param service_name: str: service name
|
||||
:rtype list[str]
|
||||
"""
|
||||
return list(cls.r_conn.smembers(cls.get_running_jobs_key(service_name)))
|
||||
|
||||
def start_listeners(self):
|
||||
"""
|
||||
Starts all the workers.
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
import json
|
||||
|
||||
import logging
|
||||
|
||||
from flask import abort, Blueprint, jsonify, request
|
||||
import requests
|
||||
from werkzeug import exceptions
|
||||
from flask import abort, Blueprint, jsonify
|
||||
|
||||
from .. import auth
|
||||
from ..data import bp as data
|
||||
from ..data import service
|
||||
from ..pineiaa.bratiaa import iaa_service
|
||||
|
||||
@@ -47,7 +44,7 @@ def update_iaa_report_by_collection_id(collection_id: str) -> bool:
|
||||
else:
|
||||
return service.post("iaa_reports", json = new_report).ok
|
||||
else:
|
||||
return False
|
||||
return jsonify(False)
|
||||
|
||||
@bp.route("/by_collection_id/<collection_id>", methods=["POST"])
|
||||
@auth.login_required
|
||||
|
||||
72
backend/pine/backend/pineiaa/openapi.yaml
Normal file
72
backend/pine/backend/pineiaa/openapi.yaml
Normal file
@@ -0,0 +1,72 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
security:
|
||||
- cookieAuth: []
|
||||
|
||||
tags:
|
||||
- name: iaa_reports
|
||||
description: Operations in the "iaa_reports" blueprint.
|
||||
|
||||
paths:
|
||||
|
||||
/iaa_reports/by_collection_id/{collection_id}:
|
||||
get:
|
||||
summary: Get IAA Report for Collection
|
||||
description: |
|
||||
Get the Inter-Annotator Agreement for a specified collection.
|
||||
|
||||
Note: This will not error with an invalid collection ID, it will give no items.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/iaa_reports/by_collection_id/60df138b3f8fa7b2e1445bd7 --cookie ~/session.cookie -v`
|
||||
operationId: iaa_get
|
||||
tags: [iaa_reports]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully got collection's IAA.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
_items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/InterAnnotatorAgreement"
|
||||
_links:
|
||||
$ref: "../api/components.yaml#/schemas/EveLinks"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
post:
|
||||
summary: Create IAA Report for Collection
|
||||
description: |
|
||||
Create an Inter-Annotator-Agreement for a collection.
|
||||
|
||||
Note: This will not error with an invalid collection ID (or not enough annotators), it will
|
||||
return false.
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/iaa_reports/by_collection_id/60df138b3f8fa7b2e1445bd7 --cookie ~/session.cookie -v`
|
||||
operationId: iaa_create
|
||||
tags: [iaa_reports]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: |
|
||||
Tried to create the IAA (success or fail).
|
||||
|
||||
False means invalid collection ID or not enough annotators.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
@@ -1,18 +1,15 @@
|
||||
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
import json
|
||||
import logging
|
||||
import pydash
|
||||
import random
|
||||
import uuid
|
||||
import typing
|
||||
|
||||
from flask import abort, Blueprint, jsonify, request
|
||||
from flask import abort, Blueprint, jsonify, request, Response
|
||||
from werkzeug import exceptions
|
||||
|
||||
from .. import auth
|
||||
from .. import auth, collections, models
|
||||
from ..data import service
|
||||
from ..collections import bp as collectionsbp
|
||||
from ..job_manager.service import ServiceManager
|
||||
from ..job_manager.service import ServiceManager, ServiceJob
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
service_manager = ServiceManager()
|
||||
@@ -21,40 +18,129 @@ bp = Blueprint("pipelines", __name__, url_prefix = "/pipelines")
|
||||
|
||||
# Cache classifiers and overlap so we don't need to keep on making queries
|
||||
# we don't need to invalidate cache because we don't invalidate classifiers
|
||||
classifier_dict = {}
|
||||
classifier_pipelines = {}
|
||||
_cached_classifiers = {}
|
||||
_cached_classifier_pipelines = {}
|
||||
|
||||
def _get_classifier(classifier_id: str) -> dict:
|
||||
if classifier_id not in _cached_classifiers:
|
||||
classifier = service.get_item_by_id("/classifiers", classifier_id)
|
||||
if classifier is None:
|
||||
raise exceptions.NotFound(description="Couldn't find classifier with ID " + classifier_id)
|
||||
pipeline_id = classifier["pipeline_id"]
|
||||
pipeline = service.get_item_by_id("/pipelines", pipeline_id)
|
||||
if pipeline is None:
|
||||
raise exceptions.NotFound(description="Couldn't find pipeline with ID " + pipeline_id)
|
||||
_cached_classifiers[classifier_id] = classifier
|
||||
_cached_classifier_pipelines[classifier_id] = pipeline["name"].lower()
|
||||
return _cached_classifiers[classifier_id]
|
||||
|
||||
def _clear_classifier(classifier_id: str):
|
||||
if classifier_id in _cached_classifiers:
|
||||
del _cached_classifiers[classifier_id]
|
||||
del _cached_classifier_pipelines[classifier_id]
|
||||
|
||||
def _get_classifier_pipeline(classifier_id: str) -> dict:
|
||||
# this will populate _cached_classifier_piplines and throw exceptions if needed
|
||||
_get_classifier(classifier_id)
|
||||
return _cached_classifier_pipelines[classifier_id]
|
||||
|
||||
def _check_permissions(classifier: dict):
|
||||
collection_id: str = classifier["collection_id"]
|
||||
perms: models.CollectionUserPermissions = collections.get_user_permissions_by_id(collection_id)
|
||||
if not perms.annotate:
|
||||
raise exceptions.Unauthorized()
|
||||
|
||||
|
||||
################################
|
||||
|
||||
# Pipeline service methods
|
||||
|
||||
def _get_pipeline_status(pipeline: str, classifier_id: str) -> dict:
|
||||
job_data = {
|
||||
"type": "status",
|
||||
"framework": pipeline
|
||||
}
|
||||
if classifier_id:
|
||||
job_data["classifier_id"] = classifier_id
|
||||
job: ServiceJob = service_manager.send_service_request_and_get_response(pipeline, job_data, 20)
|
||||
return {
|
||||
"service_details": service_manager.get_registered_service_details(pipeline),
|
||||
"job_id": job.job_id,
|
||||
"job_request": job.request_body,
|
||||
"job_response": job.request_response
|
||||
}
|
||||
|
||||
def _get_pipeline_running_jobs(pipeline: str, classifier_id: str) -> typing.List[str]:
|
||||
return service_manager.get_running_jobs(pipeline)
|
||||
|
||||
def _train_pipeline(pipeline: str, classifier_id: str, model_name: str) -> dict:
|
||||
logger.info("Training pipeline='%s' classifier_id='%s' model_name='%s'", pipeline, classifier_id, model_name)
|
||||
job_data = {
|
||||
"type": "fit",
|
||||
"classifier_id": classifier_id,
|
||||
"pipeline": pipeline,
|
||||
"framework": pipeline,
|
||||
"model_name": model_name
|
||||
}
|
||||
request_body = service_manager.send_service_request(pipeline, job_data)
|
||||
return request_body
|
||||
|
||||
def _predict_pipeline(pipeline: str, classifier_id: str, document_ids: typing.List[str],
|
||||
texts: typing.List[str], timeout_in_s: int) -> dict:
|
||||
job_data = {
|
||||
"type": "predict",
|
||||
"classifier_id": classifier_id,
|
||||
"pipeline": pipeline,
|
||||
"framework": pipeline,
|
||||
"document_ids": document_ids,
|
||||
"texts": texts
|
||||
}
|
||||
job: ServiceJob = service_manager.send_service_request_and_get_response(
|
||||
pipeline, job_data, timeout_in_s)
|
||||
return {
|
||||
"job_id": job.job_id,
|
||||
"job_request": job.request_body,
|
||||
"job_response": job.request_response
|
||||
}
|
||||
|
||||
################################
|
||||
|
||||
# Pipeline endpoints
|
||||
|
||||
@bp.route("/", strict_slashes = False, methods = ["GET"])
|
||||
@auth.login_required
|
||||
def get_pipelines():
|
||||
resp = service.get("pipelines")
|
||||
if not resp.ok:
|
||||
abort(resp.status_code)
|
||||
return service.convert_response(resp)
|
||||
# no permissions check needed; everyone can see pipelines
|
||||
return service.convert_response(service.get("pipelines"))
|
||||
|
||||
@bp.route("/by_id/<pipeline_id>", methods = ["GET"])
|
||||
def get_pipeline_by_id(pipeline_id):
|
||||
resp = service.get("pipelines/" + pipeline_id)
|
||||
return service.convert_response(resp)
|
||||
@bp.route("/by_id/<pipeline_id>", methods=["GET"])
|
||||
def get_pipeline_by_id(pipeline_id: str):
|
||||
# no permissions check needed; everyone can see pipelines
|
||||
return service.convert_response(service.get("pipelines/" + pipeline_id))
|
||||
|
||||
def _get_collection_classifier(collection_id):
|
||||
where = {
|
||||
"collection_id": collection_id
|
||||
}
|
||||
classifiers = service.get_all_items("/classifiers", params=service.where_params(where))
|
||||
if len(classifiers) != 1:
|
||||
raise exceptions.BadRequest(description="Expected one classifier but found {}.".format(len(classifiers)))
|
||||
return classifiers[0]
|
||||
@bp.route("/status/<pipeline_id>", methods=["GET"])
|
||||
def get_pipeline_status(pipeline_id: str) -> Response:
|
||||
# no permissions check needed; everyone can see pipelines
|
||||
pipeline = service.get_item_by_id("pipelines", pipeline_id)
|
||||
if not pipeline:
|
||||
raise exceptions.NotFound()
|
||||
pipeline = pipeline["name"].lower()
|
||||
return jsonify(_get_pipeline_status(pipeline, None))
|
||||
|
||||
################################
|
||||
|
||||
@bp.route("/classifiers/by_collection_id/<collection_id>", methods=["GET"])
|
||||
@auth.login_required
|
||||
def get_collection_classifier(collection_id):
|
||||
return jsonify(_get_collection_classifier(collection_id))
|
||||
# Metrics endpoints
|
||||
|
||||
# @bp.route("/metrics", methods=["GET"])
|
||||
# @auth.login_required
|
||||
# def get_metrics():
|
||||
# resp = service.get("metrics")
|
||||
# if not resp.ok:
|
||||
# abort(resp.status_code)
|
||||
# return service.convert_response(resp)
|
||||
|
||||
def _get_classifier_metrics(classifier_id):
|
||||
def _get_classifier_metrics(classifier_id: str):
|
||||
_check_permissions(_get_classifier(classifier_id))
|
||||
where = {
|
||||
"classifier_id": classifier_id
|
||||
}
|
||||
@@ -66,57 +152,108 @@ def _get_classifier_metrics(classifier_id):
|
||||
logger.info(all_metrics)
|
||||
return all_metrics
|
||||
|
||||
@bp.route("/metrics", methods=["GET"])
|
||||
@auth.login_required
|
||||
def get_metrics():
|
||||
resp = service.get("metrics")
|
||||
if not resp.ok:
|
||||
abort(resp.status_code)
|
||||
return service.convert_response(resp)
|
||||
|
||||
|
||||
@bp.route("/metrics/by_classifier_id/<classifier_id>", methods=["GET"])
|
||||
# @auth.login_required
|
||||
def get_classifier_metrics(classifier_id):
|
||||
@auth.login_required
|
||||
def get_classifier_metrics(classifier_id: str):
|
||||
return jsonify(_get_classifier_metrics(classifier_id))
|
||||
|
||||
################################
|
||||
|
||||
def _get_classifier(classifier_id):
|
||||
classifier = service.get_item_by_id("/classifiers", classifier_id)
|
||||
if classifier is None:
|
||||
return False
|
||||
else:
|
||||
pipeline = service.get_item_by_id("/pipelines", classifier["pipeline_id"])
|
||||
if pipeline is None:
|
||||
return False
|
||||
else:
|
||||
classifier_dict[classifier_id] = classifier
|
||||
classifier_pipelines[classifier_id] = pipeline["name"].lower()
|
||||
return True
|
||||
# Classifier endpoints
|
||||
|
||||
def _get_collection_classifier(collection_id: str) -> dict:
|
||||
where = {
|
||||
"collection_id": collection_id
|
||||
}
|
||||
classifiers = service.get_all_items("/classifiers", params=service.where_params(where))
|
||||
if len(classifiers) != 1:
|
||||
raise exceptions.BadRequest(description="Expected one classifier but found {}.".format(len(classifiers)))
|
||||
return classifiers[0]
|
||||
|
||||
def _get_next_instance(classifier_id):
|
||||
if classifier_id not in classifier_dict:
|
||||
if not _get_classifier(classifier_id):
|
||||
raise exceptions.NotFound(description = "Classifier not found: could not load classifier.")
|
||||
@bp.route("/classifiers/by_collection_id/<collection_id>", methods=["GET"])
|
||||
@auth.login_required
|
||||
def get_collection_classifier(collection_id: str):
|
||||
classifier = _get_collection_classifier(collection_id)
|
||||
_check_permissions(classifier)
|
||||
return jsonify(classifier)
|
||||
|
||||
@bp.route("/classifiers/status/<classifier_id>", methods = ["GET"])
|
||||
@auth.login_required
|
||||
def get_classifier_status(classifier_id: str):
|
||||
classifier = _get_classifier(classifier_id)
|
||||
_check_permissions(classifier)
|
||||
pipeline = _get_classifier_pipeline(classifier_id)
|
||||
return jsonify(_get_pipeline_status(pipeline, classifier_id))
|
||||
|
||||
################################
|
||||
|
||||
# Classifier endpoints
|
||||
|
||||
@bp.route("/running_jobs/<classifier_id>", methods=["GET"])
|
||||
@auth.login_required
|
||||
def get_running_jobs(classifier_id: str):
|
||||
classifier = _get_classifier(classifier_id)
|
||||
_check_permissions(classifier)
|
||||
pipeline = _get_classifier_pipeline(classifier_id)
|
||||
return jsonify(_get_pipeline_running_jobs(pipeline, classifier_id))
|
||||
|
||||
@bp.route("/train/<classifier_id>", methods=["POST"])
|
||||
def train(classifier_id: str):
|
||||
input_json = request.get_json()
|
||||
model_name = input_json["model_name"] if "model_name" in input_json else None
|
||||
|
||||
classifier = _get_classifier(classifier_id)
|
||||
_check_permissions(classifier)
|
||||
pipeline = _get_classifier_pipeline(classifier_id)
|
||||
|
||||
return jsonify({
|
||||
"request": _train_pipeline(pipeline, classifier_id, model_name)
|
||||
})
|
||||
|
||||
@bp.route("/predict/<classifier_id>", methods=["POST"])
|
||||
@auth.login_required
|
||||
def predict(classifier_id: str):
|
||||
input_json = request.get_json()
|
||||
document_ids = input_json.get("document_ids", [])
|
||||
texts = input_json.get("texts", [])
|
||||
timeout_in_s = input_json.get("timeout_in_s", 36000) # 10 hours
|
||||
|
||||
if not isinstance(document_ids, list) or not isinstance(texts, list):
|
||||
abort(400, "Error parsing input", custom="document_ids and texts must be lists")
|
||||
if len(document_ids) == 0 and len(texts) == 0:
|
||||
abort(400, "Error parsing input", custom="At least one of document_ids and texts must be non-empty")
|
||||
for document_id in document_ids:
|
||||
if not isinstance(document_id, str):
|
||||
abort(400, "Error parsing input", custom="Document IDs must be strings")
|
||||
for text in texts:
|
||||
if not isinstance(text, str):
|
||||
abort(400, "Error parsing input", custom="Texts must be strings")
|
||||
if not isinstance(timeout_in_s, int):
|
||||
abort(400, "Error parsing input", custom="timeout_in_s must be an int")
|
||||
|
||||
classifier = _get_classifier(classifier_id)
|
||||
_check_permissions(classifier)
|
||||
pipeline = _get_classifier_pipeline(classifier_id)
|
||||
|
||||
# TODO check that user has permissions for each of the given document IDs
|
||||
|
||||
return _predict_pipeline(pipeline, classifier_id, document_ids, texts, timeout_in_s)
|
||||
|
||||
################################
|
||||
|
||||
# Next instance endpointsrip
|
||||
|
||||
def _get_next_instance(classifier_id: str):
|
||||
_check_permissions(_get_classifier(classifier_id))
|
||||
items = service.get_all_items("/next_instances", params=service.where_params({"classifier_id": classifier_id}))
|
||||
# r = requests.get(ENTRY_POINT + '/next_instances?where={"classifier_id":"' + classifier_id + '"}',
|
||||
# headers=EVE_HEADERS)
|
||||
# items = get_items_from_response(r)["_items"]
|
||||
if len(items) == 0:
|
||||
raise exceptions.NotFound("No next instances")
|
||||
raise exceptions.NotFound(description="No next instances")
|
||||
return items[0]
|
||||
|
||||
|
||||
@bp.route("/next_document/by_classifier_id/<classifier_id>", methods = ["GET"])
|
||||
@auth.login_required
|
||||
def get_next_by_classifier(classifier_id):
|
||||
instance = _get_next_instance(classifier_id)
|
||||
user_id = auth.get_logged_in_user()["id"]
|
||||
|
||||
def _check_instance_overlap(classifier: dict, instance: dict, user_id: str):
|
||||
if user_id not in instance["overlap_document_ids"]:
|
||||
logger.info("new user: adding to overlap document ids")
|
||||
instance["overlap_document_ids"][user_id] = collectionsbp.get_overlap_ids(classifier_dict[classifier_id]["collection_id"])
|
||||
instance["overlap_document_ids"][user_id] = collections.get_overlap_ids(classifier["collection_id"])
|
||||
to_patch = {
|
||||
"_id": instance["_id"],
|
||||
"overlap_document_ids": instance["overlap_document_ids"]
|
||||
@@ -126,7 +263,17 @@ def get_next_by_classifier(classifier_id):
|
||||
if not r.ok:
|
||||
abort(r.status_code, r.content)
|
||||
|
||||
if random.random() <= classifier_dict[classifier_id]["overlap"] and len(instance["overlap_document_ids"][user_id]) > 0:
|
||||
@bp.route("/next_document/by_classifier_id/<classifier_id>", methods = ["GET"])
|
||||
@auth.login_required
|
||||
def get_next_by_classifier(classifier_id: str):
|
||||
instance = _get_next_instance(classifier_id)
|
||||
classifier = _get_classifier(classifier_id)
|
||||
_check_permissions(classifier)
|
||||
|
||||
user_id = auth.get_logged_in_user()["id"]
|
||||
_check_instance_overlap(classifier, instance, user_id)
|
||||
|
||||
if random.random() <= classifier["overlap"] and len(instance["overlap_document_ids"][user_id]) > 0:
|
||||
return jsonify(instance["overlap_document_ids"][user_id].pop())
|
||||
elif len(instance["document_ids"]) > 0:
|
||||
return jsonify(instance["document_ids"].pop())
|
||||
@@ -135,26 +282,21 @@ def get_next_by_classifier(classifier_id):
|
||||
else:
|
||||
return jsonify(None)
|
||||
|
||||
|
||||
@bp.route("/next_document/by_classifier_id/<classifier_id>/<document_id>", methods = ["POST"])
|
||||
@auth.login_required
|
||||
def advance_to_next_document_by_classifier(classifier_id, document_id):
|
||||
def advance_to_next_document_by_classifier(classifier_id: str, document_id: str):
|
||||
user_id = auth.get_logged_in_user()["id"]
|
||||
|
||||
# get stored next data
|
||||
if classifier_id not in classifier_dict:
|
||||
if not _get_classifier(classifier_id):
|
||||
raise exceptions.NotFound(description="Classifier not found: could not load classifier.")
|
||||
else:
|
||||
# reset classifier_dict for classifier, cached classifiers are getting out of sync
|
||||
del classifier_dict[classifier_id]
|
||||
if not _get_classifier(classifier_id):
|
||||
raise exceptions.NotFound(description="Classifier not found: could not load classifier.")
|
||||
logger.debug(classifier_dict[classifier_id])
|
||||
pipeline = pydash.get(classifier_pipelines, classifier_id, None)
|
||||
if pipeline is None:
|
||||
return jsonify("Error, pipeline not found"), 500
|
||||
# reset classifier_dict for classifier, cached classifiers are getting out of sync
|
||||
_clear_classifier(classifier_id)
|
||||
|
||||
classifier = _get_classifier(classifier_id)
|
||||
_check_permissions(classifier)
|
||||
|
||||
pipeline = _get_classifier_pipeline(classifier_id)
|
||||
instance = _get_next_instance(classifier_id)
|
||||
|
||||
_check_instance_overlap(classifier, instance, user_id)
|
||||
|
||||
data = None
|
||||
trained = False
|
||||
@@ -176,73 +318,29 @@ def advance_to_next_document_by_classifier(classifier_id, document_id):
|
||||
if not r.ok:
|
||||
abort(r.status_code, r.content)
|
||||
|
||||
classifier_dict[classifier_id]["annotated_document_count"] += 1
|
||||
headers = {"If-Match": classifier_dict[classifier_id]["_etag"]}
|
||||
service.remove_nonupdatable_fields(classifier_dict[classifier_id])
|
||||
r = service.patch(["classifiers", classifier_id], json=classifier_dict[classifier_id], headers=headers)
|
||||
classifier["annotated_document_count"] += 1
|
||||
headers = {"If-Match": classifier["_etag"]}
|
||||
service.remove_nonupdatable_fields(classifier)
|
||||
r = service.patch(["classifiers", classifier_id], json=classifier, headers=headers)
|
||||
if not r.ok:
|
||||
abort(r.status_code, r.content)
|
||||
del classifier_dict[classifier_id]
|
||||
if not _get_classifier(classifier_id):
|
||||
raise exceptions.NotFound(description="Classifier not found: could not load classifier.")
|
||||
_clear_classifier(classifier_id)
|
||||
classifier = _get_classifier(classifier_id)
|
||||
|
||||
if classifier_dict[classifier_id]["annotated_document_count"] % classifier_dict[classifier_id]["train_every"] == 0:
|
||||
if classifier["annotated_document_count"] % classifier["train_every"] == 0:
|
||||
## Check to see if we should update classifier
|
||||
## Add to work queue to update classifier - queue is pipeline_id
|
||||
## ADD TO PUBSUB {classifier_id} to reload
|
||||
logger.info("training")
|
||||
job_data = {'classifier_id': classifier_id, 'pipeline': pipeline, 'type': 'fit', 'framework': pipeline,
|
||||
'model_name': 'auto-trained'}
|
||||
request_body = service_manager.send_service_request(pipeline, job_data)
|
||||
request_body = _train_pipeline(pipeline, classifier_id, "auto-trained")
|
||||
trained = True
|
||||
|
||||
return jsonify({"success": True, "trained": trained, "body": request_body})
|
||||
|
||||
|
||||
@bp.route("/predict", methods=["POST"])
|
||||
@auth.login_required
|
||||
def predict():
|
||||
try:
|
||||
input_json = request.get_json()
|
||||
classifier_id = input_json["classifier_id"]
|
||||
documents = input_json["documents"]
|
||||
docids = input_json["document_ids"]
|
||||
except Exception as e:
|
||||
abort(400, "Error parsing input", custom="Input JSON could not be read:" + str(e))
|
||||
|
||||
if classifier_id not in classifier_dict:
|
||||
if not _get_classifier(classifier_id):
|
||||
raise exceptions.NotFound(description = "Classifier not found: could not load classifier.")
|
||||
pipeline_id = classifier_dict[classifier_id]["pipeline_id"]
|
||||
##enqueue documents and ids - CHECK THIS MAY NOT WORK!
|
||||
key = "{}:result:{}".format(pipeline_id, uuid.uuid4())
|
||||
service_manager.send_service_request(pipeline_id, json.dumps({"type": "predict", "documents": documents,
|
||||
"document_ids": docids, "classifier_id": classifier_id,
|
||||
"response_key": key}))
|
||||
# alternatively use session key but might need more work to integrate with authentication, nginx
|
||||
# session["predict_result_key"] = key
|
||||
return jsonify({"response_key": key})
|
||||
|
||||
|
||||
@bp.route("/train", methods=["POST"])
|
||||
def test_redis():
|
||||
# try:
|
||||
input_json = request.get_json()
|
||||
classifier_id = pydash.get(input_json, "classifier_id", None)
|
||||
# get classifier and pipeline
|
||||
if classifier_id not in classifier_dict:
|
||||
if not _get_classifier(classifier_id):
|
||||
return jsonify("Error, classifier not found"), 500
|
||||
pipeline = pydash.get(classifier_pipelines, classifier_id, None)
|
||||
if pipeline is None:
|
||||
return jsonify("Error, pipeline not found"), 500
|
||||
model_name = pydash.get(input_json, "model_name", None)
|
||||
logger.info(service_manager.get_registered_channels())
|
||||
job_data = {'classifier_id': classifier_id, 'pipeline': pipeline, 'type': 'fit', 'framework': pipeline,
|
||||
'model_name': model_name}
|
||||
request_body = service_manager.send_service_request(pipeline, job_data)
|
||||
return jsonify({"request": request_body})
|
||||
return jsonify({
|
||||
"success": True,
|
||||
"trained": trained,
|
||||
"body": request_body
|
||||
})
|
||||
|
||||
################################
|
||||
|
||||
def init_app(app):
|
||||
service_manager.start_listeners()
|
||||
|
||||
541
backend/pine/backend/pipelines/openapi.yaml
Normal file
541
backend/pine/backend/pipelines/openapi.yaml
Normal file
@@ -0,0 +1,541 @@
|
||||
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
|
||||
|
||||
openapi: "3.0.2"
|
||||
|
||||
security:
|
||||
- cookieAuth: []
|
||||
|
||||
tags:
|
||||
- name: pipelines
|
||||
description: Operations in the "pipelines" blueprint.
|
||||
|
||||
components:
|
||||
|
||||
schemas:
|
||||
|
||||
Classifier:
|
||||
allOf:
|
||||
- $ref: "../api/components.yaml#/schemas/EveBaseWithVersion"
|
||||
- type: object
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
_created:
|
||||
type: string
|
||||
format: date-time
|
||||
_updated:
|
||||
type: string
|
||||
format: date-time
|
||||
annotated_document_count:
|
||||
type: integer
|
||||
collection_id:
|
||||
type: string
|
||||
labels:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
overlap:
|
||||
type: number
|
||||
format: double
|
||||
parameters:
|
||||
type: object
|
||||
additionalProperties: {}
|
||||
pipeline_id:
|
||||
type: string
|
||||
train_every:
|
||||
type: integer
|
||||
|
||||
PipelineJobRequest:
|
||||
description: The job request data submitted to pipelines.
|
||||
type: object
|
||||
properties:
|
||||
job_id:
|
||||
description: The ID of this pipeline job.
|
||||
type: string
|
||||
format: uuid
|
||||
job_queue:
|
||||
type: string
|
||||
job_type:
|
||||
type: string
|
||||
job_data:
|
||||
type: object
|
||||
properties:
|
||||
framework:
|
||||
type: string
|
||||
type:
|
||||
description: The type of job.
|
||||
type: string
|
||||
classifier_id:
|
||||
type: string
|
||||
nullable: true
|
||||
additionalProperties:
|
||||
description: Any additional job parameters.
|
||||
|
||||
PipelineOrClassifierStatus:
|
||||
type: object
|
||||
properties:
|
||||
service_details:
|
||||
description: Information about the pipeline service.
|
||||
type: object
|
||||
properties:
|
||||
channel:
|
||||
type: string
|
||||
framework:
|
||||
type: string
|
||||
framework_types:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
format: version
|
||||
job_id:
|
||||
description: The ID of this pipeline job.
|
||||
type: string
|
||||
format: uuid
|
||||
job_request:
|
||||
$ref: "#/components/schemas/PipelineJobRequest"
|
||||
job_response:
|
||||
description: The job request data received from pipelines.
|
||||
type: object
|
||||
properties:
|
||||
pipeline_name:
|
||||
type: string
|
||||
eve_entry_point:
|
||||
type: string
|
||||
model_dir:
|
||||
type: string
|
||||
format: path
|
||||
classifier:
|
||||
description: Status of the classifier.
|
||||
type: object
|
||||
has_trained:
|
||||
description: Whether the classifier has trained.
|
||||
type: boolean
|
||||
classifier_id:
|
||||
description: Will not be present for pipeline status.
|
||||
type: string
|
||||
nullable: true
|
||||
classifier_class:
|
||||
description: Python class for this classifier.
|
||||
type: string
|
||||
|
||||
PipelinePredictParameters:
|
||||
description: Either document_ids or texts must be given and non-empty.
|
||||
type: object
|
||||
properties:
|
||||
document_ids:
|
||||
description: IDs of documents to predict annotations for.
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
default: []
|
||||
texts:
|
||||
description: Text of documents to predict annotations for.
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
default: []
|
||||
timeout_in_s:
|
||||
description: If provided, will wait this long before timing out on the job.
|
||||
type: integer
|
||||
default: 36000
|
||||
|
||||
PipelineDocumentPredictions:
|
||||
type: object
|
||||
properties:
|
||||
doc:
|
||||
description: Document-level annotations.
|
||||
type: array
|
||||
items:
|
||||
description: Annotation label.
|
||||
type: string
|
||||
example: [label1, label2]
|
||||
ner:
|
||||
description: NER annotations. [startIndex, endIndex, label].
|
||||
type: array
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: string
|
||||
- type: integer
|
||||
example: [5, 10, label1]
|
||||
|
||||
PipelinePredictions:
|
||||
description: Pipeline predictions and other job information.
|
||||
type: object
|
||||
properties:
|
||||
job_id:
|
||||
type: string
|
||||
format: uuid
|
||||
job_request:
|
||||
$ref: "#/components/schemas/PipelineJobRequest"
|
||||
job_response:
|
||||
type: object
|
||||
properties:
|
||||
documents_by_id:
|
||||
description: Predictions in a mapping from document ID to annotations.
|
||||
type: object
|
||||
additionalProperties:
|
||||
$ref: "#/components/schemas/PipelineDocumentPredictions"
|
||||
texts:
|
||||
description: Predictions for manual texts in the same order as they were in the input.
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/PipelineDocumentPredictions"
|
||||
|
||||
paths:
|
||||
|
||||
/pipelines:
|
||||
get:
|
||||
summary: Get Pipelines
|
||||
description: |
|
||||
Get all pipelines.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/ --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_all
|
||||
tags: [pipelines]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully got pipelines.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
_items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/Pipeline"
|
||||
_links:
|
||||
$ref: "../api/components.yaml#/schemas/EveLinks"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/by_id/{pipeline_id}:
|
||||
get:
|
||||
summary: Get Pipeline
|
||||
description: |
|
||||
Get the pipeline with the given ID.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/by_id/5babb6ee4eb7dd2c39b9671f --cookie ~/session.cookie -v`
|
||||
operationId: pipelines_get
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/pipelineIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully got specified pipeline.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../api/components.yaml#/schemas/Pipeline"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/PipelineNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/classifiers/by_collection_id/{collection_id}:
|
||||
get:
|
||||
summary: Get Collection Classifier
|
||||
description: |
|
||||
Get the classifier information for a collection.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/classifiers/by_collection_id/60db2cacdbfddb3ca87c845d --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_collection_classifier
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/collectionIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully found collection and got information.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Classifier"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/CollectionNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/metrics:
|
||||
get:
|
||||
summary: Get Collection Metrics
|
||||
description: |
|
||||
Get metrics for all available collections.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/metrics --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_metrics
|
||||
tags: [pipelines]
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully got metrics.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
_items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/CollectionMetric"
|
||||
_links:
|
||||
$ref: "../api/components.yaml#/schemas/EveLinks"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/metrics/by_classifier_id/{classifier_id}:
|
||||
get:
|
||||
summary: Get Classifier Metrics
|
||||
description: |
|
||||
Get metric by classifier id.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/metrics/by_classifier_id/60df138b3f8fa7b2e1445bd8 --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_classifier_metrics
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/classifierIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Successfully got metric(s).
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
_items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "../api/components.yaml#/schemas/CollectionMetric"
|
||||
_links:
|
||||
$ref: "../api/components.yaml#/schemas/EveLinks"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/ClassifierNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/next_document/by_classifier_id/{classifier_id}:
|
||||
get:
|
||||
summary: Get Next Document to Annotate
|
||||
description: |
|
||||
Get the next document id to annotate based on classifier id (or null if no un-annotated
|
||||
documents).
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/next_document/by_classifier_id/60df138b3f8fa7b2e1445bd8 --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_next_document
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/classifierIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Got ID of next document to annotate, or null if all are complete.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
nullable: true
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/ClassifierNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/next_document/by_classifier_id/{classifier_id}/{doc_id}:
|
||||
post:
|
||||
summary: Advance Next Document
|
||||
description: |
|
||||
Advance to next document by marking the given one as annotated.
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/pipelines/next_document/by_classifier_id/60df138b3f8fa7b2e1445bd8/60df13d73f8fa7b2e1445bdd --cookie ~/session.cookie`
|
||||
|
||||
This will still give you a valid response with an invalid document ID.
|
||||
operationId: pipelines_advance_next_document
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/classifierIdParam"
|
||||
- $ref: "../api/components.yaml#/parameters/docIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Complete annotations on document.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
body:
|
||||
type: object
|
||||
nullable: true
|
||||
success:
|
||||
type: boolean
|
||||
trained:
|
||||
type: boolean
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/ClassifierNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/status/{pipeline_id}:
|
||||
get:
|
||||
summary: Get Pipeline Status
|
||||
description: |
|
||||
Get the status of the pipeline with the given ID.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/status/60df138b3f8fa7b2e1445bd8 --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_status
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/pipelineIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Returns the status for the given pipeline.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/PipelineOrClassifierStatus"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/PipelineNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/classifiers/status/{classifier_id}:
|
||||
get:
|
||||
summary: Get Classifier Status
|
||||
description: |
|
||||
Get the status of the classifier with the given ID.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/classifiers/status/60df138b3f8fa7b2e1445bd8 --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_classifier_status
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/classifierIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Returns the status for the given classifier.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/PipelineOrClassifierStatus"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/ClassifierNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/running_jobs/{classifier_id}:
|
||||
get:
|
||||
summary: Get Classifier Running Jobs
|
||||
description: |
|
||||
Get any currently running jobs of the classifier with the given ID.
|
||||
|
||||
Example: `curl -X GET http://localhost:5000/pipelines/running_jobs/60df138b3f8fa7b2e1445bd8 --cookie ~/session.cookie`
|
||||
operationId: pipelines_get_running_jobs
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/classifierIdParam"
|
||||
responses:
|
||||
"200":
|
||||
description: Returns the all currently running jobs for the classifier.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
format: uuid
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/ClassifierNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/train/{classifier_id}:
|
||||
post:
|
||||
summary: Train Classifier
|
||||
description: |
|
||||
Trains the classifier based on currently annotated documents in the collection.
|
||||
|
||||
This endpoint is _ASYNCHRONOUS_ in that it will return information about the submitted job
|
||||
rather than any results from the job.
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/pipelines/train/60df138b3f8fa7b2e1445bd8 --cookie session.cookie`
|
||||
operationId: pipelines_train
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/classifierIdParam"
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
model_name:
|
||||
description: Optional name to save the model for future reference.
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Returns the all currently running jobs for the classifier.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
request:
|
||||
$ref: "#/components/schemas/PipelineJobRequest"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/ClassifierNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
|
||||
/pipelines/predict/{classifier_id}:
|
||||
post:
|
||||
summary: Predict Using Classifier
|
||||
description: |
|
||||
Uses the given classifier to predict annotations for the given document(s).
|
||||
|
||||
Example: `curl -X POST http://localhost:5000/pipelines/predict/60df138b3f8fa7b2e1445bd8 --cookie session.cookie`
|
||||
operationId: pipelines_predict
|
||||
tags: [pipelines]
|
||||
parameters:
|
||||
- $ref: "../api/components.yaml#/parameters/classifierIdParam"
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/PipelinePredictParameters"
|
||||
responses:
|
||||
"200":
|
||||
description: Returns the predictions and other job information.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/PipelinePredictions"
|
||||
"400":
|
||||
$ref: "../api/components.yaml#/responses/InvalidInputParameters"
|
||||
"401":
|
||||
$ref: "../api/components.yaml#/responses/NotAuthorized"
|
||||
"404":
|
||||
$ref: "../api/components.yaml#/responses/ClassifierNotFound"
|
||||
default:
|
||||
$ref: "../api/components.yaml#/responses/UnexpectedServerError"
|
||||
@@ -71,7 +71,7 @@ class BaseConfig(object):
|
||||
channel="service_corenlp",
|
||||
service=dict(
|
||||
framework="corenlp",
|
||||
types=["fit", "predict"]
|
||||
types=["fit", "predict", "status"]
|
||||
)
|
||||
),
|
||||
dict(
|
||||
@@ -80,7 +80,7 @@ class BaseConfig(object):
|
||||
channel="service_opennlp",
|
||||
service=dict(
|
||||
framework="opennlp",
|
||||
types=["fit", "predict"]
|
||||
types=["fit", "predict", "status"]
|
||||
)
|
||||
),
|
||||
dict(
|
||||
@@ -89,7 +89,7 @@ class BaseConfig(object):
|
||||
channel="service_spacy",
|
||||
service=dict(
|
||||
framework="spacy",
|
||||
types=["fit", "predict"]
|
||||
types=["fit", "predict", "status"]
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
@@ -587,6 +587,16 @@ class PineClient(BaseClient):
|
||||
self._check_login()
|
||||
return self.get("pipelines").json()[models.ITEMS_FIELD]
|
||||
|
||||
def get_pipeline_status(self, pipeline_id: str) -> dict:
|
||||
"""Returns status for the given pipeline.
|
||||
|
||||
:param pipeline_id: str: pipeline ID
|
||||
:returns: pipeline status
|
||||
:rtype: dict
|
||||
"""
|
||||
self._check_login()
|
||||
return self.get(["pipelines", "status", pipeline_id]).json()
|
||||
|
||||
def collection_builder(self, **kwargs: dict) -> models.CollectionBuilder:
|
||||
r"""Makes and returns a new :py:class:`.models.CollectionBuilder` with the logged in user.
|
||||
|
||||
@@ -618,6 +628,17 @@ class PineClient(BaseClient):
|
||||
raise exceptions.PineClientValueException(builder, "collection")
|
||||
return self.post("collections", data=builder.form_json, files=builder.files).json()[models.ID_FIELD]
|
||||
|
||||
def archive_collection(self, collection_id: str, archive: bool = True) -> dict:
|
||||
"""Archives or unarchives the given collection.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
:param archive: bool: whether to archive (True) or unarchive (False) the collection
|
||||
:returns: updated collection information
|
||||
:rtype: dict
|
||||
"""
|
||||
self._check_login()
|
||||
return self.put(["collections", "archive" if archive else "unarchive", collection_id]).json()
|
||||
|
||||
def get_collection_permissions(self, collection_id: str) -> models.CollectionUserPermissions:
|
||||
"""Returns collection permissions for the logged in user.
|
||||
|
||||
@@ -644,11 +665,54 @@ class PineClient(BaseClient):
|
||||
:returns: all the documents in the given collection
|
||||
:rtype: list(dict)
|
||||
"""
|
||||
self._check_login()
|
||||
return self.get(["documents", "by_collection_id_all", collection_id], params={
|
||||
"truncate": json.dumps(truncate),
|
||||
"truncateLength": json.dumps(truncate_length)
|
||||
}).json()["_items"]
|
||||
|
||||
def get_collection_classifier(self, collection_id: str) -> dict:
|
||||
"""Returns the classifier associated with the given collection.
|
||||
|
||||
:param collection_id: the ID of the collection
|
||||
:type collection_id: str
|
||||
|
||||
:returns: the classifier associated with the given collection
|
||||
:rtype: dict
|
||||
"""
|
||||
self._check_login()
|
||||
return self.get(["pipelines", "classifiers", "by_collection_id", collection_id]).json()
|
||||
|
||||
def get_next_document(self, classifier_id: str) -> str:
|
||||
"""Returns the 'next' document associated with the given classifier.
|
||||
|
||||
The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.
|
||||
|
||||
:param classifier_id: str: ID of the classifier
|
||||
:returns: the next document ID, or None if there are none left to annotate
|
||||
:rtype: str
|
||||
"""
|
||||
self._check_login()
|
||||
return self.get(["pipelines", "next_document", "by_classifier_id", classifier_id]).json()
|
||||
|
||||
def advance_next_document(self, classifier_id: str, document_id: str) -> dict:
|
||||
"""Advances the 'next' document associated with the given classifier by marking the
|
||||
given document as annotated.
|
||||
|
||||
The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.
|
||||
|
||||
:param classifier_id: str: ID of the classifier
|
||||
:param document_id: str: the ID of the document that was annotated
|
||||
:returns: information on the advanced instance
|
||||
:rtype: dict
|
||||
"""
|
||||
self._check_login()
|
||||
return self.post([
|
||||
"pipelines", "next_document", "by_classifier_id", classifier_id, document_id
|
||||
]).json()
|
||||
|
||||
def add_document(self, document: dict = {}, creator_id: str = None, collection_id: str = None,
|
||||
overlap: int = None, text: str = None, metadata: dict = None) -> str:
|
||||
"""Adds a new document to a collection and returns its ID.
|
||||
@@ -818,6 +882,42 @@ class PineClient(BaseClient):
|
||||
"update_iaa": json.dumps(update_iaa)
|
||||
}).json()
|
||||
|
||||
def get_my_document_annotations(self, document_id: str) -> typing.List[typing.List[dict]]:
|
||||
"""Returns annotations for the given document for the logged in user.
|
||||
|
||||
:param document_id: the ID of the document to get annotations for
|
||||
:type collection_id: str
|
||||
|
||||
:raises exceptions.PineClientValueException: if the document ID is not a valid string
|
||||
:raises exceptions.PineClientAuthException: if not logged in
|
||||
:raises exceptions.PineClientHttpException: if the HTTP request returns an error
|
||||
|
||||
:returns: the annotations for the given document for the logged in user
|
||||
:rtype: list(list(dict))
|
||||
"""
|
||||
self._check_login()
|
||||
if not document_id or not isinstance(document_id, str):
|
||||
raise exceptions.PineClientValueException(document_id, "str")
|
||||
return self.get(["annotations", "mine", "by_document_id", document_id]).json()["_items"]
|
||||
|
||||
def get_others_document_annotations(self, document_id: str) -> typing.List[typing.List]:
|
||||
"""Returns annotations for the given document for users other than the logged in user.
|
||||
|
||||
:param document_id: the ID of the document to get annotations for
|
||||
:type collection_id: str
|
||||
|
||||
:raises exceptions.PineClientValueException: if the document ID is not a valid string
|
||||
:raises exceptions.PineClientAuthException: if not logged in
|
||||
:raises exceptions.PineClientHttpException: if the HTTP request returns an error
|
||||
|
||||
:returns: the annotations for the given document for users other than the logged in user
|
||||
:rtype: list(list(dict))
|
||||
"""
|
||||
self._check_login()
|
||||
if not document_id or not isinstance(document_id, str):
|
||||
raise exceptions.PineClientValueException(document_id, "str")
|
||||
return self.get(["annotations", "others", "by_document_id", document_id]).json()["_items"]
|
||||
|
||||
def list_collections(self, include_archived: bool = False) -> typing.List[dict]:
|
||||
"""Returns a list of user's collections.
|
||||
|
||||
@@ -838,6 +938,15 @@ class PineClient(BaseClient):
|
||||
models.remove_eve_fields(col, remove_timestamps=False)
|
||||
return cols
|
||||
|
||||
def get_collection(self, collection_id: str) -> dict:
|
||||
"""Returns the collection with the given ID.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
:returns: the collection data
|
||||
:rtype: dict
|
||||
"""
|
||||
return self.get(["collections", "by_id", collection_id]).json()
|
||||
|
||||
def get_collection_iaa_report(self, collection_id: str) -> dict:
|
||||
"""Returns IAA (inter-annotation agreement) report for the given collection.
|
||||
|
||||
@@ -891,6 +1000,82 @@ class PineClient(BaseClient):
|
||||
"include_annotation_latest_version_only": json.dumps(include_annotation_latest_version_only)
|
||||
}).json()
|
||||
|
||||
def get_classifier_status(self, classifier_id: str) -> dict:
|
||||
"""Returns the status for the given classifier.
|
||||
|
||||
:param: classifier_id: str: classifier ID
|
||||
:returns: status for the given classifier
|
||||
:rtype: dict
|
||||
"""
|
||||
self._check_login()
|
||||
return self.get(["pipelines", "classifiers", "status", classifier_id]).json()
|
||||
|
||||
def classifier_train(self, classifier_id: str, model_name: str = "auto-trained") -> dict:
|
||||
"""Trains the given classifier (using collection documents).
|
||||
|
||||
Note that training is done asynchronously, so this method should return very quickly. One
|
||||
of the things returned in the dict will be a job ID. If you want to know when the training
|
||||
has finished, you can periodically poll :py:func:`get_classifier_running_jobs` and check
|
||||
for that job ID.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:param model_name: str: name of model corresponding to filename on disk, defaults to
|
||||
``"auto-trained"`` which is the same as the annotation-based
|
||||
model training
|
||||
:rtype: dict
|
||||
"""
|
||||
self._check_login()
|
||||
return self.post(["pipelines", "train", classifier_id], json={"model_name": model_name}).json()
|
||||
|
||||
def classifier_has_trained(self, classifier_id: str) -> bool:
|
||||
"""Returns whether the given classifier has been trained or not.
|
||||
|
||||
If False, future calls to predict will fail.
|
||||
|
||||
:param: classifier_id: str: classifier ID
|
||||
:rtype: bool
|
||||
"""
|
||||
status = self.get_classifier_status(classifier_id)
|
||||
if "job_response" in status and status["job_response"] and "has_trained" in status["job_response"]:
|
||||
return status["job_response"]["has_trained"]
|
||||
else:
|
||||
raise exceptions.PineClientException("Unable to get status for classifier {}".format(classifier_id))
|
||||
|
||||
def classifier_predict(self, classifier_id, document_ids: typing.List[str],
|
||||
texts: typing.List[str], timeout_in_s: int = 36000) -> dict:
|
||||
"""Runs classifier prediction on the given documents. At least one of document_ids and
|
||||
texts must be non-empty.
|
||||
|
||||
This prediction uses the last-trained model name for that classifier. This method will
|
||||
block until the prediction has finished and then return the results.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:param document_ids: list[str]: a list of document IDs to run prediction on
|
||||
:param texts: list[str]: a list of direct document texts to run prediction on
|
||||
:param timeout_in_s: int: max timeout in seconds before erroring out and returning, defaults
|
||||
to ``36000``
|
||||
:rtype: dict
|
||||
"""
|
||||
if not self.classifier_has_trained(classifier_id):
|
||||
raise exceptions.PineClientException("The given classifier has not yet been trained.")
|
||||
self._check_login()
|
||||
params = {
|
||||
"document_ids": document_ids,
|
||||
"texts": texts
|
||||
}
|
||||
if timeout_in_s != None:
|
||||
params["timeout_in_s"] = timeout_in_s
|
||||
return self.post(["pipelines", "predict", classifier_id], json=params).json()
|
||||
|
||||
def get_classifier_running_jobs(self, classifier_id: str) -> typing.List[str]:
|
||||
"""Gets the list of running job IDs for the given classifier.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:rtype: list[str]
|
||||
"""
|
||||
self._check_login()
|
||||
return self.get(["pipelines", "running_jobs", classifier_id]).json()
|
||||
|
||||
|
||||
class LocalPineClient(PineClient):
|
||||
"""A client for a local PINE instance, including an :py:class:`EveClient`.
|
||||
|
||||
BIN
docs/build/doctrees/autoapi/pine/backend/api/bp/index.doctree
vendored
Normal file
BIN
docs/build/doctrees/autoapi/pine/backend/api/bp/index.doctree
vendored
Normal file
Binary file not shown.
BIN
docs/build/doctrees/autoapi/pine/backend/api/index.doctree
vendored
Normal file
BIN
docs/build/doctrees/autoapi/pine/backend/api/index.doctree
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
docs/build/doctrees/environment.pickle
vendored
BIN
docs/build/doctrees/environment.pickle
vendored
Binary file not shown.
43
docs/build/html/_sources/autoapi/pine/backend/api/bp/index.rst.txt
vendored
Normal file
43
docs/build/html/_sources/autoapi/pine/backend/api/bp/index.rst.txt
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
:mod:`pine.backend.api.bp`
|
||||
==========================
|
||||
|
||||
.. py:module:: pine.backend.api.bp
|
||||
|
||||
|
||||
Module Contents
|
||||
---------------
|
||||
|
||||
|
||||
Functions
|
||||
~~~~~~~~~
|
||||
|
||||
.. autoapisummary::
|
||||
|
||||
pine.backend.api.bp.openapi_spec
|
||||
pine.backend.api.bp.swagger_ui_index
|
||||
pine.backend.api.bp.swagger_ui
|
||||
pine.backend.api.bp.init_app
|
||||
|
||||
|
||||
.. data:: bp
|
||||
|
||||
|
||||
|
||||
|
||||
.. data:: LOGGER
|
||||
|
||||
|
||||
|
||||
|
||||
.. function:: openapi_spec()
|
||||
|
||||
|
||||
.. function:: swagger_ui_index()
|
||||
|
||||
|
||||
.. function:: swagger_ui(file: str)
|
||||
|
||||
|
||||
.. function:: init_app(app)
|
||||
|
||||
|
||||
21
docs/build/html/_sources/autoapi/pine/backend/api/index.rst.txt
vendored
Normal file
21
docs/build/html/_sources/autoapi/pine/backend/api/index.rst.txt
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
:mod:`pine.backend.api`
|
||||
=======================
|
||||
|
||||
.. py:module:: pine.backend.api
|
||||
|
||||
.. autoapi-nested-parse::
|
||||
|
||||
This module implements all methods required for SwaggerUI to run on the
|
||||
backend of PINE.
|
||||
|
||||
|
||||
|
||||
Submodules
|
||||
----------
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
:maxdepth: 1
|
||||
|
||||
bp/index.rst
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ Functions
|
||||
.. function:: add_label_to_collection(collection_id)
|
||||
|
||||
|
||||
.. function:: get_overlap_ids(collection_id)
|
||||
.. function:: get_overlap_ids(collection_id: str)
|
||||
|
||||
Return the list of ids for overlapping documents for the collection matching the provided collection id.
|
||||
:param collection_id: str
|
||||
|
||||
@@ -32,6 +32,7 @@ Functions
|
||||
pine.backend.collections.get_user_permissions
|
||||
pine.backend.collections.get_user_permissions_by_id
|
||||
pine.backend.collections.get_user_permissions_by_ids
|
||||
pine.backend.collections.get_overlap_ids
|
||||
|
||||
|
||||
.. function:: user_permissions_projection()
|
||||
@@ -46,3 +47,10 @@ Functions
|
||||
.. function:: get_user_permissions_by_ids(collection_ids: Iterable[str]) -> List[models.CollectionUserPermissions]
|
||||
|
||||
|
||||
.. function:: get_overlap_ids(collection_id: str)
|
||||
|
||||
Return the list of ids for overlapping documents for the collection matching the provided collection id.
|
||||
:param collection_id: str
|
||||
:return: tuple
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ Subpackages
|
||||
|
||||
admin/index.rst
|
||||
annotations/index.rst
|
||||
api/index.rst
|
||||
auth/index.rst
|
||||
collections/index.rst
|
||||
data/index.rst
|
||||
|
||||
@@ -12,6 +12,7 @@ Classes
|
||||
|
||||
.. autoapisummary::
|
||||
|
||||
pine.backend.job_manager.service.ServiceJob
|
||||
pine.backend.job_manager.service.ServiceManager
|
||||
|
||||
|
||||
@@ -26,6 +27,20 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. class:: ServiceJob(job_id: str, request_body: dict, request_response: dict)
|
||||
|
||||
|
||||
Bases: :class:`object`
|
||||
|
||||
Data class for a service job.
|
||||
|
||||
"Constructor.
|
||||
|
||||
:param job_id: str: job ID
|
||||
:param request_body: dict: job request body
|
||||
:param request_response: dict: job request response
|
||||
|
||||
|
||||
.. class:: ServiceManager(default_handler=None)
|
||||
|
||||
|
||||
@@ -138,6 +153,14 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. method:: get_results_key(cls, service_name: str, job_id: str) -> str
|
||||
:classmethod:
|
||||
|
||||
|
||||
.. method:: get_running_jobs_key(cls, service_name: str) -> str
|
||||
:classmethod:
|
||||
|
||||
|
||||
.. method:: get_registered_channels(cls, include_ttl=False)
|
||||
:classmethod:
|
||||
|
||||
@@ -162,7 +185,15 @@ Classes
|
||||
:rtype: list[str] | list[dict]
|
||||
|
||||
|
||||
.. method:: send_service_request(cls, service_name, data, job_id=None, encoder=None)
|
||||
.. method:: _get_service_details(cls, service_name: str, retry_count=10) -> dict
|
||||
:classmethod:
|
||||
|
||||
|
||||
.. method:: _get_service_channel(cls, service_name: str) -> str
|
||||
:classmethod:
|
||||
|
||||
|
||||
.. method:: send_service_request(cls, service_name: str, data, job_id=None, encoder=None)
|
||||
:classmethod:
|
||||
|
||||
Queue's a job for the requested service.
|
||||
@@ -173,6 +204,36 @@ Classes
|
||||
:rtype: None | dict
|
||||
|
||||
|
||||
.. method:: get_job_response(cls, service_name: str, job_id: str, timeout_in_s: int)
|
||||
:classmethod:
|
||||
|
||||
Waits for a response for the given job and returns it.
|
||||
:param service_name: str: service name
|
||||
:param job_id: str: job ID
|
||||
:param timeout_in_s: int: wait timeout in seconds
|
||||
:rtype None | dict
|
||||
|
||||
|
||||
.. method:: send_service_request_and_get_response(cls, service_name: str, data, timeout_in_s: int, job_id=None, encoder=None) -> pine.backend.job_manager.service.ServiceJob
|
||||
:classmethod:
|
||||
|
||||
Sends a service requests, waits for a response, and returns job data.
|
||||
:param service_name: str: service name
|
||||
:param data: job data
|
||||
:param timeout_in_s: int: wait timeout in seconds
|
||||
:param job_id: str: optional job ID (or None to auto-generate one)
|
||||
:param encoder: optional JSON encoder for job data
|
||||
:rtype None | ServiceJob
|
||||
|
||||
|
||||
.. method:: get_running_jobs(cls, service_name: str) -> List[str]
|
||||
:classmethod:
|
||||
|
||||
Returns running jobs.
|
||||
:param service_name: str: service name
|
||||
:rtype list[str]
|
||||
|
||||
|
||||
.. method:: start_listeners(self)
|
||||
|
||||
Starts all the workers.
|
||||
|
||||
@@ -13,19 +13,29 @@ Functions
|
||||
|
||||
.. autoapisummary::
|
||||
|
||||
pine.backend.pipelines.bp._get_classifier
|
||||
pine.backend.pipelines.bp._clear_classifier
|
||||
pine.backend.pipelines.bp._get_classifier_pipeline
|
||||
pine.backend.pipelines.bp._check_permissions
|
||||
pine.backend.pipelines.bp._get_pipeline_status
|
||||
pine.backend.pipelines.bp._get_pipeline_running_jobs
|
||||
pine.backend.pipelines.bp._train_pipeline
|
||||
pine.backend.pipelines.bp._predict_pipeline
|
||||
pine.backend.pipelines.bp.get_pipelines
|
||||
pine.backend.pipelines.bp.get_pipeline_by_id
|
||||
pine.backend.pipelines.bp.get_pipeline_status
|
||||
pine.backend.pipelines.bp._get_classifier_metrics
|
||||
pine.backend.pipelines.bp.get_classifier_metrics
|
||||
pine.backend.pipelines.bp._get_collection_classifier
|
||||
pine.backend.pipelines.bp.get_collection_classifier
|
||||
pine.backend.pipelines.bp._get_classifier_metrics
|
||||
pine.backend.pipelines.bp.get_metrics
|
||||
pine.backend.pipelines.bp.get_classifier_metrics
|
||||
pine.backend.pipelines.bp._get_classifier
|
||||
pine.backend.pipelines.bp.get_classifier_status
|
||||
pine.backend.pipelines.bp.get_running_jobs
|
||||
pine.backend.pipelines.bp.train
|
||||
pine.backend.pipelines.bp.predict
|
||||
pine.backend.pipelines.bp._get_next_instance
|
||||
pine.backend.pipelines.bp._check_instance_overlap
|
||||
pine.backend.pipelines.bp.get_next_by_classifier
|
||||
pine.backend.pipelines.bp.advance_to_next_document_by_classifier
|
||||
pine.backend.pipelines.bp.predict
|
||||
pine.backend.pipelines.bp.test_redis
|
||||
pine.backend.pipelines.bp.init_app
|
||||
|
||||
|
||||
@@ -44,53 +54,83 @@ Functions
|
||||
|
||||
|
||||
|
||||
.. data:: classifier_dict
|
||||
.. data:: _cached_classifiers
|
||||
|
||||
|
||||
|
||||
|
||||
.. data:: classifier_pipelines
|
||||
.. data:: _cached_classifier_pipelines
|
||||
|
||||
|
||||
|
||||
|
||||
.. function:: _get_classifier(classifier_id: str) -> dict
|
||||
|
||||
|
||||
.. function:: _clear_classifier(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: _get_classifier_pipeline(classifier_id: str) -> dict
|
||||
|
||||
|
||||
.. function:: _check_permissions(classifier: dict)
|
||||
|
||||
|
||||
.. function:: _get_pipeline_status(pipeline: str, classifier_id: str) -> dict
|
||||
|
||||
|
||||
.. function:: _get_pipeline_running_jobs(pipeline: str, classifier_id: str) -> List[str]
|
||||
|
||||
|
||||
.. function:: _train_pipeline(pipeline: str, classifier_id: str, model_name: str) -> dict
|
||||
|
||||
|
||||
.. function:: _predict_pipeline(pipeline: str, classifier_id: str, document_ids: List[str], texts: List[str], timeout_in_s: int) -> dict
|
||||
|
||||
|
||||
.. function:: get_pipelines()
|
||||
|
||||
|
||||
.. function:: get_pipeline_by_id(pipeline_id)
|
||||
.. function:: get_pipeline_by_id(pipeline_id: str)
|
||||
|
||||
|
||||
.. function:: _get_collection_classifier(collection_id)
|
||||
.. function:: get_pipeline_status(pipeline_id: str) -> flask.Response
|
||||
|
||||
|
||||
.. function:: get_collection_classifier(collection_id)
|
||||
.. function:: _get_classifier_metrics(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: _get_classifier_metrics(classifier_id)
|
||||
.. function:: get_classifier_metrics(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: get_metrics()
|
||||
.. function:: _get_collection_classifier(collection_id: str) -> dict
|
||||
|
||||
|
||||
.. function:: get_classifier_metrics(classifier_id)
|
||||
.. function:: get_collection_classifier(collection_id: str)
|
||||
|
||||
|
||||
.. function:: _get_classifier(classifier_id)
|
||||
.. function:: get_classifier_status(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: _get_next_instance(classifier_id)
|
||||
.. function:: get_running_jobs(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: get_next_by_classifier(classifier_id)
|
||||
.. function:: train(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: advance_to_next_document_by_classifier(classifier_id, document_id)
|
||||
.. function:: predict(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: predict()
|
||||
.. function:: _get_next_instance(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: test_redis()
|
||||
.. function:: _check_instance_overlap(classifier: dict, instance: dict, user_id: str)
|
||||
|
||||
|
||||
.. function:: get_next_by_classifier(classifier_id: str)
|
||||
|
||||
|
||||
.. function:: advance_to_next_document_by_classifier(classifier_id: str, document_id: str)
|
||||
|
||||
|
||||
.. function:: init_app(app)
|
||||
|
||||
@@ -532,6 +532,15 @@ Functions
|
||||
:rtype: list(dict)
|
||||
|
||||
|
||||
.. method:: get_pipeline_status(self, pipeline_id: str) -> dict
|
||||
|
||||
Returns status for the given pipeline.
|
||||
|
||||
:param pipeline_id: str: pipeline ID
|
||||
:returns: pipeline status
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: collection_builder(self, **kwargs: dict) -> pine.client.models.CollectionBuilder
|
||||
|
||||
Makes and returns a new :py:class:`.models.CollectionBuilder` with the logged in user.
|
||||
@@ -558,6 +567,16 @@ Functions
|
||||
:rtype: str
|
||||
|
||||
|
||||
.. method:: archive_collection(self, collection_id: str, archive: bool = True) -> dict
|
||||
|
||||
Archives or unarchives the given collection.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
:param archive: bool: whether to archive (True) or unarchive (False) the collection
|
||||
:returns: updated collection information
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_collection_permissions(self, collection_id: str) -> pine.client.models.CollectionUserPermissions
|
||||
|
||||
Returns collection permissions for the logged in user.
|
||||
@@ -584,6 +603,43 @@ Functions
|
||||
:rtype: list(dict)
|
||||
|
||||
|
||||
.. method:: get_collection_classifier(self, collection_id: str) -> dict
|
||||
|
||||
Returns the classifier associated with the given collection.
|
||||
|
||||
:param collection_id: the ID of the collection
|
||||
:type collection_id: str
|
||||
|
||||
:returns: the classifier associated with the given collection
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_next_document(self, classifier_id: str) -> str
|
||||
|
||||
Returns the 'next' document associated with the given classifier.
|
||||
|
||||
The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.
|
||||
|
||||
:param classifier_id: str: ID of the classifier
|
||||
:returns: the next document ID, or None if there are none left to annotate
|
||||
:rtype: str
|
||||
|
||||
|
||||
.. method:: advance_next_document(self, classifier_id: str, document_id: str) -> dict
|
||||
|
||||
Advances the 'next' document associated with the given classifier by marking the
|
||||
given document as annotated.
|
||||
|
||||
The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.
|
||||
|
||||
:param classifier_id: str: ID of the classifier
|
||||
:param document_id: str: the ID of the document that was annotated
|
||||
:returns: information on the advanced instance
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: add_document(self, document: dict = {}, creator_id: str = None, collection_id: str = None, overlap: int = None, text: str = None, metadata: dict = None) -> str
|
||||
|
||||
Adds a new document to a collection and returns its ID.
|
||||
@@ -696,6 +752,36 @@ Functions
|
||||
:rtype: list(str)
|
||||
|
||||
|
||||
.. method:: get_my_document_annotations(self, document_id: str) -> List[List[dict]]
|
||||
|
||||
Returns annotations for the given document for the logged in user.
|
||||
|
||||
:param document_id: the ID of the document to get annotations for
|
||||
:type collection_id: str
|
||||
|
||||
:raises exceptions.PineClientValueException: if the document ID is not a valid string
|
||||
:raises exceptions.PineClientAuthException: if not logged in
|
||||
:raises exceptions.PineClientHttpException: if the HTTP request returns an error
|
||||
|
||||
:returns: the annotations for the given document for the logged in user
|
||||
:rtype: list(list(dict))
|
||||
|
||||
|
||||
.. method:: get_others_document_annotations(self, document_id: str) -> List[List]
|
||||
|
||||
Returns annotations for the given document for users other than the logged in user.
|
||||
|
||||
:param document_id: the ID of the document to get annotations for
|
||||
:type collection_id: str
|
||||
|
||||
:raises exceptions.PineClientValueException: if the document ID is not a valid string
|
||||
:raises exceptions.PineClientAuthException: if not logged in
|
||||
:raises exceptions.PineClientHttpException: if the HTTP request returns an error
|
||||
|
||||
:returns: the annotations for the given document for users other than the logged in user
|
||||
:rtype: list(list(dict))
|
||||
|
||||
|
||||
.. method:: list_collections(self, include_archived: bool = False) -> List[dict]
|
||||
|
||||
Returns a list of user's collections.
|
||||
@@ -710,6 +796,15 @@ Functions
|
||||
:rtype: list(dict)
|
||||
|
||||
|
||||
.. method:: get_collection(self, collection_id: str) -> dict
|
||||
|
||||
Returns the collection with the given ID.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
:returns: the collection data
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_collection_iaa_report(self, collection_id: str) -> dict
|
||||
|
||||
Returns IAA (inter-annotation agreement) report for the given collection.
|
||||
@@ -748,6 +843,65 @@ Functions
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_classifier_status(self, classifier_id: str) -> dict
|
||||
|
||||
Returns the status for the given classifier.
|
||||
|
||||
:param: classifier_id: str: classifier ID
|
||||
:returns: status for the given classifier
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: classifier_train(self, classifier_id: str, model_name: str = 'auto-trained') -> dict
|
||||
|
||||
Trains the given classifier (using collection documents).
|
||||
|
||||
Note that training is done asynchronously, so this method should return very quickly. One
|
||||
of the things returned in the dict will be a job ID. If you want to know when the training
|
||||
has finished, you can periodically poll :py:func:`get_classifier_running_jobs` and check
|
||||
for that job ID.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:param model_name: str: name of model corresponding to filename on disk, defaults to
|
||||
``"auto-trained"`` which is the same as the annotation-based
|
||||
model training
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: classifier_has_trained(self, classifier_id: str) -> bool
|
||||
|
||||
Returns whether the given classifier has been trained or not.
|
||||
|
||||
If False, future calls to predict will fail.
|
||||
|
||||
:param: classifier_id: str: classifier ID
|
||||
:rtype: bool
|
||||
|
||||
|
||||
.. method:: classifier_predict(self, classifier_id, document_ids: List[str], texts: List[str], timeout_in_s: int = 36000) -> dict
|
||||
|
||||
Runs classifier prediction on the given documents. At least one of document_ids and
|
||||
texts must be non-empty.
|
||||
|
||||
This prediction uses the last-trained model name for that classifier. This method will
|
||||
block until the prediction has finished and then return the results.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:param document_ids: list[str]: a list of document IDs to run prediction on
|
||||
:param texts: list[str]: a list of direct document texts to run prediction on
|
||||
:param timeout_in_s: int: max timeout in seconds before erroring out and returning, defaults
|
||||
to ``36000``
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_classifier_running_jobs(self, classifier_id: str) -> List[str]
|
||||
|
||||
Gets the list of running job IDs for the given classifier.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:rtype: list[str]
|
||||
|
||||
|
||||
|
||||
.. class:: LocalPineClient(backend_base_uri: str, eve_base_uri: str, mongo_base_uri: str = None, mongo_dbname: str = EveClient.DEFAULT_DBNAME, verify_ssl: bool = True)
|
||||
|
||||
|
||||
@@ -186,6 +186,15 @@ Functions
|
||||
:rtype: list(dict)
|
||||
|
||||
|
||||
.. method:: get_pipeline_status(self, pipeline_id: str) -> dict
|
||||
|
||||
Returns status for the given pipeline.
|
||||
|
||||
:param pipeline_id: str: pipeline ID
|
||||
:returns: pipeline status
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: collection_builder(self, **kwargs: dict) -> pine.client.models.CollectionBuilder
|
||||
|
||||
Makes and returns a new :py:class:`.models.CollectionBuilder` with the logged in user.
|
||||
@@ -212,6 +221,16 @@ Functions
|
||||
:rtype: str
|
||||
|
||||
|
||||
.. method:: archive_collection(self, collection_id: str, archive: bool = True) -> dict
|
||||
|
||||
Archives or unarchives the given collection.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
:param archive: bool: whether to archive (True) or unarchive (False) the collection
|
||||
:returns: updated collection information
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_collection_permissions(self, collection_id: str) -> pine.client.models.CollectionUserPermissions
|
||||
|
||||
Returns collection permissions for the logged in user.
|
||||
@@ -238,6 +257,43 @@ Functions
|
||||
:rtype: list(dict)
|
||||
|
||||
|
||||
.. method:: get_collection_classifier(self, collection_id: str) -> dict
|
||||
|
||||
Returns the classifier associated with the given collection.
|
||||
|
||||
:param collection_id: the ID of the collection
|
||||
:type collection_id: str
|
||||
|
||||
:returns: the classifier associated with the given collection
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_next_document(self, classifier_id: str) -> str
|
||||
|
||||
Returns the 'next' document associated with the given classifier.
|
||||
|
||||
The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.
|
||||
|
||||
:param classifier_id: str: ID of the classifier
|
||||
:returns: the next document ID, or None if there are none left to annotate
|
||||
:rtype: str
|
||||
|
||||
|
||||
.. method:: advance_next_document(self, classifier_id: str, document_id: str) -> dict
|
||||
|
||||
Advances the 'next' document associated with the given classifier by marking the
|
||||
given document as annotated.
|
||||
|
||||
The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.
|
||||
|
||||
:param classifier_id: str: ID of the classifier
|
||||
:param document_id: str: the ID of the document that was annotated
|
||||
:returns: information on the advanced instance
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: add_document(self, document: dict = {}, creator_id: str = None, collection_id: str = None, overlap: int = None, text: str = None, metadata: dict = None) -> str
|
||||
|
||||
Adds a new document to a collection and returns its ID.
|
||||
@@ -350,6 +406,36 @@ Functions
|
||||
:rtype: list(str)
|
||||
|
||||
|
||||
.. method:: get_my_document_annotations(self, document_id: str) -> List[List[dict]]
|
||||
|
||||
Returns annotations for the given document for the logged in user.
|
||||
|
||||
:param document_id: the ID of the document to get annotations for
|
||||
:type collection_id: str
|
||||
|
||||
:raises exceptions.PineClientValueException: if the document ID is not a valid string
|
||||
:raises exceptions.PineClientAuthException: if not logged in
|
||||
:raises exceptions.PineClientHttpException: if the HTTP request returns an error
|
||||
|
||||
:returns: the annotations for the given document for the logged in user
|
||||
:rtype: list(list(dict))
|
||||
|
||||
|
||||
.. method:: get_others_document_annotations(self, document_id: str) -> List[List]
|
||||
|
||||
Returns annotations for the given document for users other than the logged in user.
|
||||
|
||||
:param document_id: the ID of the document to get annotations for
|
||||
:type collection_id: str
|
||||
|
||||
:raises exceptions.PineClientValueException: if the document ID is not a valid string
|
||||
:raises exceptions.PineClientAuthException: if not logged in
|
||||
:raises exceptions.PineClientHttpException: if the HTTP request returns an error
|
||||
|
||||
:returns: the annotations for the given document for users other than the logged in user
|
||||
:rtype: list(list(dict))
|
||||
|
||||
|
||||
.. method:: list_collections(self, include_archived: bool = False) -> List[dict]
|
||||
|
||||
Returns a list of user's collections.
|
||||
@@ -364,6 +450,15 @@ Functions
|
||||
:rtype: list(dict)
|
||||
|
||||
|
||||
.. method:: get_collection(self, collection_id: str) -> dict
|
||||
|
||||
Returns the collection with the given ID.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
:returns: the collection data
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_collection_iaa_report(self, collection_id: str) -> dict
|
||||
|
||||
Returns IAA (inter-annotation agreement) report for the given collection.
|
||||
@@ -402,6 +497,65 @@ Functions
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_classifier_status(self, classifier_id: str) -> dict
|
||||
|
||||
Returns the status for the given classifier.
|
||||
|
||||
:param: classifier_id: str: classifier ID
|
||||
:returns: status for the given classifier
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: classifier_train(self, classifier_id: str, model_name: str = 'auto-trained') -> dict
|
||||
|
||||
Trains the given classifier (using collection documents).
|
||||
|
||||
Note that training is done asynchronously, so this method should return very quickly. One
|
||||
of the things returned in the dict will be a job ID. If you want to know when the training
|
||||
has finished, you can periodically poll :py:func:`get_classifier_running_jobs` and check
|
||||
for that job ID.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:param model_name: str: name of model corresponding to filename on disk, defaults to
|
||||
``"auto-trained"`` which is the same as the annotation-based
|
||||
model training
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: classifier_has_trained(self, classifier_id: str) -> bool
|
||||
|
||||
Returns whether the given classifier has been trained or not.
|
||||
|
||||
If False, future calls to predict will fail.
|
||||
|
||||
:param: classifier_id: str: classifier ID
|
||||
:rtype: bool
|
||||
|
||||
|
||||
.. method:: classifier_predict(self, classifier_id, document_ids: List[str], texts: List[str], timeout_in_s: int = 36000) -> dict
|
||||
|
||||
Runs classifier prediction on the given documents. At least one of document_ids and
|
||||
texts must be non-empty.
|
||||
|
||||
This prediction uses the last-trained model name for that classifier. This method will
|
||||
block until the prediction has finished and then return the results.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:param document_ids: list[str]: a list of document IDs to run prediction on
|
||||
:param texts: list[str]: a list of direct document texts to run prediction on
|
||||
:param timeout_in_s: int: max timeout in seconds before erroring out and returning, defaults
|
||||
to ``36000``
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_classifier_running_jobs(self, classifier_id: str) -> List[str]
|
||||
|
||||
Gets the list of running job IDs for the given classifier.
|
||||
|
||||
:param classifier_id: str: classifier ID
|
||||
:rtype: list[str]
|
||||
|
||||
|
||||
|
||||
.. class:: LocalPineClient(backend_base_uri: str, eve_base_uri: str, mongo_base_uri: str = None, mongo_dbname: str = EveClient.DEFAULT_DBNAME, verify_ssl: bool = True)
|
||||
|
||||
|
||||
@@ -48,13 +48,36 @@ Classes
|
||||
.. method:: get_all_ids(self, resource)
|
||||
|
||||
|
||||
.. method:: get_items(self, resource)
|
||||
.. method:: get_items(self, resource, params={})
|
||||
|
||||
|
||||
.. method:: get_documents(self, collection_id)
|
||||
.. method:: _get_documents_map(self, params: dict = {})
|
||||
|
||||
|
||||
.. method:: get_docs_with_annotations(self, collection_id, doc_map)
|
||||
.. method:: get_documents(self, collection_id: str) -> Dict[(str, str)]
|
||||
|
||||
Returns a document map where the document overlap is 0.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
|
||||
:returns: a mapping from document ID to document text for non-overlap documents
|
||||
:rtype: dict
|
||||
|
||||
|
||||
.. method:: get_documents_by_id(self, document_ids: List[str])
|
||||
|
||||
|
||||
.. method:: get_docs_with_annotations(self, collection_id: str, doc_map: Dict[(str, str)]) -> Tuple[(typing.List[str], typing.List[str], typing.List[str], typing.List[str])]
|
||||
|
||||
Gets document and annotation data. Only non-overlapping documents are returned.
|
||||
|
||||
:param collection_id: str: the ID of the collection
|
||||
:param doc_map: dict[str, str]: map of document IDs to document text
|
||||
|
||||
:returns: (documents, labels, doc_ids, ann_ids) where documents is a list of the texts,
|
||||
labels is a list of the annotations, doc_ids is a list of the document IDs, and
|
||||
ann_ids is a list of the annotation IDs
|
||||
:rtype: tuple
|
||||
|
||||
|
||||
.. method:: update(self, resource, id, etag, update_obj)
|
||||
|
||||
@@ -31,13 +31,28 @@ Classes
|
||||
|
||||
Bases: :class:`object`
|
||||
|
||||
.. method:: perform_fold(self, model, train_data, test_data, pipeline_parameters)
|
||||
.. method:: status(self, classifier_id: str, pipeline_name: str) -> dict
|
||||
|
||||
|
||||
.. method:: perform_five_fold(self, model, documents, annotations, doc_ids, pipeline_parameters)
|
||||
.. method:: perform_fold(self, model: pine.pipelines.pmap_ner.NER, train_data, test_data, **pipeline_parameters)
|
||||
|
||||
|
||||
.. method:: get_document_ranking(self, model, doc_map, doc_ids)
|
||||
.. method:: perform_five_fold(self, model: pine.pipelines.pmap_ner.NER, documents, annotations, doc_ids, **pipeline_parameters)
|
||||
|
||||
|
||||
.. method:: get_document_ranking(self, model: pine.pipelines.pmap_ner.NER, doc_map: Dict[(str, str)], doc_ids: List[str]) -> List[str]
|
||||
|
||||
Calculates document rankings and returns document IDs sorted by ranking.
|
||||
|
||||
The ranking should be which documents should be evaluated first. This probably
|
||||
corresponds in some ways to the documents which the model is least confident about.
|
||||
|
||||
:param model: NER model
|
||||
:param doc_map: dict: mapping of document IDs to document text where overlap is 0
|
||||
:param doc_ids: list: IDs of documents where ???
|
||||
|
||||
:returns: sorted document IDs
|
||||
:rtype: list
|
||||
|
||||
|
||||
.. method:: get_classifier_pipeline_metrics_objs(self, classifier_id)
|
||||
@@ -46,7 +61,7 @@ Classes
|
||||
.. method:: train_model(self, custom_filename, classifier_id, pipeline_name)
|
||||
|
||||
|
||||
.. method:: predict(self, classifier_id, pipeline_name, documents, document_ids)
|
||||
.. method:: predict(self, classifier_id: str, pipeline_name: str, document_ids: List[str], texts: List[str])
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,12 @@ Functions
|
||||
pine.pipelines.RankingFunctions.most_of_least_popular
|
||||
|
||||
|
||||
.. function:: rank(results, metric)
|
||||
.. data:: logger
|
||||
|
||||
|
||||
|
||||
|
||||
.. function:: rank(document_ids: List[str], results: List[DocumentPredictionProbabilities], metric: str) -> List[Tuple[str, float]]
|
||||
|
||||
if metric == 'lc': return least_confidence(results)
|
||||
if metric == 'ma': return largest_margin(results)
|
||||
@@ -37,24 +42,24 @@ Functions
|
||||
#Dictionary method is inefficient as it runs every method before returning one
|
||||
|
||||
|
||||
.. function:: least_confidence(results)
|
||||
.. function:: least_confidence(document_ids: List[str], results: List[DocumentPredictionProbabilities]) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
.. function:: least_confidence_squared(results)
|
||||
.. function:: least_confidence_squared(document_ids: List[str], results: List[DocumentPredictionProbabilities]) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
.. function:: least_confidence_squared_by_entity(results)
|
||||
.. function:: least_confidence_squared_by_entity(document_ids: List[str], results: List[DocumentPredictionProbabilities]) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
.. function:: largest_margin(results)
|
||||
.. function:: largest_margin(document_ids: List[str], results: List[DocumentPredictionProbabilities]) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
.. function:: entropy_rank(results, N=None)
|
||||
.. function:: entropy_rank(document_ids: List[str], results: List[DocumentPredictionProbabilities], N=None) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
.. function:: random_rank(results)
|
||||
.. function:: random_rank(document_ids: List[str], results: List[DocumentPredictionProbabilities]) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
.. function:: most_of_least_popular(results)
|
||||
.. function:: most_of_least_popular(document_ids: List[str], results: List[DocumentPredictionProbabilities]) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
|
||||
@@ -87,6 +87,26 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. attribute:: results_queue_key
|
||||
|
||||
|
||||
|
||||
|
||||
.. attribute:: results_queue_key_timeout
|
||||
|
||||
|
||||
|
||||
|
||||
.. attribute:: running_jobs_key
|
||||
|
||||
|
||||
|
||||
|
||||
.. attribute:: classifiers_training_key
|
||||
|
||||
|
||||
|
||||
|
||||
.. attribute:: processing_lock_key
|
||||
|
||||
|
||||
@@ -122,14 +142,6 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. method:: publish_response(cls, channel, data)
|
||||
:classmethod:
|
||||
|
||||
:type channel: str
|
||||
:type data: dict
|
||||
:rtype: bool
|
||||
|
||||
|
||||
.. method:: start_workers(self)
|
||||
|
||||
|
||||
@@ -143,7 +155,23 @@ Classes
|
||||
:rtype: bool | dict
|
||||
|
||||
|
||||
.. method:: process_message(job_details)
|
||||
.. method:: do_with_redis(callback: Callable[([redis.StrictRedis], typing.Any)])
|
||||
:staticmethod:
|
||||
|
||||
|
||||
.. method:: push_results(job_id: str, response)
|
||||
:staticmethod:
|
||||
|
||||
|
||||
.. method:: wait_until_classifier_isnt_training(classifier_id: str, job_id: str)
|
||||
:staticmethod:
|
||||
|
||||
|
||||
.. method:: classifier_is_done_training(classifier_id: str)
|
||||
:staticmethod:
|
||||
|
||||
|
||||
.. method:: process_message(job_id: str, job_details)
|
||||
:staticmethod:
|
||||
|
||||
|
||||
|
||||
@@ -71,18 +71,35 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. attribute:: __is_setup
|
||||
:annotation: = False
|
||||
|
||||
|
||||
|
||||
.. attribute:: __id
|
||||
|
||||
|
||||
|
||||
|
||||
.. method:: fit(self, X, y, params=None)
|
||||
.. attribute:: __default_fit_params
|
||||
|
||||
|
||||
|
||||
|
||||
.. method:: setup(cls, java_dir=None, ner_path=None)
|
||||
:classmethod:
|
||||
|
||||
|
||||
.. method:: predict(self, X, Xid)
|
||||
.. method:: status(self) -> dict
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X, Xid, get_all_labels=False, include_other=False)
|
||||
.. method:: fit(self, X, y, **params)
|
||||
|
||||
|
||||
.. method:: predict(self, X: Iterable[str]) -> List[DocumentPredictions]
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X: Iterable[str], get_all_labels=False, include_other=False, **kwargs) -> List[DocumentPredictionProbabilities]
|
||||
|
||||
|
||||
.. method:: next_example(self, X, Xid)
|
||||
|
||||
@@ -31,7 +31,7 @@ Classes
|
||||
|
||||
Bases: :class:`pine.pipelines.pipeline.Pipeline`
|
||||
|
||||
.. attribute:: __jar
|
||||
.. attribute:: __ner_path
|
||||
:annotation: =
|
||||
|
||||
|
||||
@@ -71,13 +71,25 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. method:: fit(self, X, y, params)
|
||||
.. attribute:: __is_setup
|
||||
:annotation: = False
|
||||
|
||||
|
||||
|
||||
.. method:: setup(cls, java_dir=None, ner_path=None)
|
||||
:classmethod:
|
||||
|
||||
|
||||
.. method:: predict(self, X, Xid)
|
||||
.. method:: status(self) -> dict
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X, Xid, get_all_labels=False, include_other=False)
|
||||
.. method:: fit(self, X, y, **params)
|
||||
|
||||
|
||||
.. method:: predict(self, X: Iterable[str]) -> List[DocumentPredictions]
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X: Iterable[str], **kwargs) -> List[DocumentPredictionProbabilities]
|
||||
|
||||
|
||||
.. method:: next_example(self, X, Xid)
|
||||
@@ -101,7 +113,7 @@ Classes
|
||||
.. method:: format_data(self, X, y)
|
||||
|
||||
|
||||
.. method:: convert_ann_collection_to_per_token(self, annotations, tokens)
|
||||
.. method:: convert_ann_collection_to_per_token(self, annotations: List[Union[NerPrediction, typing.Tuple[int, int, str]]], tokens)
|
||||
|
||||
|
||||
.. method:: evaluate(self, X, y, Xid)
|
||||
|
||||
@@ -12,24 +12,74 @@ Classes
|
||||
|
||||
.. autoapisummary::
|
||||
|
||||
pine.pipelines.pipeline.NerPrediction
|
||||
pine.pipelines.pipeline.DocumentPredictions
|
||||
pine.pipelines.pipeline.NerPredictionProbabilities
|
||||
pine.pipelines.pipeline.DocumentPredictionProbabilities
|
||||
pine.pipelines.pipeline.Pipeline
|
||||
|
||||
|
||||
|
||||
.. class:: NerPrediction(offset_start: int, offset_end: int, label: str)
|
||||
|
||||
|
||||
Bases: :class:`object`
|
||||
|
||||
.. method:: serialize(self) -> Tuple[(int, int, str)]
|
||||
|
||||
|
||||
|
||||
.. class:: DocumentPredictions(ner: List[NerPrediction], doc: List[str], extra_data: Any = None)
|
||||
|
||||
|
||||
Bases: :class:`object`
|
||||
|
||||
.. method:: serialize(self) -> dict
|
||||
|
||||
|
||||
|
||||
.. class:: NerPredictionProbabilities(offset_start: int, offset_end: int, predictions: List[Tuple[str, float]])
|
||||
|
||||
|
||||
Bases: :class:`object`
|
||||
|
||||
.. method:: get_highest_prediction(self) -> Tuple[(str, float)]
|
||||
|
||||
|
||||
.. method:: get_predictions_from_highest_to_lowest(self) -> List[Tuple[str, float]]
|
||||
|
||||
|
||||
.. method:: serialize(self) -> Tuple[(int, int, typing.List[typing.Tuple[str, float]])]
|
||||
|
||||
|
||||
|
||||
.. class:: DocumentPredictionProbabilities(ner: List[NerPredictionProbabilities], doc: List[Tuple[str, float]])
|
||||
|
||||
|
||||
Bases: :class:`object`
|
||||
|
||||
.. method:: serialize(self) -> dict
|
||||
|
||||
|
||||
|
||||
.. class:: Pipeline
|
||||
|
||||
|
||||
Bases: :class:`object`
|
||||
|
||||
.. method:: fit(self, X, y)
|
||||
.. method:: status(self) -> dict
|
||||
:abstractmethod:
|
||||
|
||||
|
||||
.. method:: predict(self, X, Xid)
|
||||
.. method:: fit(self, X, y, **params)
|
||||
:abstractmethod:
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X, Xid)
|
||||
.. method:: predict(self, X: Iterable[str]) -> List[DocumentPredictions]
|
||||
:abstractmethod:
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X: Iterable[str], **kwargs) -> List[DocumentPredictionProbabilities]
|
||||
:abstractmethod:
|
||||
|
||||
|
||||
|
||||
@@ -44,13 +44,20 @@ Classes
|
||||
.. method:: pipe_init(self, x, **kwargs)
|
||||
|
||||
|
||||
.. method:: fit(self, X, y, kwargs)
|
||||
.. method:: pipeline_class(self)
|
||||
:property:
|
||||
|
||||
|
||||
.. method:: predict(self, X, Xid)
|
||||
.. method:: status(self) -> dict
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X, Xid, **kwargs)
|
||||
.. method:: fit(self, X, y, **kwargs)
|
||||
|
||||
|
||||
.. method:: predict(self, X: Iterable[str]) -> List[DocumentPredictions]
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X: Iterable[str], **kwargs) -> List[DocumentPredictionProbabilities]
|
||||
|
||||
|
||||
.. method:: evaluate(self, X, y, Xid, **kwargs)
|
||||
@@ -59,7 +66,7 @@ Classes
|
||||
.. method:: next_example(self, X, Xid)
|
||||
|
||||
|
||||
.. method:: save_model(self, model_path)
|
||||
.. method:: save_model(self, model_name)
|
||||
|
||||
|
||||
.. method:: load_model(self, model_name)
|
||||
|
||||
@@ -128,6 +128,11 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. attribute:: REDIS_MAX_PROCESSES
|
||||
:annotation: = 10
|
||||
|
||||
|
||||
|
||||
.. attribute:: SCHEDULER_REGISTRATION_TIMEOUT
|
||||
|
||||
|
||||
|
||||
@@ -25,11 +25,21 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. data:: logger
|
||||
|
||||
|
||||
|
||||
|
||||
.. class:: spacy_NER(model_path=None)
|
||||
|
||||
|
||||
Bases: :class:`pine.pipelines.pipeline.Pipeline`
|
||||
|
||||
.. attribute:: __model
|
||||
|
||||
|
||||
|
||||
|
||||
.. attribute:: __nlp
|
||||
:annotation: = []
|
||||
|
||||
@@ -45,16 +55,27 @@ Classes
|
||||
|
||||
|
||||
|
||||
.. method:: fit(self, X, y, params=None)
|
||||
.. attribute:: __default_fit_params
|
||||
|
||||
|
||||
|
||||
|
||||
.. method:: _load_model(self, model_path=None)
|
||||
|
||||
|
||||
.. method:: status(self) -> dict
|
||||
|
||||
|
||||
.. method:: fit(self, X, y, **params)
|
||||
|
||||
|
||||
.. method:: evaluate(self, X, y, Xid)
|
||||
|
||||
|
||||
.. method:: predict(self, X, Xid)
|
||||
.. method:: predict(self, X: Iterable[str]) -> List[DocumentPredictions]
|
||||
|
||||
|
||||
.. method:: predict_proba(self, X, Xid)
|
||||
.. method:: predict_proba(self, X: Iterable[str], **kwargs) -> List[DocumentPredictionProbabilities]
|
||||
|
||||
|
||||
.. method:: next_example(self, X, Xid)
|
||||
@@ -66,10 +87,10 @@ Classes
|
||||
.. method:: add_label(self, entity)
|
||||
|
||||
|
||||
.. method:: save_model(self, model_path)
|
||||
.. method:: save_model(self, model_name)
|
||||
|
||||
|
||||
.. method:: load_model(self, model_path)
|
||||
.. method:: load_model(self, model_name)
|
||||
|
||||
|
||||
|
||||
|
||||
4
docs/build/html/autoapi/index.html
vendored
4
docs/build/html/autoapi/index.html
vendored
@@ -65,6 +65,10 @@
|
||||
<li class="toctree-l4"><a class="reference internal" href="pine/backend/annotations/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.annotations.bp</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="pine/backend/api/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pine/backend/api/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="pine/backend/auth/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth</span></code></a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pine/backend/auth/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth.bp</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pine/backend/auth/eve/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth.eve</span></code></a></li>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<script src="../../../../../_static/bizstyle.js"></script>
|
||||
<link rel="index" title="Index" href="../../../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../../../search.html" />
|
||||
<link rel="next" title="pine.backend.auth" href="../../auth/index.html" />
|
||||
<link rel="next" title="pine.backend.api" href="../../api/index.html" />
|
||||
<link rel="prev" title="pine.backend.annotations" href="../index.html" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||
<!--[if lt IE 9]>
|
||||
@@ -35,7 +35,7 @@
|
||||
<a href="../../../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../../auth/index.html" title="pine.backend.auth"
|
||||
<a href="../../api/index.html" title="pine.backend.api"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../index.html" title="pine.backend.annotations"
|
||||
@@ -271,8 +271,8 @@ request to create a new entry.
|
||||
<p class="topless"><a href="../index.html"
|
||||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.annotations</span></code></a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../../auth/index.html"
|
||||
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth</span></code></a></p>
|
||||
<p class="topless"><a href="../../api/index.html"
|
||||
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
@@ -304,7 +304,7 @@ request to create a new entry.
|
||||
<a href="../../../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../../auth/index.html" title="pine.backend.auth"
|
||||
<a href="../../api/index.html" title="pine.backend.api"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../index.html" title="pine.backend.annotations"
|
||||
|
||||
198
docs/build/html/autoapi/pine/backend/api/bp/index.html
vendored
Normal file
198
docs/build/html/autoapi/pine/backend/api/bp/index.html
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
|
||||
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pine.backend.api.bp — pine documentation</title>
|
||||
<link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../../../_static/bizstyle.css" type="text/css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../_static/graphviz.css" />
|
||||
|
||||
<script id="documentation_options" data-url_root="../../../../../" src="../../../../../_static/documentation_options.js"></script>
|
||||
<script src="../../../../../_static/jquery.js"></script>
|
||||
<script src="../../../../../_static/underscore.js"></script>
|
||||
<script src="../../../../../_static/doctools.js"></script>
|
||||
<script src="../../../../../_static/bizstyle.js"></script>
|
||||
<link rel="index" title="Index" href="../../../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../../../search.html" />
|
||||
<link rel="next" title="pine.backend.auth" href="../../auth/index.html" />
|
||||
<link rel="prev" title="pine.backend.api" href="../index.html" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/css3-mediaqueries.js"></script>
|
||||
<![endif]-->
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../../../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../../auth/index.html" title="pine.backend.auth"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../index.html" title="pine.backend.api"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../../../index.html">pine documentation</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../../../index.html" >API Reference</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-4"><a href="../index.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<div class="section" id="module-pine.backend.api.bp">
|
||||
<span id="pine-backend-api-bp"></span><h1><a class="reference internal" href="#module-pine.backend.api.bp" title="pine.backend.api.bp"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a><a class="headerlink" href="#module-pine.backend.api.bp" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="module-contents">
|
||||
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="functions">
|
||||
<h3>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h3>
|
||||
<table class="longtable docutils align-default">
|
||||
<colgroup>
|
||||
<col style="width: 10%" />
|
||||
<col style="width: 90%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.api.bp.openapi_spec" title="pine.backend.api.bp.openapi_spec"><code class="xref py py-obj docutils literal notranslate"><span class="pre">openapi_spec</span></code></a>()</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.api.bp.swagger_ui_index" title="pine.backend.api.bp.swagger_ui_index"><code class="xref py py-obj docutils literal notranslate"><span class="pre">swagger_ui_index</span></code></a>()</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.api.bp.swagger_ui" title="pine.backend.api.bp.swagger_ui"><code class="xref py py-obj docutils literal notranslate"><span class="pre">swagger_ui</span></code></a>(file: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.api.bp.init_app" title="pine.backend.api.bp.init_app"><code class="xref py py-obj docutils literal notranslate"><span class="pre">init_app</span></code></a>(app)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<dl class="py data">
|
||||
<dt id="pine.backend.api.bp.bp">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.api.bp.</span></code><code class="sig-name descname"><span class="pre">bp</span></code><a class="headerlink" href="#pine.backend.api.bp.bp" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py data">
|
||||
<dt id="pine.backend.api.bp.LOGGER">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.api.bp.</span></code><code class="sig-name descname"><span class="pre">LOGGER</span></code><a class="headerlink" href="#pine.backend.api.bp.LOGGER" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.api.bp.openapi_spec">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.api.bp.</span></code><code class="sig-name descname"><span class="pre">openapi_spec</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.api.bp.openapi_spec" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.api.bp.swagger_ui_index">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.api.bp.</span></code><code class="sig-name descname"><span class="pre">swagger_ui_index</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.api.bp.swagger_ui_index" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.api.bp.swagger_ui">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.api.bp.</span></code><code class="sig-name descname"><span class="pre">swagger_ui</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.api.bp.swagger_ui" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.api.bp.init_app">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.api.bp.</span></code><code class="sig-name descname"><span class="pre">init_app</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">app</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.api.bp.init_app" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a><ul>
|
||||
<li><a class="reference internal" href="#module-contents">Module Contents</a><ul>
|
||||
<li><a class="reference internal" href="#functions">Functions</a><ul>
|
||||
<li><a class="reference internal" href="#pine.backend.api.bp.bp">bp</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.api.bp.LOGGER">LOGGER</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.api.bp.openapi_spec">openapi_spec</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.api.bp.swagger_ui_index">swagger_ui_index</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.api.bp.swagger_ui">swagger_ui</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.api.bp.init_app">init_app</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../index.html"
|
||||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../../auth/index.html"
|
||||
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth</span></code></a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../../../_sources/autoapi/pine/backend/api/bp/index.rst.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="searchbox" style="display: none" role="search">
|
||||
<h3 id="searchlabel">Quick search</h3>
|
||||
<div class="searchformwrapper">
|
||||
<form class="search" action="../../../../../search.html" method="get">
|
||||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||||
<input type="submit" value="Go" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../../../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../../auth/index.html" title="pine.backend.auth"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../index.html" title="pine.backend.api"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../../../index.html">pine documentation</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../../../index.html" >API Reference</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-4"><a href="../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer" role="contentinfo">
|
||||
© Copyright (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC..
|
||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
139
docs/build/html/autoapi/pine/backend/api/index.html
vendored
Normal file
139
docs/build/html/autoapi/pine/backend/api/index.html
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
|
||||
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>pine.backend.api — pine documentation</title>
|
||||
<link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../../_static/bizstyle.css" type="text/css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../../../_static/graphviz.css" />
|
||||
|
||||
<script id="documentation_options" data-url_root="../../../../" src="../../../../_static/documentation_options.js"></script>
|
||||
<script src="../../../../_static/jquery.js"></script>
|
||||
<script src="../../../../_static/underscore.js"></script>
|
||||
<script src="../../../../_static/doctools.js"></script>
|
||||
<script src="../../../../_static/bizstyle.js"></script>
|
||||
<link rel="index" title="Index" href="../../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../../search.html" />
|
||||
<link rel="next" title="pine.backend.api.bp" href="bp/index.html" />
|
||||
<link rel="prev" title="pine.backend.annotations.bp" href="../annotations/bp/index.html" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/css3-mediaqueries.js"></script>
|
||||
<![endif]-->
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="bp/index.html" title="pine.backend.api.bp"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../annotations/bp/index.html" title="pine.backend.annotations.bp"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../../index.html">pine documentation</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../../index.html" >API Reference</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="../index.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<div class="section" id="module-pine.backend.api">
|
||||
<span id="pine-backend-api"></span><h1><a class="reference internal" href="#module-pine.backend.api" title="pine.backend.api"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a><a class="headerlink" href="#module-pine.backend.api" title="Permalink to this headline">¶</a></h1>
|
||||
<p>This module implements all methods required for SwaggerUI to run on the
|
||||
backend of PINE.</p>
|
||||
<div class="section" id="submodules">
|
||||
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a><ul>
|
||||
<li><a class="reference internal" href="#submodules">Submodules</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../annotations/bp/index.html"
|
||||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.annotations.bp</span></code></a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="bp/index.html"
|
||||
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../../_sources/autoapi/pine/backend/api/index.rst.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="searchbox" style="display: none" role="search">
|
||||
<h3 id="searchlabel">Quick search</h3>
|
||||
<div class="searchformwrapper">
|
||||
<form class="search" action="../../../../search.html" method="get">
|
||||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||||
<input type="submit" value="Go" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="bp/index.html" title="pine.backend.api.bp"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../annotations/bp/index.html" title="pine.backend.annotations.bp"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../../index.html">pine documentation</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../../index.html" >API Reference</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend</span></code></a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer" role="contentinfo">
|
||||
© Copyright (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC..
|
||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -19,7 +19,7 @@
|
||||
<link rel="index" title="Index" href="../../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../../search.html" />
|
||||
<link rel="next" title="pine.backend.auth.bp" href="bp/index.html" />
|
||||
<link rel="prev" title="pine.backend.annotations.bp" href="../annotations/bp/index.html" />
|
||||
<link rel="prev" title="pine.backend.api.bp" href="../api/bp/index.html" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="_static/css3-mediaqueries.js"></script>
|
||||
@@ -38,7 +38,7 @@
|
||||
<a href="bp/index.html" title="pine.backend.auth.bp"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../annotations/bp/index.html" title="pine.backend.annotations.bp"
|
||||
<a href="../api/bp/index.html" title="pine.backend.api.bp"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../../index.html">pine documentation</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../../index.html" >API Reference</a> »</li>
|
||||
@@ -147,8 +147,8 @@
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../annotations/bp/index.html"
|
||||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.annotations.bp</span></code></a></p>
|
||||
<p class="topless"><a href="../api/bp/index.html"
|
||||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="bp/index.html"
|
||||
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth.bp</span></code></a></p>
|
||||
@@ -186,7 +186,7 @@
|
||||
<a href="bp/index.html" title="pine.backend.auth.bp"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../annotations/bp/index.html" title="pine.backend.annotations.bp"
|
||||
<a href="../api/bp/index.html" title="pine.backend.api.bp"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../../index.html">pine documentation</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../../index.html" >API Reference</a> »</li>
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.collections.bp.add_label_to_collection" title="pine.backend.collections.bp.add_label_to_collection"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_label_to_collection</span></code></a>(collection_id)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.collections.bp.get_overlap_ids" title="pine.backend.collections.bp.get_overlap_ids"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_overlap_ids</span></code></a>(collection_id)</p></td>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.collections.bp.get_overlap_ids" title="pine.backend.collections.bp.get_overlap_ids"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_overlap_ids</span></code></a>(collection_id: str)</p></td>
|
||||
<td><p>Return the list of ids for overlapping documents for the collection matching the provided collection id.</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.collections.bp._upload_documents" title="pine.backend.collections.bp._upload_documents"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_upload_documents</span></code></a>(collection, docs)</p></td>
|
||||
@@ -296,7 +296,7 @@ pages.
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.collections.bp.get_overlap_ids">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.collections.bp.</span></code><code class="sig-name descname"><span class="pre">get_overlap_ids</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.collections.bp.get_overlap_ids" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.collections.bp.</span></code><code class="sig-name descname"><span class="pre">get_overlap_ids</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.collections.bp.get_overlap_ids" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return the list of ids for overlapping documents for the collection matching the provided collection id.
|
||||
:param collection_id: str
|
||||
:return: tuple</p>
|
||||
|
||||
@@ -87,6 +87,9 @@ front-end and store the collections in the backend</p>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.collections.get_user_permissions_by_ids" title="pine.backend.collections.get_user_permissions_by_ids"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_user_permissions_by_ids</span></code></a>(collection_ids: Iterable[str]) → List[models.CollectionUserPermissions]</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.collections.get_overlap_ids" title="pine.backend.collections.get_overlap_ids"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_overlap_ids</span></code></a>(collection_id: str)</p></td>
|
||||
<td><p>Return the list of ids for overlapping documents for the collection matching the provided collection id.</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<dl class="py function">
|
||||
@@ -109,6 +112,14 @@ front-end and store the collections in the backend</p>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.collections.</span></code><code class="sig-name descname"><span class="pre">get_user_permissions_by_ids</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">models.CollectionUserPermissions</span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.backend.collections.get_user_permissions_by_ids" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.collections.get_overlap_ids">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.collections.</span></code><code class="sig-name descname"><span class="pre">get_overlap_ids</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.collections.get_overlap_ids" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return the list of ids for overlapping documents for the collection matching the provided collection id.
|
||||
:param collection_id: str
|
||||
:return: tuple</p>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -130,6 +141,7 @@ front-end and store the collections in the backend</p>
|
||||
<li><a class="reference internal" href="#pine.backend.collections.get_user_permissions">get_user_permissions</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.collections.get_user_permissions_by_id">get_user_permissions_by_id</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.collections.get_user_permissions_by_ids">get_user_permissions_by_ids</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.collections.get_overlap_ids">get_overlap_ids</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -231,7 +231,7 @@ type of strings that is combined with a ‘/’.</p>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.data.service.get">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.get" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.get" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Wraps requests.get for the given eve-relative path.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
@@ -245,14 +245,14 @@ type of strings that is combined with a ‘/’.</p>
|
||||
<dd class="field-even"><p>server response</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.data.service.post">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">post</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.post" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">post</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.post" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Wraps requests.post for the given eve-relative path.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
@@ -266,14 +266,14 @@ type of strings that is combined with a ‘/’.</p>
|
||||
<dd class="field-even"><p>server response</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.data.service.put">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">put</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.put" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">put</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.put" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Wraps requests.put for the given eve-relative path.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
@@ -287,14 +287,14 @@ type of strings that is combined with a ‘/’.</p>
|
||||
<dd class="field-even"><p>server response</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.data.service.delete">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">delete</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.delete" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">delete</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.delete" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Wraps requests.delete for the given eve-relative path.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
@@ -308,14 +308,14 @@ type of strings that is combined with a ‘/’.</p>
|
||||
<dd class="field-even"><p>server response</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.data.service.patch">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">patch</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.patch" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">patch</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pine.backend.data.service.PATH_TYPE" title="pine.backend.data.service.PATH_TYPE"><span class="pre">PATH_TYPE</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.backend.data.service.patch" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Wraps requests.patch for the given eve-relative path.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
@@ -329,7 +329,7 @@ type of strings that is combined with a ‘/’.</p>
|
||||
<dd class="field-even"><p>server response</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
@@ -419,7 +419,7 @@ JSON with “_items”, “_meta”, etc.</p>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.data.service.convert_response">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">convert_response</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">requests_response</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://flask.palletsprojects.com/en/1.1.x/api/#flask.Response" title="(in Flask v1.1.x)"><span class="pre">flask.Response</span></a><a class="headerlink" href="#pine.backend.data.service.convert_response" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.data.service.</span></code><code class="sig-name descname"><span class="pre">convert_response</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">requests_response</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://flask.palletsprojects.com/en/1.1.x/api/#flask.Response" title="(in Flask v1.1.x)"><span class="pre">flask.Response</span></a><a class="headerlink" href="#pine.backend.data.service.convert_response" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Converts a requests response to a flask response.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="annotations/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.annotations.bp</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="auth/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth</span></code></a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="auth/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth.bp</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="auth/eve/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth.eve</span></code></a></li>
|
||||
|
||||
@@ -66,7 +66,10 @@
|
||||
<col style="width: 90%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager" title="pine.backend.job_manager.service.ServiceManager"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ServiceManager</span></code></a></p></td>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.job_manager.service.ServiceJob" title="pine.backend.job_manager.service.ServiceJob"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ServiceJob</span></code></a></p></td>
|
||||
<td><p>Data class for a service job.</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager" title="pine.backend.job_manager.service.ServiceManager"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ServiceManager</span></code></a></p></td>
|
||||
<td><p><dl class="field-list simple">
|
||||
<dt class="field-odd">type default_handler</dt>
|
||||
<dd class="field-odd"><p>callable</p>
|
||||
@@ -86,6 +89,23 @@
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.job_manager.service.</span></code><code class="sig-name descname"><span class="pre">logger</span></code><a class="headerlink" href="#pine.backend.job_manager.service.logger" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py class">
|
||||
<dt id="pine.backend.job_manager.service.ServiceJob">
|
||||
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">pine.backend.job_manager.service.</span></code><code class="sig-name descname"><span class="pre">ServiceJob</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">job_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_body</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_response</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceJob" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>Data class for a service job.</p>
|
||||
<p>“Constructor.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>job_id</strong> – str: job ID</p></li>
|
||||
<li><p><strong>request_body</strong> – dict: job request body</p></li>
|
||||
<li><p><strong>request_response</strong> – dict: job request response</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py class">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager">
|
||||
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">pine.backend.job_manager.service.</span></code><code class="sig-name descname"><span class="pre">ServiceManager</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default_handler</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -197,6 +217,16 @@
|
||||
<code class="sig-name descname"><span class="pre">reserved_channels</span></code><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.reserved_channels" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.get_results_key">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">get_results_key</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">job_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.get_results_key" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.get_running_jobs_key">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">get_running_jobs_key</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.get_running_jobs_key" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.get_registered_channels">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">get_registered_channels</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_ttl</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.get_registered_channels" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -221,9 +251,19 @@
|
||||
:rtype: list[str] | list[dict]</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager._get_service_details">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">_get_service_details</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">retry_count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager._get_service_details" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager._get_service_channel">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">_get_service_channel</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager._get_service_channel" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.send_service_request">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">send_service_request</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">job_id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">encoder</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.send_service_request" title="Permalink to this definition">¶</a></dt>
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">send_service_request</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">job_id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">encoder</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.send_service_request" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Queue’s a job for the requested service.
|
||||
:type service_name: str
|
||||
:type data: dict
|
||||
@@ -232,6 +272,36 @@
|
||||
:rtype: None | dict</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.get_job_response">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">get_job_response</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">job_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_in_s</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><span class="pre">int</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.get_job_response" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Waits for a response for the given job and returns it.
|
||||
:param service_name: str: service name
|
||||
:param job_id: str: job ID
|
||||
:param timeout_in_s: int: wait timeout in seconds
|
||||
:rtype None | dict</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.send_service_request_and_get_response">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">send_service_request_and_get_response</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_in_s</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">job_id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">encoder</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> → <a class="reference internal" href="#pine.backend.job_manager.service.ServiceJob" title="pine.backend.job_manager.service.ServiceJob"><span class="pre">pine.backend.job_manager.service.ServiceJob</span></a><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.send_service_request_and_get_response" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Sends a service requests, waits for a response, and returns job data.
|
||||
:param service_name: str: service name
|
||||
:param data: job data
|
||||
:param timeout_in_s: int: wait timeout in seconds
|
||||
:param job_id: str: optional job ID (or None to auto-generate one)
|
||||
:param encoder: optional JSON encoder for job data
|
||||
:rtype None | ServiceJob</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.get_running_jobs">
|
||||
<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">get_running_jobs</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.get_running_jobs" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns running jobs.
|
||||
:param service_name: str: service name
|
||||
:rtype list[str]</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.backend.job_manager.service.ServiceManager.start_listeners">
|
||||
<code class="sig-name descname"><span class="pre">start_listeners</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.job_manager.service.ServiceManager.start_listeners" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -328,6 +398,7 @@ Runs a handler when a processing message gets send over an already registered ch
|
||||
<li><a class="reference internal" href="#classes">Classes</a><ul>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.config">config</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.logger">logger</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceJob">ServiceJob</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager">ServiceManager</a><ul>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.r_pool">r_pool</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.r_conn">r_conn</a></li>
|
||||
@@ -350,10 +421,17 @@ Runs a handler when a processing message gets send over an already registered ch
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.shutdown_channel">shutdown_channel</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.registration_channel">registration_channel</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.reserved_channels">reserved_channels</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.get_results_key">get_results_key</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.get_running_jobs_key">get_running_jobs_key</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.get_registered_channels">get_registered_channels</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.get_registered_service_details">get_registered_service_details</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.get_registered_services">get_registered_services</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager._get_service_details">_get_service_details</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager._get_service_channel">_get_service_channel</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.send_service_request">send_service_request</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.get_job_response">get_job_response</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.send_service_request_and_get_response">send_service_request_and_get_response</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.get_running_jobs">get_running_jobs</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.start_listeners">start_listeners</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager.stop_listeners">stop_listeners</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.job_manager.service.ServiceManager._start_registration_listener">_start_registration_listener</a></li>
|
||||
|
||||
@@ -66,43 +66,73 @@
|
||||
<col style="width: 90%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier" title="pine.backend.pipelines.bp._get_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_classifier</span></code></a>(classifier_id: str) → dict</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._clear_classifier" title="pine.backend.pipelines.bp._clear_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_clear_classifier</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier_pipeline" title="pine.backend.pipelines.bp._get_classifier_pipeline"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_classifier_pipeline</span></code></a>(classifier_id: str) → dict</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._check_permissions" title="pine.backend.pipelines.bp._check_permissions"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_check_permissions</span></code></a>(classifier: dict)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_pipeline_status" title="pine.backend.pipelines.bp._get_pipeline_status"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_pipeline_status</span></code></a>(pipeline: str, classifier_id: str) → dict</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_pipeline_running_jobs" title="pine.backend.pipelines.bp._get_pipeline_running_jobs"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_pipeline_running_jobs</span></code></a>(pipeline: str, classifier_id: str) → List[str]</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._train_pipeline" title="pine.backend.pipelines.bp._train_pipeline"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_train_pipeline</span></code></a>(pipeline: str, classifier_id: str, model_name: str) → dict</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._predict_pipeline" title="pine.backend.pipelines.bp._predict_pipeline"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_predict_pipeline</span></code></a>(pipeline: str, classifier_id: str, document_ids: List[str], texts: List[str], timeout_in_s: int) → dict</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_pipelines" title="pine.backend.pipelines.bp.get_pipelines"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_pipelines</span></code></a>()</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_pipeline_by_id" title="pine.backend.pipelines.bp.get_pipeline_by_id"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_pipeline_by_id</span></code></a>(pipeline_id)</p></td>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_pipeline_by_id" title="pine.backend.pipelines.bp.get_pipeline_by_id"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_pipeline_by_id</span></code></a>(pipeline_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_collection_classifier" title="pine.backend.pipelines.bp._get_collection_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_collection_classifier</span></code></a>(collection_id)</p></td>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_pipeline_status" title="pine.backend.pipelines.bp.get_pipeline_status"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_pipeline_status</span></code></a>(pipeline_id: str) → flask.Response</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_collection_classifier" title="pine.backend.pipelines.bp.get_collection_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_collection_classifier</span></code></a>(collection_id)</p></td>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier_metrics" title="pine.backend.pipelines.bp._get_classifier_metrics"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_classifier_metrics</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier_metrics" title="pine.backend.pipelines.bp._get_classifier_metrics"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_classifier_metrics</span></code></a>(classifier_id)</p></td>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_classifier_metrics" title="pine.backend.pipelines.bp.get_classifier_metrics"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_classifier_metrics</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_metrics" title="pine.backend.pipelines.bp.get_metrics"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_metrics</span></code></a>()</p></td>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_collection_classifier" title="pine.backend.pipelines.bp._get_collection_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_collection_classifier</span></code></a>(collection_id: str) → dict</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_classifier_metrics" title="pine.backend.pipelines.bp.get_classifier_metrics"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_classifier_metrics</span></code></a>(classifier_id)</p></td>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_collection_classifier" title="pine.backend.pipelines.bp.get_collection_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_collection_classifier</span></code></a>(collection_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier" title="pine.backend.pipelines.bp._get_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_classifier</span></code></a>(classifier_id)</p></td>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_classifier_status" title="pine.backend.pipelines.bp.get_classifier_status"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_classifier_status</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_next_instance" title="pine.backend.pipelines.bp._get_next_instance"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_next_instance</span></code></a>(classifier_id)</p></td>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_running_jobs" title="pine.backend.pipelines.bp.get_running_jobs"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_running_jobs</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_next_by_classifier" title="pine.backend.pipelines.bp.get_next_by_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_next_by_classifier</span></code></a>(classifier_id)</p></td>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.train" title="pine.backend.pipelines.bp.train"><code class="xref py py-obj docutils literal notranslate"><span class="pre">train</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.advance_to_next_document_by_classifier" title="pine.backend.pipelines.bp.advance_to_next_document_by_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">advance_to_next_document_by_classifier</span></code></a>(classifier_id, document_id)</p></td>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.predict" title="pine.backend.pipelines.bp.predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.predict" title="pine.backend.pipelines.bp.predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict</span></code></a>()</p></td>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._get_next_instance" title="pine.backend.pipelines.bp._get_next_instance"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_get_next_instance</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.test_redis" title="pine.backend.pipelines.bp.test_redis"><code class="xref py py-obj docutils literal notranslate"><span class="pre">test_redis</span></code></a>()</p></td>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp._check_instance_overlap" title="pine.backend.pipelines.bp._check_instance_overlap"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_check_instance_overlap</span></code></a>(classifier: dict, instance: dict, user_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.get_next_by_classifier" title="pine.backend.pipelines.bp.get_next_by_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_next_by_classifier</span></code></a>(classifier_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.advance_to_next_document_by_classifier" title="pine.backend.pipelines.bp.advance_to_next_document_by_classifier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">advance_to_next_document_by_classifier</span></code></a>(classifier_id: str, document_id: str)</p></td>
|
||||
<td><p></p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="#pine.backend.pipelines.bp.init_app" title="pine.backend.pipelines.bp.init_app"><code class="xref py py-obj docutils literal notranslate"><span class="pre">init_app</span></code></a>(app)</p></td>
|
||||
@@ -126,13 +156,53 @@
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py data">
|
||||
<dt id="pine.backend.pipelines.bp.classifier_dict">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">classifier_dict</span></code><a class="headerlink" href="#pine.backend.pipelines.bp.classifier_dict" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp._cached_classifiers">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_cached_classifiers</span></code><a class="headerlink" href="#pine.backend.pipelines.bp._cached_classifiers" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py data">
|
||||
<dt id="pine.backend.pipelines.bp.classifier_pipelines">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">classifier_pipelines</span></code><a class="headerlink" href="#pine.backend.pipelines.bp.classifier_pipelines" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp._cached_classifier_pipelines">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_cached_classifier_pipelines</span></code><a class="headerlink" href="#pine.backend.pipelines.bp._cached_classifier_pipelines" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.backend.pipelines.bp._get_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._clear_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_clear_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._clear_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_classifier_pipeline">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_classifier_pipeline</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.backend.pipelines.bp._get_classifier_pipeline" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._check_permissions">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_check_permissions</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._check_permissions" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_pipeline_status">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_pipeline_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.backend.pipelines.bp._get_pipeline_status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_pipeline_running_jobs">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_pipeline_running_jobs</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.backend.pipelines.bp._get_pipeline_running_jobs" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._train_pipeline">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_train_pipeline</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">model_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.backend.pipelines.bp._train_pipeline" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._predict_pipeline">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_predict_pipeline</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">texts</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_in_s</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><span class="pre">int</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.backend.pipelines.bp._predict_pipeline" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
@@ -142,62 +212,72 @@
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.get_pipeline_by_id">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_pipeline_by_id</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_pipeline_by_id" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_pipeline_by_id</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_pipeline_by_id" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_collection_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_collection_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._get_collection_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.get_collection_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_collection_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_collection_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp.get_pipeline_status">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_pipeline_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://flask.palletsprojects.com/en/1.1.x/api/#flask.Response" title="(in Flask v1.1.x)"><span class="pre">flask.Response</span></a><a class="headerlink" href="#pine.backend.pipelines.bp.get_pipeline_status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_classifier_metrics">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_classifier_metrics</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._get_classifier_metrics" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.get_metrics">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_metrics</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_metrics" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_classifier_metrics</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._get_classifier_metrics" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.get_classifier_metrics">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_classifier_metrics</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_classifier_metrics" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_classifier_metrics</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_classifier_metrics" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._get_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp._get_collection_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_collection_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.backend.pipelines.bp._get_collection_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._get_next_instance">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_next_instance</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._get_next_instance" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp.get_collection_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_collection_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_collection_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.get_next_by_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_next_by_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_next_by_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp.get_classifier_status">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_classifier_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_classifier_status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.advance_to_next_document_by_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">advance_to_next_document_by_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.advance_to_next_document_by_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp.get_running_jobs">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_running_jobs</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_running_jobs" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.train">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">train</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.train" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.predict">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">predict</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.predict" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">predict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.predict" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.test_redis">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">test_redis</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.test_redis" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pine.backend.pipelines.bp._get_next_instance">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_get_next_instance</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._get_next_instance" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp._check_instance_overlap">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">_check_instance_overlap</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">instance</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">user_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp._check_instance_overlap" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.get_next_by_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">get_next_by_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.get_next_by_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt id="pine.backend.pipelines.bp.advance_to_next_document_by_classifier">
|
||||
<code class="sig-prename descclassname"><span class="pre">pine.backend.pipelines.bp.</span></code><code class="sig-name descname"><span class="pre">advance_to_next_document_by_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.backend.pipelines.bp.advance_to_next_document_by_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
@@ -224,21 +304,31 @@
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.logger">logger</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.service_manager">service_manager</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.bp">bp</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.classifier_dict">classifier_dict</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.classifier_pipelines">classifier_pipelines</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._cached_classifiers">_cached_classifiers</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._cached_classifier_pipelines">_cached_classifier_pipelines</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier">_get_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._clear_classifier">_clear_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier_pipeline">_get_classifier_pipeline</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._check_permissions">_check_permissions</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_pipeline_status">_get_pipeline_status</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_pipeline_running_jobs">_get_pipeline_running_jobs</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._train_pipeline">_train_pipeline</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._predict_pipeline">_predict_pipeline</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_pipelines">get_pipelines</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_pipeline_by_id">get_pipeline_by_id</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_pipeline_status">get_pipeline_status</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier_metrics">_get_classifier_metrics</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_classifier_metrics">get_classifier_metrics</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_collection_classifier">_get_collection_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_collection_classifier">get_collection_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier_metrics">_get_classifier_metrics</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_metrics">get_metrics</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_classifier_metrics">get_classifier_metrics</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_classifier">_get_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_classifier_status">get_classifier_status</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_running_jobs">get_running_jobs</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.train">train</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.predict">predict</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._get_next_instance">_get_next_instance</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp._check_instance_overlap">_check_instance_overlap</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.get_next_by_classifier">get_next_by_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.advance_to_next_document_by_classifier">advance_to_next_document_by_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.predict">predict</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.test_redis">test_redis</a></li>
|
||||
<li><a class="reference internal" href="#pine.backend.pipelines.bp.init_app">init_app</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -152,7 +152,7 @@ are fully aware of the security consequences</p></li>
|
||||
<dd><p>The currently open session, or <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Session" title="(in Requests v2.25.1)">requests.Session</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Session" title="(in Requests v2.26.0)">requests.Session</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
@@ -205,145 +205,145 @@ security consequences of such.</p>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.BaseClient._req">
|
||||
<code class="sig-name descname"><span class="pre">_req</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient._req" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> call, checks for errors, and returns the response.</p>
|
||||
<code class="sig-name descname"><span class="pre">_req</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient._req" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> call, checks for errors, and returns the response.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>method</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – REST method (<code class="docutils literal notranslate"><span class="pre">"get"</span></code>, <code class="docutils literal notranslate"><span class="pre">"post"</span></code>, etc.)</p></li>
|
||||
<li><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – relative path, e.g. <code class="docutils literal notranslate"><span class="pre">"users"</span></code></p></li>
|
||||
<li><p><strong>*additional_paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a><em>(</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a><em>)</em><em>, </em><em>optional</em>) – any additional path components</p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">requests.Response</span></code></a> object</p>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">requests.Response</span></code></a> object</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.BaseClient.get">
|
||||
<code class="sig-name descname"><span class="pre">get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.get" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">GET</span></code> call, checks for errors, and returns the response.</p>
|
||||
<code class="sig-name descname"><span class="pre">get</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.get" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">GET</span></code> call, checks for errors, and returns the response.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – relative path, e.g. <code class="docutils literal notranslate"><span class="pre">"users"</span></code></p></li>
|
||||
<li><p><strong>*additional_paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a><em>(</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a><em>)</em><em>, </em><em>optional</em>) – any additional path components</p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.BaseClient.put">
|
||||
<code class="sig-name descname"><span class="pre">put</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.put" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">PUT</span></code> call, checks for errors, and returns the response.</p>
|
||||
<code class="sig-name descname"><span class="pre">put</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.put" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">PUT</span></code> call, checks for errors, and returns the response.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – relative path, e.g. <code class="docutils literal notranslate"><span class="pre">"users"</span></code></p></li>
|
||||
<li><p><strong>*additional_paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a><em>(</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a><em>)</em><em>, </em><em>optional</em>) – any additional path components</p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.BaseClient.patch">
|
||||
<code class="sig-name descname"><span class="pre">patch</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.patch" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">PATCH</span></code> call, checks for errors, and returns the response.</p>
|
||||
<code class="sig-name descname"><span class="pre">patch</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.patch" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">PATCH</span></code> call, checks for errors, and returns the response.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – relative path, e.g. <code class="docutils literal notranslate"><span class="pre">"users"</span></code></p></li>
|
||||
<li><p><strong>*additional_paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a><em>(</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a><em>)</em><em>, </em><em>optional</em>) – any additional path components</p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.BaseClient.post">
|
||||
<code class="sig-name descname"><span class="pre">post</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.post" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">POST</span></code> call, checks for errors, and returns the response.</p>
|
||||
<code class="sig-name descname"><span class="pre">post</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.post" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">POST</span></code> call, checks for errors, and returns the response.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – relative path, e.g. <code class="docutils literal notranslate"><span class="pre">"users"</span></code></p></li>
|
||||
<li><p><strong>*additional_paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a><em>(</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a><em>)</em><em>, </em><em>optional</em>) – any additional path components</p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.BaseClient.delete">
|
||||
<code class="sig-name descname"><span class="pre">delete</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.delete" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">DELETE</span></code> call, checks for errors, and returns the response.</p>
|
||||
<code class="sig-name descname"><span class="pre">delete</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">additional_paths</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a><a class="headerlink" href="#pine.client.client.BaseClient.delete" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Makes a <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <code class="docutils literal notranslate"><span class="pre">DELETE</span></code> call, checks for errors, and returns the response.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – relative path, e.g. <code class="docutils literal notranslate"><span class="pre">"users"</span></code></p></li>
|
||||
<li><p><strong>*additional_paths</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a><em>(</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a><em>)</em><em>, </em><em>optional</em>) – any additional path components</p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
<li><p><strong>**kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><em>dict</em></a>) – any additional kwargs to send to <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.25.1)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
<dd class="field-odd"><p>the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#module-requests" title="(in Requests v2.26.0)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">requests</span></code></a> <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> object</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
@@ -392,10 +392,10 @@ are fully aware of the security consequences</p></li>
|
||||
<dl class="py attribute">
|
||||
<dt id="pine.client.client.EveClient.mongo">
|
||||
<code class="sig-name descname"><span class="pre">mongo</span></code><em class="property"> <span class="pre">:pymongo.MongoClient</span></em><a class="headerlink" href="#pine.client.client.EveClient.mongo" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The <a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient" title="(in PyMongo v3.11.4)"><code class="xref py py-class docutils literal notranslate"><span class="pre">pymongo.mongo_client.MongoClient</span></code></a> instance.</p>
|
||||
<dd><p>The <a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient" title="(in PyMongo v3.12.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">pymongo.mongo_client.MongoClient</span></code></a> instance.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient" title="(in PyMongo v3.11.4)">pymongo.mongo_client.MongoClient</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient" title="(in PyMongo v3.12.0)">pymongo.mongo_client.MongoClient</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
@@ -403,10 +403,10 @@ are fully aware of the security consequences</p></li>
|
||||
<dl class="py attribute">
|
||||
<dt id="pine.client.client.EveClient.mongo_db">
|
||||
<code class="sig-name descname"><span class="pre">mongo_db</span></code><em class="property"> <span class="pre">:pymongo.database.Database</span></em><a class="headerlink" href="#pine.client.client.EveClient.mongo_db" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The <a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/database.html#pymongo.database.Database" title="(in PyMongo v3.11.4)"><code class="xref py py-class docutils literal notranslate"><span class="pre">pymongo.database.Database</span></code></a> instance.</p>
|
||||
<dd><p>The <a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/database.html#pymongo.database.Database" title="(in PyMongo v3.12.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">pymongo.database.Database</span></code></a> instance.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/database.html#pymongo.database.Database" title="(in PyMongo v3.11.4)">pymongo.database.Database</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://pymongo.readthedocs.io/en/stable/api/pymongo/database.html#pymongo.database.Database" title="(in PyMongo v3.12.0)">pymongo.database.Database</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
@@ -823,6 +823,23 @@ endpoint, e.g. containing fields “access_token”, “token_type”, “expire
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_pipeline_status">
|
||||
<code class="sig-name descname"><span class="pre">get_pipeline_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.get_pipeline_status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns status for the given pipeline.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>pipeline_id</strong> – str: pipeline ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>pipeline status</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.collection_builder">
|
||||
<code class="sig-name descname"><span class="pre">collection_builder</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference internal" href="../models/index.html#pine.client.models.CollectionBuilder" title="pine.client.models.CollectionBuilder"><span class="pre">pine.client.models.CollectionBuilder</span></a><a class="headerlink" href="#pine.client.client.PineClient.collection_builder" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -864,6 +881,26 @@ endpoint, e.g. containing fields “access_token”, “token_type”, “expire
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.archive_collection">
|
||||
<code class="sig-name descname"><span class="pre">archive_collection</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">archive</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><span class="pre">bool</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.archive_collection" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Archives or unarchives the given collection.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>collection_id</strong> – str: the ID of the collection</p></li>
|
||||
<li><p><strong>archive</strong> – bool: whether to archive (True) or unarchive (False) the collection</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>updated collection information</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_collection_permissions">
|
||||
<code class="sig-name descname"><span class="pre">get_collection_permissions</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference internal" href="../models/index.html#pine.client.models.CollectionUserPermissions" title="pine.client.models.CollectionUserPermissions"><span class="pre">pine.client.models.CollectionUserPermissions</span></a><a class="headerlink" href="#pine.client.client.PineClient.get_collection_permissions" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -902,6 +939,65 @@ endpoint, e.g. containing fields “access_token”, “token_type”, “expire
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_collection_classifier">
|
||||
<code class="sig-name descname"><span class="pre">get_collection_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.get_collection_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the classifier associated with the given collection.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>collection_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – the ID of the collection</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>the classifier associated with the given collection</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_next_document">
|
||||
<code class="sig-name descname"><span class="pre">get_next_document</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><a class="headerlink" href="#pine.client.client.PineClient.get_next_document" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the ‘next’ document associated with the given classifier.</p>
|
||||
<p>The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>classifier_id</strong> – str: ID of the classifier</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>the next document ID, or None if there are none left to annotate</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)">str</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.advance_next_document">
|
||||
<code class="sig-name descname"><span class="pre">advance_next_document</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.advance_next_document" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Advances the ‘next’ document associated with the given classifier by marking the
|
||||
given document as annotated.</p>
|
||||
<p>The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>classifier_id</strong> – str: ID of the classifier</p></li>
|
||||
<li><p><strong>document_id</strong> – str: the ID of the document that was annotated</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>information on the advanced instance</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.add_document">
|
||||
<code class="sig-name descname"><span class="pre">add_document</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">{}</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">creator_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">overlap</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><span class="pre">int</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><a class="headerlink" href="#pine.client.client.PineClient.add_document" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -1062,6 +1158,54 @@ This should only be <code class="docutils literal notranslate"><span class="pre"
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_my_document_annotations">
|
||||
<code class="sig-name descname"><span class="pre">get_my_document_annotations</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.client.PineClient.get_my_document_annotations" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns annotations for the given document for the logged in user.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>document_id</strong> – the ID of the document to get annotations for</p>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><ul class="simple">
|
||||
<li><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientValueException" title="pine.client.exceptions.PineClientValueException"><strong>exceptions.PineClientValueException</strong></a> – if the document ID is not a valid string</p></li>
|
||||
<li><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientAuthException" title="pine.client.exceptions.PineClientAuthException"><strong>exceptions.PineClientAuthException</strong></a> – if not logged in</p></li>
|
||||
<li><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the annotations for the given document for the logged in user</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a>))</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_others_document_annotations">
|
||||
<code class="sig-name descname"><span class="pre">get_others_document_annotations</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.client.PineClient.get_others_document_annotations" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns annotations for the given document for users other than the logged in user.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>document_id</strong> – the ID of the document to get annotations for</p>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><ul class="simple">
|
||||
<li><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientValueException" title="pine.client.exceptions.PineClientValueException"><strong>exceptions.PineClientValueException</strong></a> – if the document ID is not a valid string</p></li>
|
||||
<li><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientAuthException" title="pine.client.exceptions.PineClientAuthException"><strong>exceptions.PineClientAuthException</strong></a> – if not logged in</p></li>
|
||||
<li><p><a class="reference internal" href="../exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the annotations for the given document for users other than the logged in user</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a>))</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.list_collections">
|
||||
<code class="sig-name descname"><span class="pre">list_collections</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_archived</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><span class="pre">bool</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.client.PineClient.list_collections" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -1085,6 +1229,23 @@ This should only be <code class="docutils literal notranslate"><span class="pre"
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_collection">
|
||||
<code class="sig-name descname"><span class="pre">get_collection</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.get_collection" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the collection with the given ID.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>collection_id</strong> – str: the ID of the collection</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>the collection data</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_collection_iaa_report">
|
||||
<code class="sig-name descname"><span class="pre">get_collection_iaa_report</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.get_collection_iaa_report" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -1138,6 +1299,98 @@ collection doesn’t exist</p></li>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_classifier_status">
|
||||
<code class="sig-name descname"><span class="pre">get_classifier_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.get_classifier_status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the status for the given classifier.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Param</dt>
|
||||
<dd class="field-odd"><p>classifier_id: str: classifier ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>status for the given classifier</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.classifier_train">
|
||||
<code class="sig-name descname"><span class="pre">classifier_train</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">model_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">'auto-trained'</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.classifier_train" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Trains the given classifier (using collection documents).</p>
|
||||
<p>Note that training is done asynchronously, so this method should return very quickly. One
|
||||
of the things returned in the dict will be a job ID. If you want to know when the training
|
||||
has finished, you can periodically poll <a class="reference internal" href="#pine.client.client.PineClient.get_classifier_running_jobs" title="pine.client.client.PineClient.get_classifier_running_jobs"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_classifier_running_jobs()</span></code></a> and check
|
||||
for that job ID.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>classifier_id</strong> – str: classifier ID</p></li>
|
||||
<li><p><strong>model_name</strong> – str: name of model corresponding to filename on disk, defaults to
|
||||
<code class="docutils literal notranslate"><span class="pre">"auto-trained"</span></code> which is the same as the annotation-based
|
||||
model training</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.classifier_has_trained">
|
||||
<code class="sig-name descname"><span class="pre">classifier_has_trained</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><span class="pre">bool</span></a><a class="headerlink" href="#pine.client.client.PineClient.classifier_has_trained" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns whether the given classifier has been trained or not.</p>
|
||||
<p>If False, future calls to predict will fail.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Param</dt>
|
||||
<dd class="field-odd"><p>classifier_id: str: classifier ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)">bool</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.classifier_predict">
|
||||
<code class="sig-name descname"><span class="pre">classifier_predict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">texts</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_in_s</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><span class="pre">int</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">36000</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.client.PineClient.classifier_predict" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Runs classifier prediction on the given documents. At least one of document_ids and
|
||||
texts must be non-empty.</p>
|
||||
<p>This prediction uses the last-trained model name for that classifier. This method will
|
||||
block until the prediction has finished and then return the results.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>classifier_id</strong> – str: classifier ID</p></li>
|
||||
<li><p><strong>document_ids</strong> – list[str]: a list of document IDs to run prediction on</p></li>
|
||||
<li><p><strong>texts</strong> – list[str]: a list of direct document texts to run prediction on</p></li>
|
||||
<li><p><strong>timeout_in_s</strong> – int: max timeout in seconds before erroring out and returning, defaults
|
||||
to <code class="docutils literal notranslate"><span class="pre">36000</span></code></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.client.PineClient.get_classifier_running_jobs">
|
||||
<code class="sig-name descname"><span class="pre">get_classifier_running_jobs</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.client.PineClient.get_classifier_running_jobs" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Gets the list of running job IDs for the given classifier.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>classifier_id</strong> – str: classifier ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)">str</a>]</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py class">
|
||||
@@ -1247,19 +1500,32 @@ are fully aware of the security consequences</p></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.authorize_vegas">authorize_vegas</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.logout">logout</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_pipelines">get_pipelines</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_pipeline_status">get_pipeline_status</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.collection_builder">collection_builder</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.create_collection">create_collection</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.archive_collection">archive_collection</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_collection_permissions">get_collection_permissions</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_collection_documents">get_collection_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_collection_classifier">get_collection_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_next_document">get_next_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.advance_next_document">advance_next_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.add_document">add_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.add_documents">add_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.delete_document">delete_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.delete_documents">delete_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.annotate_document">annotate_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.annotate_collection_documents">annotate_collection_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_my_document_annotations">get_my_document_annotations</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_others_document_annotations">get_others_document_annotations</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.list_collections">list_collections</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_collection">get_collection</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_collection_iaa_report">get_collection_iaa_report</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.download_collection_data">download_collection_data</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_classifier_status">get_classifier_status</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.classifier_train">classifier_train</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.classifier_has_trained">classifier_has_trained</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.classifier_predict">classifier_predict</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.client.PineClient.get_classifier_running_jobs">get_classifier_running_jobs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#pine.client.client.LocalPineClient">LocalPineClient</a><ul>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
<dl class="py exception">
|
||||
<dt id="pine.client.exceptions.PineClientHttpException">
|
||||
<em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">pine.client.exceptions.</span></code><code class="sig-name descname"><span class="pre">PineClientHttpException</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">resp</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><span class="pre">requests.Response</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.client.exceptions.PineClientHttpException" title="Permalink to this definition">¶</a></dt>
|
||||
<em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">pine.client.exceptions.</span></code><code class="sig-name descname"><span class="pre">PineClientHttpException</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">resp</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><span class="pre">requests.Response</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.client.exceptions.PineClientHttpException" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference internal" href="#pine.client.exceptions.PineClientException" title="pine.client.exceptions.PineClientException"><code class="xref py py-class docutils literal notranslate"><span class="pre">pine.client.exceptions.PineClientException</span></code></a></p>
|
||||
<p>A PINE client exception caused by an underlying HTTP exception.</p>
|
||||
<p>Constructor.</p>
|
||||
@@ -96,17 +96,17 @@
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>method</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – the REST method (<code class="docutils literal notranslate"><span class="pre">"get"</span></code>, <code class="docutils literal notranslate"><span class="pre">"post"</span></code>, etc.)</p></li>
|
||||
<li><p><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – the human-readable path that caused the exception</p></li>
|
||||
<li><p><strong>resp</strong> (<a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><em>requests.Response</em></a>) – the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> with the error info</p></li>
|
||||
<li><p><strong>resp</strong> (<a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><em>requests.Response</em></a>) – the <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> with the error info</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="py attribute">
|
||||
<dt id="pine.client.exceptions.PineClientHttpException.resp">
|
||||
<code class="sig-name descname"><span class="pre">resp</span></code><em class="property"> <span class="pre">:requests.Response</span></em><a class="headerlink" href="#pine.client.exceptions.PineClientHttpException.resp" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>The <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> with the error info</p>
|
||||
<dd><p>The <a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Response</span></code></a> with the error info</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.25.1)">requests.Response</a></p>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python-requests.org/en/master/api/#requests.Response" title="(in Requests v2.26.0)">requests.Response</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
266
docs/build/html/autoapi/pine/client/index.html
vendored
266
docs/build/html/autoapi/pine/client/index.html
vendored
@@ -326,6 +326,23 @@ endpoint, e.g. containing fields “access_token”, “token_type”, “expire
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_pipeline_status">
|
||||
<code class="sig-name descname"><span class="pre">get_pipeline_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.get_pipeline_status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns status for the given pipeline.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>pipeline_id</strong> – str: pipeline ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>pipeline status</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.collection_builder">
|
||||
<code class="sig-name descname"><span class="pre">collection_builder</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span></em><span class="sig-paren">)</span> → <a class="reference internal" href="models/index.html#pine.client.models.CollectionBuilder" title="pine.client.models.CollectionBuilder"><span class="pre">pine.client.models.CollectionBuilder</span></a><a class="headerlink" href="#pine.client.PineClient.collection_builder" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -367,6 +384,26 @@ endpoint, e.g. containing fields “access_token”, “token_type”, “expire
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.archive_collection">
|
||||
<code class="sig-name descname"><span class="pre">archive_collection</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">archive</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><span class="pre">bool</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.archive_collection" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Archives or unarchives the given collection.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>collection_id</strong> – str: the ID of the collection</p></li>
|
||||
<li><p><strong>archive</strong> – bool: whether to archive (True) or unarchive (False) the collection</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>updated collection information</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_collection_permissions">
|
||||
<code class="sig-name descname"><span class="pre">get_collection_permissions</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference internal" href="models/index.html#pine.client.models.CollectionUserPermissions" title="pine.client.models.CollectionUserPermissions"><span class="pre">pine.client.models.CollectionUserPermissions</span></a><a class="headerlink" href="#pine.client.PineClient.get_collection_permissions" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -405,6 +442,65 @@ endpoint, e.g. containing fields “access_token”, “token_type”, “expire
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_collection_classifier">
|
||||
<code class="sig-name descname"><span class="pre">get_collection_classifier</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.get_collection_classifier" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the classifier associated with the given collection.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>collection_id</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><em>str</em></a>) – the ID of the collection</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>the classifier associated with the given collection</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_next_document">
|
||||
<code class="sig-name descname"><span class="pre">get_next_document</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><a class="headerlink" href="#pine.client.PineClient.get_next_document" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the ‘next’ document associated with the given classifier.</p>
|
||||
<p>The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>classifier_id</strong> – str: ID of the classifier</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>the next document ID, or None if there are none left to annotate</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)">str</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.advance_next_document">
|
||||
<code class="sig-name descname"><span class="pre">advance_next_document</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.advance_next_document" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Advances the ‘next’ document associated with the given classifier by marking the
|
||||
given document as annotated.</p>
|
||||
<p>The next document is the one that the model suggests should be annotated by the logged-in
|
||||
user next.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>classifier_id</strong> – str: ID of the classifier</p></li>
|
||||
<li><p><strong>document_id</strong> – str: the ID of the document that was annotated</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>information on the advanced instance</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.add_document">
|
||||
<code class="sig-name descname"><span class="pre">add_document</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">{}</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">creator_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">overlap</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><span class="pre">int</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><a class="headerlink" href="#pine.client.PineClient.add_document" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -565,6 +661,54 @@ This should only be <code class="docutils literal notranslate"><span class="pre"
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_my_document_annotations">
|
||||
<code class="sig-name descname"><span class="pre">get_my_document_annotations</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.PineClient.get_my_document_annotations" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns annotations for the given document for the logged in user.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>document_id</strong> – the ID of the document to get annotations for</p>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><ul class="simple">
|
||||
<li><p><a class="reference internal" href="exceptions/index.html#pine.client.exceptions.PineClientValueException" title="pine.client.exceptions.PineClientValueException"><strong>exceptions.PineClientValueException</strong></a> – if the document ID is not a valid string</p></li>
|
||||
<li><p><a class="reference internal" href="exceptions/index.html#pine.client.exceptions.PineClientAuthException" title="pine.client.exceptions.PineClientAuthException"><strong>exceptions.PineClientAuthException</strong></a> – if not logged in</p></li>
|
||||
<li><p><a class="reference internal" href="exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the annotations for the given document for the logged in user</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a>))</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_others_document_annotations">
|
||||
<code class="sig-name descname"><span class="pre">get_others_document_annotations</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.PineClient.get_others_document_annotations" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns annotations for the given document for users other than the logged in user.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>document_id</strong> – the ID of the document to get annotations for</p>
|
||||
</dd>
|
||||
<dt class="field-even">Raises</dt>
|
||||
<dd class="field-even"><ul class="simple">
|
||||
<li><p><a class="reference internal" href="exceptions/index.html#pine.client.exceptions.PineClientValueException" title="pine.client.exceptions.PineClientValueException"><strong>exceptions.PineClientValueException</strong></a> – if the document ID is not a valid string</p></li>
|
||||
<li><p><a class="reference internal" href="exceptions/index.html#pine.client.exceptions.PineClientAuthException" title="pine.client.exceptions.PineClientAuthException"><strong>exceptions.PineClientAuthException</strong></a> – if not logged in</p></li>
|
||||
<li><p><a class="reference internal" href="exceptions/index.html#pine.client.exceptions.PineClientHttpException" title="pine.client.exceptions.PineClientHttpException"><strong>exceptions.PineClientHttpException</strong></a> – if the HTTP request returns an error</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-odd">Returns</dt>
|
||||
<dd class="field-odd"><p>the annotations for the given document for users other than the logged in user</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>(<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a>))</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.list_collections">
|
||||
<code class="sig-name descname"><span class="pre">list_collections</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_archived</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><span class="pre">bool</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.PineClient.list_collections" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -588,6 +732,23 @@ This should only be <code class="docutils literal notranslate"><span class="pre"
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_collection">
|
||||
<code class="sig-name descname"><span class="pre">get_collection</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.get_collection" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the collection with the given ID.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>collection_id</strong> – str: the ID of the collection</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>the collection data</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_collection_iaa_report">
|
||||
<code class="sig-name descname"><span class="pre">get_collection_iaa_report</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.get_collection_iaa_report" title="Permalink to this definition">¶</a></dt>
|
||||
@@ -641,6 +802,98 @@ collection doesn’t exist</p></li>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_classifier_status">
|
||||
<code class="sig-name descname"><span class="pre">get_classifier_status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.get_classifier_status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the status for the given classifier.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Param</dt>
|
||||
<dd class="field-odd"><p>classifier_id: str: classifier ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>status for the given classifier</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.classifier_train">
|
||||
<code class="sig-name descname"><span class="pre">classifier_train</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">model_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">'auto-trained'</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.classifier_train" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Trains the given classifier (using collection documents).</p>
|
||||
<p>Note that training is done asynchronously, so this method should return very quickly. One
|
||||
of the things returned in the dict will be a job ID. If you want to know when the training
|
||||
has finished, you can periodically poll <a class="reference internal" href="#pine.client.PineClient.get_classifier_running_jobs" title="pine.client.PineClient.get_classifier_running_jobs"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_classifier_running_jobs()</span></code></a> and check
|
||||
for that job ID.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>classifier_id</strong> – str: classifier ID</p></li>
|
||||
<li><p><strong>model_name</strong> – str: name of model corresponding to filename on disk, defaults to
|
||||
<code class="docutils literal notranslate"><span class="pre">"auto-trained"</span></code> which is the same as the annotation-based
|
||||
model training</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.classifier_has_trained">
|
||||
<code class="sig-name descname"><span class="pre">classifier_has_trained</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><span class="pre">bool</span></a><a class="headerlink" href="#pine.client.PineClient.classifier_has_trained" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns whether the given classifier has been trained or not.</p>
|
||||
<p>If False, future calls to predict will fail.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Param</dt>
|
||||
<dd class="field-odd"><p>classifier_id: str: classifier ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)">bool</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.classifier_predict">
|
||||
<code class="sig-name descname"><span class="pre">classifier_predict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">texts</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout_in_s</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><span class="pre">int</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">36000</span></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.client.PineClient.classifier_predict" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Runs classifier prediction on the given documents. At least one of document_ids and
|
||||
texts must be non-empty.</p>
|
||||
<p>This prediction uses the last-trained model name for that classifier. This method will
|
||||
block until the prediction has finished and then return the results.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>classifier_id</strong> – str: classifier ID</p></li>
|
||||
<li><p><strong>document_ids</strong> – list[str]: a list of document IDs to run prediction on</p></li>
|
||||
<li><p><strong>texts</strong> – list[str]: a list of direct document texts to run prediction on</p></li>
|
||||
<li><p><strong>timeout_in_s</strong> – int: max timeout in seconds before erroring out and returning, defaults
|
||||
to <code class="docutils literal notranslate"><span class="pre">36000</span></code></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.client.PineClient.get_classifier_running_jobs">
|
||||
<code class="sig-name descname"><span class="pre">get_classifier_running_jobs</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.client.PineClient.get_classifier_running_jobs" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Gets the list of running job IDs for the given classifier.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>classifier_id</strong> – str: classifier ID</p>
|
||||
</dd>
|
||||
<dt class="field-even">Return type</dt>
|
||||
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a>[<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)">str</a>]</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py class">
|
||||
@@ -1058,19 +1311,32 @@ defaults to <code class="docutils literal notranslate"><span class="pre">None</s
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.authorize_vegas">authorize_vegas</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.logout">logout</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_pipelines">get_pipelines</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_pipeline_status">get_pipeline_status</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.collection_builder">collection_builder</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.create_collection">create_collection</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.archive_collection">archive_collection</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_collection_permissions">get_collection_permissions</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_collection_documents">get_collection_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_collection_classifier">get_collection_classifier</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_next_document">get_next_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.advance_next_document">advance_next_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.add_document">add_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.add_documents">add_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.delete_document">delete_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.delete_documents">delete_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.annotate_document">annotate_document</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.annotate_collection_documents">annotate_collection_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_my_document_annotations">get_my_document_annotations</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_others_document_annotations">get_others_document_annotations</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.list_collections">list_collections</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_collection">get_collection</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_collection_iaa_report">get_collection_iaa_report</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.download_collection_data">download_collection_data</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_classifier_status">get_classifier_status</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.classifier_train">classifier_train</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.classifier_has_trained">classifier_has_trained</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.classifier_predict">classifier_predict</a></li>
|
||||
<li><a class="reference internal" href="#pine.client.PineClient.get_classifier_running_jobs">get_classifier_running_jobs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#pine.client.LocalPineClient">LocalPineClient</a><ul>
|
||||
|
||||
4
docs/build/html/autoapi/pine/index.html
vendored
4
docs/build/html/autoapi/pine/index.html
vendored
@@ -66,6 +66,10 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="backend/annotations/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.annotations.bp</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="backend/api/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="backend/api/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.api.bp</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="backend/auth/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="backend/auth/bp/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth.bp</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="backend/auth/eve/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.backend.auth.eve</span></code></a></li>
|
||||
|
||||
@@ -111,18 +111,57 @@
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.EveClient.EveClient.get_items">
|
||||
<code class="sig-name descname"><span class="pre">get_items</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">resource</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient.get_items" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-name descname"><span class="pre">get_items</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">resource</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">params</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient.get_items" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.EveClient.EveClient._get_documents_map">
|
||||
<code class="sig-name descname"><span class="pre">_get_documents_map</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">params</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">{}</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient._get_documents_map" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.EveClient.EveClient.get_documents">
|
||||
<code class="sig-name descname"><span class="pre">get_documents</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient.get_documents" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-name descname"><span class="pre">get_documents</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient.get_documents" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a document map where the document overlap is 0.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><p><strong>collection_id</strong> – str: the ID of the collection</p>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>a mapping from document ID to document text for non-overlap documents</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)">dict</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.EveClient.EveClient.get_documents_by_id">
|
||||
<code class="sig-name descname"><span class="pre">get_documents_by_id</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient.get_documents_by_id" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.EveClient.EveClient.get_docs_with_annotations">
|
||||
<code class="sig-name descname"><span class="pre">get_docs_with_annotations</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_map</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient.get_docs_with_annotations" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="sig-name descname"><span class="pre">get_docs_with_annotations</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">collection_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_map</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> → <span class="pre">Tuple</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.9)"><span class="pre">typing.List</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.9)"><span class="pre">typing.List</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.9)"><span class="pre">typing.List</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.List" title="(in Python v3.9)"><span class="pre">typing.List</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.pipelines.EveClient.EveClient.get_docs_with_annotations" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Gets document and annotation data. Only non-overlapping documents are returned.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>collection_id</strong> – str: the ID of the collection</p></li>
|
||||
<li><p><strong>doc_map</strong> – dict[str, str]: map of document IDs to document text</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>(documents, labels, doc_ids, ann_ids) where documents is a list of the texts,
|
||||
labels is a list of the annotations, doc_ids is a list of the document IDs, and
|
||||
ann_ids is a list of the annotation IDs</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.9)">tuple</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.EveClient.EveClient.update">
|
||||
@@ -156,7 +195,9 @@
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient.get_all_items">get_all_items</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient.get_all_ids">get_all_ids</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient.get_items">get_items</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient._get_documents_map">_get_documents_map</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient.get_documents">get_documents</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient.get_documents_by_id">get_documents_by_id</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient.get_docs_with_annotations">get_docs_with_annotations</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.EveClient.EveClient.update">update</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -84,20 +84,43 @@
|
||||
<dt id="pine.pipelines.NER_API.ner_api">
|
||||
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">pine.pipelines.NER_API.</span></code><code class="sig-name descname"><span class="pre">ner_api</span></code><a class="headerlink" href="#pine.pipelines.NER_API.ner_api" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.NER_API.ner_api.status">
|
||||
<code class="sig-name descname"><span class="pre">status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> → <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.status" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.NER_API.ner_api.perform_fold">
|
||||
<code class="sig-name descname"><span class="pre">perform_fold</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">train_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">test_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_parameters</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.perform_fold" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-name descname"><span class="pre">perform_fold</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../pmap_ner/index.html#pine.pipelines.pmap_ner.NER" title="pine.pipelines.pmap_ner.NER"><span class="pre">pine.pipelines.pmap_ner.NER</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">train_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">test_data</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">pipeline_parameters</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.perform_fold" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.NER_API.ner_api.perform_five_fold">
|
||||
<code class="sig-name descname"><span class="pre">perform_five_fold</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">documents</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">annotations</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_ids</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_parameters</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.perform_five_fold" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-name descname"><span class="pre">perform_five_fold</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../pmap_ner/index.html#pine.pipelines.pmap_ner.NER" title="pine.pipelines.pmap_ner.NER"><span class="pre">pine.pipelines.pmap_ner.NER</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">documents</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">annotations</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_ids</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">pipeline_parameters</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.perform_five_fold" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.NER_API.ner_api.get_document_ranking">
|
||||
<code class="sig-name descname"><span class="pre">get_document_ranking</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_map</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_ids</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.get_document_ranking" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="sig-name descname"><span class="pre">get_document_ranking</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../pmap_ner/index.html#pine.pipelines.pmap_ner.NER" title="pine.pipelines.pmap_ner.NER"><span class="pre">pine.pipelines.pmap_ner.NER</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_map</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.get_document_ranking" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Calculates document rankings and returns document IDs sorted by ranking.</p>
|
||||
<p>The ranking should be which documents should be evaluated first. This probably
|
||||
corresponds in some ways to the documents which the model is least confident about.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>model</strong> – NER model</p></li>
|
||||
<li><p><strong>doc_map</strong> – dict: mapping of document IDs to document text where overlap is 0</p></li>
|
||||
<li><p><strong>doc_ids</strong> – list: IDs of documents where ???</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dd class="field-even"><p>sorted document IDs</p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.NER_API.ner_api.get_classifier_pipeline_metrics_objs">
|
||||
@@ -111,7 +134,7 @@
|
||||
|
||||
<dl class="py method">
|
||||
<dt id="pine.pipelines.NER_API.ner_api.predict">
|
||||
<code class="sig-name descname"><span class="pre">predict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">documents</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_ids</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.predict" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="sig-name descname"><span class="pre">predict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">texts</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.predict" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
@@ -135,6 +158,7 @@
|
||||
<li><a class="reference internal" href="#pine.pipelines.NER_API.logger">logger</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.NER_API.config">config</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api">ner_api</a><ul>
|
||||
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.status">status</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.perform_fold">perform_fold</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.perform_five_fold">perform_five_fold</a></li>
|
||||
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.get_document_ranking">get_document_ranking</a></li>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user