diff --git a/openapi/_internal/nlpsandbox/openapi-merge.yaml b/openapi/_internal/nlpsandbox/openapi-merge.yaml index 9c7af9fa..3ec8ce1c 100644 --- a/openapi/_internal/nlpsandbox/openapi-merge.yaml +++ b/openapi/_internal/nlpsandbox/openapi-merge.yaml @@ -5,26 +5,31 @@ inputs: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/person-name-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/location-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/id-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/contact-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/phi-deidentifier.openapi.yaml operationSelection: excludeTags: @@ -35,6 +40,7 @@ inputs: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/data-node.openapi.yaml operationSelection: excludeTags: diff --git a/openapi/_internal/tool/openapi-merge.yaml b/openapi/_internal/tool/openapi-merge.yaml index 5ea5f86b..e73cd01e 100644 --- a/openapi/_internal/tool/openapi-merge.yaml +++ b/openapi/_internal/tool/openapi-merge.yaml @@ -5,26 +5,31 @@ inputs: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/person-name-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/location-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/id-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/contact-annotator.openapi.yaml operationSelection: excludeTags: - Tool - HealthCheck + - Training - inputFile: ../individuals/phi-deidentifier.openapi.yaml operationSelection: excludeTags: @@ -35,4 +40,5 @@ inputs: excludeTags: - Tool - HealthCheck + - Training output: openapi.yaml \ No newline at end of file diff --git a/openapi/commons/components/schemas/Tool.yaml b/openapi/commons/components/schemas/Tool.yaml index 5f4c3d4b..6166efa1 100644 --- a/openapi/commons/components/schemas/Tool.yaml +++ b/openapi/commons/components/schemas/Tool.yaml @@ -32,6 +32,10 @@ properties: description: The URL to the homepage of the tool type: string format: uri + trainable: + description: Whether the tool implements trainability + type: boolean + default: false type: $ref: ../parameters/ToolType.yaml apiVersion: @@ -50,6 +54,7 @@ required: - url - type - apiVersion + - trainable example: name: awesome-nlp-tool version: 1.0.6 @@ -59,5 +64,6 @@ example: author: Awesome Team authorEmail: author@example.com url: https://example.com + trainable: false type: nlpsandbox:date-annotator - apiVersion: 1.2.0 \ No newline at end of file + apiVersion: 1.2.0 diff --git a/openapi/commons/components/schemas/TrainedToolStatus.yaml b/openapi/commons/components/schemas/TrainedToolStatus.yaml new file mode 100644 index 00000000..ff49e803 --- /dev/null +++ b/openapi/commons/components/schemas/TrainedToolStatus.yaml @@ -0,0 +1,14 @@ +type: object +description: Information about whether the tool is using a trained model, and the dataset on which the tool was trained +properties: + loaded: + description: Whether the tool is using a trained model + type: boolean + notesURI: + description: URI to first page of the notes in the dataset + type: string + format: uri + goldStandardAnnotationsURI: + description: URI to first page of gold standard annotations + type: string + format: uri diff --git a/openapi/commons/components/schemas/TrainingStatus.yaml b/openapi/commons/components/schemas/TrainingStatus.yaml new file mode 100644 index 00000000..8e489dbd --- /dev/null +++ b/openapi/commons/components/schemas/TrainingStatus.yaml @@ -0,0 +1,6 @@ +type: string +description: Whether this annotator instance has been used to generate a trained model +enum: + - not-yet-started + - ongoing + - finished diff --git a/openapi/commons/paths/loadTrainedAnnotator.yaml b/openapi/commons/paths/loadTrainedAnnotator.yaml new file mode 100644 index 00000000..f199d22c --- /dev/null +++ b/openapi/commons/paths/loadTrainedAnnotator.yaml @@ -0,0 +1,18 @@ +post: + tags: + - Training + summary: Load the results of training + description: Load the results of training (e.g. a machine learning model) into memory from mounted volume + operationId: loadTrainedAnnotator + responses: + '201': + description: Trained annotator loaded + links: + GetTrainingStatus: + operationId: getAnnotatorTrainingStatus + '403': + $ref: ../components/responses/Unauthorized.yaml + '404': + $ref: ../components/responses/NotFound.yaml + '500': + $ref: ../components/responses/InternalServerError.yaml diff --git a/openapi/commons/paths/toolTrainingStatus.yaml b/openapi/commons/paths/toolTrainingStatus.yaml new file mode 100644 index 00000000..69f3a7e8 --- /dev/null +++ b/openapi/commons/paths/toolTrainingStatus.yaml @@ -0,0 +1,17 @@ +get: + tags: + - Training + summary: Get status of tool training + description: Get status of the tool's training process (404 if tool is not trainable) + operationId: getToolTrainingStatus + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../components/schemas/TrainingStatus.yaml + '404': + $ref: ../components/responses/NotFound.yaml + '500': + $ref: ../components/responses/InternalServerError.yaml diff --git a/openapi/commons/paths/trainTool.yaml b/openapi/commons/paths/trainTool.yaml new file mode 100644 index 00000000..4fb25d07 --- /dev/null +++ b/openapi/commons/paths/trainTool.yaml @@ -0,0 +1,16 @@ +post: + tags: + - Training + summary: Initiate tool training (async) + description: Start training the tool's model + operationId: trainAnnotator + responses: + '201': + description: Training initialized + links: + GetTrainingStatus: + operationId: toolTrainingStatus + '404': + $ref: ../components/responses/NotFound.yaml + '500': + $ref: ../components/responses/InternalServerError.yaml diff --git a/openapi/commons/paths/trainedToolStatus.yaml b/openapi/commons/paths/trainedToolStatus.yaml new file mode 100644 index 00000000..90686a2a --- /dev/null +++ b/openapi/commons/paths/trainedToolStatus.yaml @@ -0,0 +1,17 @@ +get: + tags: + - Training + summary: Get information about whether trained model has been loaded + description: Get information about the tool's trained model (404 if tool is not trainable) + operationId: getTrainedToolStatus + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: ../components/schemas/TrainedToolStatus.yaml + '404': + $ref: ../components/responses/NotFound.yaml + '500': + $ref: ../components/responses/InternalServerError.yaml diff --git a/openapi/contact-annotator/openapi.yaml b/openapi/contact-annotator/openapi.yaml index 39afdc5d..d91d2da6 100644 --- a/openapi/contact-annotator/openapi.yaml +++ b/openapi/contact-annotator/openapi.yaml @@ -70,3 +70,9 @@ paths: $ref: ../commons/paths/tool.yaml /tool/dependencies: $ref: ../commons/paths/dependencies.yaml + /train: + $ref: ../commons/paths/trainAnnotator.yaml + /train/status: + $ref: ../commons/paths/annotatorTrainingStatus.yaml + /train/load: + $ref: ../commons/paths/loadTrainedAnnotator.yaml diff --git a/openapi/covid-symptom-annotator/openapi.yaml b/openapi/covid-symptom-annotator/openapi.yaml index c8cd7f58..38a88389 100644 --- a/openapi/covid-symptom-annotator/openapi.yaml +++ b/openapi/covid-symptom-annotator/openapi.yaml @@ -70,4 +70,10 @@ paths: /tool: $ref: ../commons/paths/tool.yaml /tool/dependencies: - $ref: ../commons/paths/dependencies.yaml \ No newline at end of file + $ref: ../commons/paths/dependencies.yaml + /train: + $ref: ../commons/paths/trainAnnotator.yaml + /train/status: + $ref: ../commons/paths/annotatorTrainingStatus.yaml + /train/load: + $ref: ../commons/paths/loadTrainedAnnotator.yaml \ No newline at end of file diff --git a/openapi/date-annotator/openapi.yaml b/openapi/date-annotator/openapi.yaml index 55ad4d26..9c998c2f 100644 --- a/openapi/date-annotator/openapi.yaml +++ b/openapi/date-annotator/openapi.yaml @@ -71,4 +71,10 @@ paths: /tool: $ref: ../commons/paths/tool.yaml /tool/dependencies: - $ref: ../commons/paths/dependencies.yaml \ No newline at end of file + $ref: ../commons/paths/dependencies.yaml + /train: + $ref: ../commons/paths/trainAnnotator.yaml + /train/status: + $ref: ../commons/paths/annotatorTrainingStatus.yaml + /train/load: + $ref: ../commons/paths/loadTrainedAnnotator.yaml \ No newline at end of file diff --git a/openapi/id-annotator/openapi.yaml b/openapi/id-annotator/openapi.yaml index 0586dd73..123444b0 100644 --- a/openapi/id-annotator/openapi.yaml +++ b/openapi/id-annotator/openapi.yaml @@ -69,4 +69,10 @@ paths: /tool: $ref: ../commons/paths/tool.yaml /tool/dependencies: - $ref: ../commons/paths/dependencies.yaml \ No newline at end of file + $ref: ../commons/paths/dependencies.yaml + /train: + $ref: ../commons/paths/trainAnnotator.yaml + /train/status: + $ref: ../commons/paths/annotatorTrainingStatus.yaml + /train/load: + $ref: ../commons/paths/loadTrainedAnnotator.yaml \ No newline at end of file diff --git a/openapi/location-annotator/openapi.yaml b/openapi/location-annotator/openapi.yaml index a1e2cbe9..263724ff 100644 --- a/openapi/location-annotator/openapi.yaml +++ b/openapi/location-annotator/openapi.yaml @@ -69,4 +69,10 @@ paths: /tool: $ref: ../commons/paths/tool.yaml /tool/dependencies: - $ref: ../commons/paths/dependencies.yaml \ No newline at end of file + $ref: ../commons/paths/dependencies.yaml + /train: + $ref: ../commons/paths/trainAnnotator.yaml + /train/status: + $ref: ../commons/paths/annotatorTrainingStatus.yaml + /train/load: + $ref: ../commons/paths/loadTrainedAnnotator.yaml \ No newline at end of file diff --git a/openapi/person-name-annotator/openapi.yaml b/openapi/person-name-annotator/openapi.yaml index 149d46bf..24458528 100644 --- a/openapi/person-name-annotator/openapi.yaml +++ b/openapi/person-name-annotator/openapi.yaml @@ -69,4 +69,10 @@ paths: /tool: $ref: ../commons/paths/tool.yaml /tool/dependencies: - $ref: ../commons/paths/dependencies.yaml \ No newline at end of file + $ref: ../commons/paths/dependencies.yaml + /train: + $ref: ../commons/paths/trainAnnotator.yaml + /train/status: + $ref: ../commons/paths/annotatorTrainingStatus.yaml + /train/load: + $ref: ../commons/paths/loadTrainedAnnotator.yaml \ No newline at end of file diff --git a/openapi/phi-annotator/openapi.yaml b/openapi/phi-annotator/openapi.yaml index cb206f9b..e09ff46b 100644 --- a/openapi/phi-annotator/openapi.yaml +++ b/openapi/phi-annotator/openapi.yaml @@ -87,3 +87,9 @@ paths: $ref: ../commons/paths/tool.yaml /tool/dependencies: $ref: ../commons/paths/dependencies.yaml + /train: + $ref: ../commons/paths/trainAnnotator.yaml + /train/status: + $ref: ../commons/paths/annotatorTrainingStatus.yaml + /train/load: + $ref: ../commons/paths/loadTrainedAnnotator.yaml