From 9f875543272def33f408cc5d333219b2bf1dd8e5 Mon Sep 17 00:00:00 2001 From: Max Wang Date: Tue, 3 Oct 2023 15:27:29 -0400 Subject: [PATCH 1/3] Add redis docker service --- docker-compose.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 03a9b3e..63d0207 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,20 @@ version: '3.7' services: - workflow_runner: + answer_appraiser: image: answer-appraiser container_name: answer_appraiser build: context: . ports: - - '${PORT:-9096}:9096' \ No newline at end of file + - '${PORT:-9096}:9096' + redis: + image: redis/redis-stack-server:latest + container_name: answer_appraiser_redis + build: + context: redis + ports: + - "6379:6379" + restart: unless-stopped + volumes: + - ./data:/data \ No newline at end of file From dd878d49b72ef0e553c159a0f2f86aa8c40044a9 Mon Sep 17 00:00:00 2001 From: Max Wang Date: Tue, 3 Oct 2023 15:28:49 -0400 Subject: [PATCH 2/3] Add redis data to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index dc427c9..8d3f3ed 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ logs/* *.jar .env *.log -kgx/ \ No newline at end of file +kgx/ +data/ From ad962ef68cb719000be517d3685b68c1b0ea952b Mon Sep 17 00:00:00 2001 From: Max Wang Date: Tue, 3 Oct 2023 15:29:15 -0400 Subject: [PATCH 3/3] Fix up openapi spec for smartAPI --- app/config.py | 2 +- app/server.py | 14 ++++++-------- app/trapi.py | 21 ++++++++++++++++----- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/app/config.py b/app/config.py index 5754f7a..9db20ba 100644 --- a/app/config.py +++ b/app/config.py @@ -4,7 +4,7 @@ class Settings(BaseSettings): - openapi_server_url: Optional[AnyUrl] + openapi_server_url: AnyUrl = "http://localhost:9096" openapi_server_maturity: str = "development" openapi_server_location: str = "RENCI" trapi_version: str = "1.4.0" diff --git a/app/server.py b/app/server.py index 48d2a0c..3b78a18 100644 --- a/app/server.py +++ b/app/server.py @@ -20,16 +20,16 @@ LOGGER = logging.getLogger(__name__) openapi_args = dict( - title="Answer Appraiser", - version="0.3.4", + title="SRI Answer Appraiser", + version="0.3.5", terms_of_service="", - translator_component="Utility", - translator_teams=["Standards Reference Implementation Team"], - infores="infores:answer-appraiser", + description="SRI service that provides metrics for scoring and ordering of results", + trapi="1.4.0", + biolink_version="3.4.2", contact={ "name": "Max Wang", "email": "max@covar.com", - "x-id": "maximusunc", + "x-id": "https://github.com/maximusunc", "x-role": "responsible developer", }, ) @@ -43,8 +43,6 @@ }, ] -openapi_args["trapi"] = settings.trapi_version - APP = TRAPI(**openapi_args) APP.add_middleware( diff --git a/app/trapi.py b/app/trapi.py index 0bb98d8..6d1bd10 100644 --- a/app/trapi.py +++ b/app/trapi.py @@ -16,20 +16,26 @@ def __init__( self, *args, contact: Optional[Dict[str, Any]] = None, + description: Optional[str] = "", terms_of_service: Optional[str] = None, translator_component: Optional[str] = None, translator_teams: Optional[List[str]] = None, infores: Optional[str] = None, trapi: Optional[str] = None, + biolink_version: Optional[str] = None, + servers: Optional[List[Dict]] = None, **kwargs, ): super().__init__(*args, **kwargs) self.contact = contact + self.description = description self.terms_of_service = terms_of_service self.translator_component = translator_component self.translator_teams = translator_teams self.infores = infores self.trapi = trapi + self.biolink_version = biolink_version + self.servers = servers def openapi(self) -> Dict[str, Any]: """Build custom OpenAPI schema.""" @@ -51,14 +57,17 @@ def openapi(self) -> Dict[str, Any]: openapi_schema["servers"] = self.servers + openapi_schema["info"]["contact"] = self.contact + openapi_schema["info"]["x-translator"] = { - "component": self.translator_component, - "team": self.translator_teams, + "biolink-version": self.biolink_version, + "component": "Utility", + "team": "Standards Reference Implementation Team", "externalDocs": { "description": "The values for component and team are restricted according to this external JSON schema. See schema and examples at url", "url": "https://github.com/NCATSTranslator/translator_extensions/blob/production/x-translator/", }, - "infores": self.infores, + "infores": "infores:sri-answer-appraiser", } openapi_schema["info"]["x-trapi"] = { "version": self.trapi, @@ -66,9 +75,11 @@ def openapi(self) -> Dict[str, Any]: "description": "The values for version are restricted according to the regex in this external JSON schema. See schema and examples at url", "url": "https://github.com/NCATSTranslator/translator_extensions/blob/production/x-trapi/", }, + "operations": [], } - openapi_schema["info"]["contact"] = self.contact - openapi_schema["info"]["termsOfService"] = self.terms_of_service + + if self.terms_of_service: + openapi_schema["info"]["termsOfService"] = self.terms_of_service self.openapi_schema = openapi_schema return self.openapi_schema