Skip to content

Commit

Permalink
Update to API version 1.0.2 (#98)
Browse files Browse the repository at this point in the history
* Update to API version 1.0.2

* Bump tool version to 1.0.2
  • Loading branch information
tschaffter authored Mar 20, 2021
1 parent efd9560 commit db8a6f6
Show file tree
Hide file tree
Showing 8 changed files with 443 additions and 375 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ note.

### Specification

- Date Annotator API version: 1.0.1
- Tool version: 1.0.1
- Date Annotator API version: 1.0.2
- Tool version: 1.0.2
- Docker image: [nlpsandbox/date-annotator-example]

## Model
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
date-annotator:
image: nlpsandbox/date-annotator-example:1.0.1
image: nlpsandbox/date-annotator-example:1.0.2
build:
context: server
dockerfile: Dockerfile
Expand Down
646 changes: 357 additions & 289 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions server/openapi_server/controllers/tool_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ def get_tool(): # noqa: E501
"""
tool = Tool(
name="date-annotator-example",
version="1.0.1",
version="1.0.2",
license=License.APACHE_2_0,
repository="github:nlpsandbox/date-annotator-example",
description="Example implementation of the NLP Sandbox Date Annotator",
author="The NLP Sandbox Team",
author_email="thomas.schaffter@sagebionetworks.org",
url="https://github.com/nlpsandbox/date-annotator-example",
tool_type="nlpsandbox:date-annotator",
tool_api_version="1.0.1"
type="nlpsandbox:date-annotator",
api_version="1.0.2"
)
return tool, 200

Expand Down
36 changes: 18 additions & 18 deletions server/openapi_server/models/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@ class Note(Model):
Do not edit the class manually.
"""

def __init__(self, identifier=None, text=None, note_type=None, patient_id=None): # noqa: E501
def __init__(self, identifier=None, text=None, type=None, patient_id=None): # noqa: E501
"""Note - a model defined in OpenAPI
:param identifier: The identifier of this Note. # noqa: E501
:type identifier: str
:param text: The text of this Note. # noqa: E501
:type text: str
:param note_type: The note_type of this Note. # noqa: E501
:type note_type: str
:param type: The type of this Note. # noqa: E501
:type type: str
:param patient_id: The patient_id of this Note. # noqa: E501
:type patient_id: str
"""
self.openapi_types = {
'identifier': str,
'text': str,
'note_type': str,
'type': str,
'patient_id': str
}

self.attribute_map = {
'identifier': 'identifier',
'text': 'text',
'note_type': 'noteType',
'type': 'type',
'patient_id': 'patientId'
}

self._identifier = identifier
self._text = text
self._note_type = note_type
self._type = type
self._patient_id = patient_id

@classmethod
Expand Down Expand Up @@ -116,29 +116,29 @@ def text(self, text):
self._text = text

@property
def note_type(self):
"""Gets the note_type of this Note.
def type(self):
"""Gets the type of this Note.
The note type (LOINC concept) # noqa: E501
:return: The note_type of this Note.
:return: The type of this Note.
:rtype: str
"""
return self._note_type
return self._type

@note_type.setter
def note_type(self, note_type):
"""Sets the note_type of this Note.
@type.setter
def type(self, type):
"""Sets the type of this Note.
The note type (LOINC concept) # noqa: E501
:param note_type: The note_type of this Note.
:type note_type: str
:param type: The type of this Note.
:type type: str
"""
if note_type is None:
raise ValueError("Invalid value for `note_type`, must not be `None`") # noqa: E501
if type is None:
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501

self._note_type = note_type
self._type = type

@property
def patient_id(self):
Expand Down
92 changes: 46 additions & 46 deletions server/openapi_server/models/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Tool(Model):
Do not edit the class manually.
"""

def __init__(self, name=None, version=None, license=None, repository=None, description=None, author=None, author_email=None, url=None, tool_type=None, tool_api_version=None): # noqa: E501
def __init__(self, name=None, version=None, license=None, repository=None, description=None, author=None, author_email=None, url=None, type=None, api_version=None): # noqa: E501
"""Tool - a model defined in OpenAPI
:param name: The name of this Tool. # noqa: E501
Expand All @@ -38,10 +38,10 @@ def __init__(self, name=None, version=None, license=None, repository=None, descr
:type author_email: str
:param url: The url of this Tool. # noqa: E501
:type url: str
:param tool_type: The tool_type of this Tool. # noqa: E501
:type tool_type: str
:param tool_api_version: The tool_api_version of this Tool. # noqa: E501
:type tool_api_version: str
:param type: The type of this Tool. # noqa: E501
:type type: str
:param api_version: The api_version of this Tool. # noqa: E501
:type api_version: str
"""
self.openapi_types = {
'name': str,
Expand All @@ -52,8 +52,8 @@ def __init__(self, name=None, version=None, license=None, repository=None, descr
'author': str,
'author_email': str,
'url': str,
'tool_type': str,
'tool_api_version': str
'type': str,
'api_version': str
}

self.attribute_map = {
Expand All @@ -65,8 +65,8 @@ def __init__(self, name=None, version=None, license=None, repository=None, descr
'author': 'author',
'author_email': 'authorEmail',
'url': 'url',
'tool_type': 'toolType',
'tool_api_version': 'toolApiVersion'
'type': 'type',
'api_version': 'apiVersion'
}

self._name = name
Expand All @@ -77,8 +77,8 @@ def __init__(self, name=None, version=None, license=None, repository=None, descr
self._author = author
self._author_email = author_email
self._url = url
self._tool_type = tool_type
self._tool_api_version = tool_api_version
self._type = type
self._api_version = api_version

@classmethod
def from_dict(cls, dikt) -> 'Tool':
Expand Down Expand Up @@ -302,61 +302,61 @@ def url(self, url):
self._url = url

@property
def tool_type(self):
"""Gets the tool_type of this Tool.
def type(self):
"""Gets the type of this Tool.
The type of this tool # noqa: E501
:return: The tool_type of this Tool.
:return: The type of this Tool.
:rtype: str
"""
return self._tool_type
return self._type

@tool_type.setter
def tool_type(self, tool_type):
"""Sets the tool_type of this Tool.
@type.setter
def type(self, type):
"""Sets the type of this Tool.
The type of this tool # noqa: E501
:param tool_type: The tool_type of this Tool.
:type tool_type: str
:param type: The type of this Tool.
:type type: str
"""
if tool_type is None:
raise ValueError("Invalid value for `tool_type`, must not be `None`") # noqa: E501
if tool_type is not None and len(tool_type) > 60:
raise ValueError("Invalid value for `tool_type`, length must be less than or equal to `60`") # noqa: E501
if tool_type is not None and len(tool_type) < 3:
raise ValueError("Invalid value for `tool_type`, length must be greater than or equal to `3`") # noqa: E501
if tool_type is not None and not re.search(r'^[a-z0-9]+(?:-[a-z0-9]+)*(:)[a-z0-9]+(?:-[a-z0-9]+)*$', tool_type): # noqa: E501
raise ValueError("Invalid value for `tool_type`, must be a follow pattern or equal to `/^[a-z0-9]+(?:-[a-z0-9]+)*(:)[a-z0-9]+(?:-[a-z0-9]+)*$/`") # noqa: E501
if type is None:
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
if type is not None and len(type) > 60:
raise ValueError("Invalid value for `type`, length must be less than or equal to `60`") # noqa: E501
if type is not None and len(type) < 3:
raise ValueError("Invalid value for `type`, length must be greater than or equal to `3`") # noqa: E501
if type is not None and not re.search(r'^[a-z0-9]+(?:-[a-z0-9]+)*(:)[a-z0-9]+(?:-[a-z0-9]+)*$', type): # noqa: E501
raise ValueError("Invalid value for `type`, must be a follow pattern or equal to `/^[a-z0-9]+(?:-[a-z0-9]+)*(:)[a-z0-9]+(?:-[a-z0-9]+)*$/`") # noqa: E501

self._tool_type = tool_type
self._type = type

@property
def tool_api_version(self):
"""Gets the tool_api_version of this Tool.
def api_version(self):
"""Gets the api_version of this Tool.
The version of the tool OpenAPI specification # noqa: E501
:return: The tool_api_version of this Tool.
:return: The api_version of this Tool.
:rtype: str
"""
return self._tool_api_version
return self._api_version

@tool_api_version.setter
def tool_api_version(self, tool_api_version):
"""Sets the tool_api_version of this Tool.
@api_version.setter
def api_version(self, api_version):
"""Sets the api_version of this Tool.
The version of the tool OpenAPI specification # noqa: E501
:param tool_api_version: The tool_api_version of this Tool.
:type tool_api_version: str
:param api_version: The api_version of this Tool.
:type api_version: str
"""
if tool_api_version is None:
raise ValueError("Invalid value for `tool_api_version`, must not be `None`") # noqa: E501
if tool_api_version is not None and len(tool_api_version) < 1:
raise ValueError("Invalid value for `tool_api_version`, length must be greater than or equal to `1`") # noqa: E501
if tool_api_version is not None and not re.search(r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$', tool_api_version): # noqa: E501
raise ValueError("Invalid value for `tool_api_version`, must be a follow pattern or equal to `/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/`") # noqa: E501

self._tool_api_version = tool_api_version
if api_version is None:
raise ValueError("Invalid value for `api_version`, must not be `None`") # noqa: E501
if api_version is not None and len(api_version) < 1:
raise ValueError("Invalid value for `api_version`, length must be greater than or equal to `1`") # noqa: E501
if api_version is not None and not re.search(r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$', api_version): # noqa: E501
raise ValueError("Invalid value for `api_version`, must be a follow pattern or equal to `/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/`") # noqa: E501

self._api_version = api_version
30 changes: 15 additions & 15 deletions server/openapi_server/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ info:
name: Apache 2.0
url: https://github.com/nlpsandbox/nlpsandbox-schemas/blob/develop/LICENSE
title: NLP Sandbox Date Annotator API
version: 1.0.1
version: 1.0.2
x-logo:
url: https://nlpsandbox.github.io/nlpsandbox-schemas/logo.png
servers:
Expand Down Expand Up @@ -233,7 +233,7 @@ components:
example:
identifier: awesome-note
text: On 12/26/2020, Ms. Chloe Price met with Dr. Prescott in Seattle.
noteType: loinc:LP29684-5
type: loinc:LP29684-5
patientId: awesome-patient
properties:
identifier:
Expand All @@ -246,7 +246,7 @@ components:
text:
description: The content of the clinical note
type: string
noteType:
type:
description: The note type (LOINC concept)
type: string
patientId:
Expand All @@ -258,17 +258,17 @@ components:
type: string
required:
- identifier
- noteType
- patientId
- text
- type
type: object
TextDateAnnotationRequest:
description: A request to annotate dates in a clinical note
example:
note:
identifier: awesome-note
text: On 12/26/2020, Ms. Chloe Price met with Dr. Prescott in Seattle.
noteType: loinc:LP29684-5
type: loinc:LP29684-5
patientId: awesome-patient
properties:
note:
Expand Down Expand Up @@ -398,8 +398,8 @@ components:
author: Awesome Team
authorEmail: author@example.com
url: https://example.com
toolType: nlpsandbox:date-annotator
toolApiVersion: 1.0.1
type: nlpsandbox:date-annotator
apiVersion: 1.0.2
properties:
name:
description: The tool name
Expand Down Expand Up @@ -432,27 +432,27 @@ components:
description: The URL to the homepage of the tool
format: uri
type: string
toolType:
type:
description: The type of this tool
example: nlpsandbox:date-annotator
maxLength: 60
minLength: 3
pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*(:)[a-z0-9]+(?:-[a-z0-9]+)*$
type: string
toolApiVersion:
apiVersion:
description: The version of the tool OpenAPI specification
minLength: 1
pattern: ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
type: string
required:
- apiVersion
- author
- authorEmail
- description
- license
- name
- repository
- toolApiVersion
- toolType
- type
- url
- version
type: object
Expand All @@ -468,8 +468,8 @@ components:
author: Awesome Team
authorEmail: author@example.com
url: https://example.com
toolType: nlpsandbox:date-annotator
toolApiVersion: 1.0.1
type: nlpsandbox:date-annotator
apiVersion: 1.0.2
- name: awesome-nlp-tool
version: 1.0.6
license: apache-2.0
Expand All @@ -478,8 +478,8 @@ components:
author: Awesome Team
authorEmail: author@example.com
url: https://example.com
toolType: nlpsandbox:date-annotator
toolApiVersion: 1.0.1
type: nlpsandbox:date-annotator
apiVersion: 1.0.2
properties:
toolDependencies:
description: A list of tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_create_text_date_annotations(self):
text_date_annotation_request = {
"note": {
"identifier": "awesome-note",
"noteType": "loinc:LP29684-5",
"type": "loinc:LP29684-5",
"patientId": "awesome-patient",
"text": "On 12/26/2020, Ms. Chloe Price met with Dr. Prescott."
}
Expand Down

0 comments on commit db8a6f6

Please sign in to comment.