diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d7813b7..5c0410f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,8 +7,8 @@ updates: interval: "monthly" target-branch: "develop" - - package-ecosystem: "pip" - directory: "/server" + - package-ecosystem: "npm" + directory: "/" schedule: interval: "monthly" - target-branch: "develop" \ No newline at end of file + target-branch: "develop" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87fb8c3..debaec1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,10 @@ on: - '*.*.*' pull_request: + +env: + docker_repository: nlpsandbox/person-name-annotator-example + jobs: lint: runs-on: ubuntu-latest @@ -38,7 +42,7 @@ jobs: - name: Prepare id: prep run: | - DOCKER_IMAGE=nlpsandbox/date-annotator-example-java + DOCKER_IMAGE=${{ env.docker_repository }} VERSION=noop PUSH=false if [ "${{ github.event_name }}" = "schedule" ]; then @@ -99,4 +103,4 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - repository: nlpsandbox/date-annotator-example-java + repository: ${{ env.docker_repository }} diff --git a/.gitignore b/.gitignore index 15a5634..8ee8a98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules .idea -venv \ No newline at end of file +venv +dist.yaml +openapi.yaml \ No newline at end of file diff --git a/README.md b/README.md index 03bbe0e..8dda50c 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ An example implementation of the [NLP Sandbox Date Annotator] using Java Spring ## Specification -- Annotates date strings in clinical notes using simple regular expressions - Implements the [NLP Sandbox Date Annotator OpenAPI specification] +- Annotates date strings in clinical notes using simple regular expressions ## Usage @@ -26,7 +26,7 @@ Build and start the Date Annotator. cd server/ mvn package - java -jar target/openapi-spring-0.1.6.jar + java -jar target/openapi-spring-0.2.2.jar ## Interactive documentation diff --git a/docker-compose.yml b/docker-compose.yml index ef0ddbe..a5195c1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: date-annotator: - image: nlpsandbox/date-annotator-example-java:edge + image: nlpsandbox/date-annotator-example-java:latest build: context: server dockerfile: Dockerfile diff --git a/openapitools.json b/openapitools.json deleted file mode 100644 index ea211b8..0000000 --- a/openapitools.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "spaces": 2, - "generator-cli": { - "version": "4.3.1" - } -} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3402101 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,14 @@ +{ + "name": "date-annotator-example-java", + "version": "0.2.2", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@openapitools/openapi-generator-cli": { + "version": "1.0.18-5.0.0-beta2", + "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-1.0.18-5.0.0-beta2.tgz", + "integrity": "sha512-zcuOcVKuQ/wp5immG4l3/w5koLHLy+NCoFPK4RQ2iz34kHgtaRfXzNIroulHWLUNuoWgx9y2zYecEITX6ndGMA==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6342f1a --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "date-annotator-example-java", + "version": "0.2.2", + "license": "Apache-2.0", + "devDependencies": { + "@openapitools/openapi-generator-cli": "^1.0.18-4.3.1" + }, + "scripts": { + "generate:server": "openapi-generator generate -g spring -o server -i $npm_config_spec" + } +} diff --git a/server/.openapi-generator-ignore b/server/.openapi-generator-ignore index 7484ee5..cc1e9db 100644 --- a/server/.openapi-generator-ignore +++ b/server/.openapi-generator-ignore @@ -21,3 +21,5 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md + +Dockerfile \ No newline at end of file diff --git a/server/.openapi-generator/FILES b/server/.openapi-generator/FILES new file mode 100644 index 0000000..2d9ed72 --- /dev/null +++ b/server/.openapi-generator/FILES @@ -0,0 +1,20 @@ +README.md +pom.xml +src/main/java/org/openapitools/OpenAPI2SpringBoot.java +src/main/java/org/openapitools/RFC3339DateFormat.java +src/main/java/org/openapitools/api/ApiUtil.java +src/main/java/org/openapitools/api/ServiceApi.java +src/main/java/org/openapitools/api/ServiceApiController.java +src/main/java/org/openapitools/api/TextDateAnnotationsApi.java +src/main/java/org/openapitools/api/TextDateAnnotationsApiController.java +src/main/java/org/openapitools/configuration/HomeController.java +src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java +src/main/java/org/openapitools/model/Error.java +src/main/java/org/openapitools/model/Note.java +src/main/java/org/openapitools/model/Service.java +src/main/java/org/openapitools/model/TextAnnotation.java +src/main/java/org/openapitools/model/TextDateAnnotation.java +src/main/java/org/openapitools/model/TextDateAnnotationAllOf.java +src/main/java/org/openapitools/model/TextDateAnnotationRequest.java +src/main/java/org/openapitools/model/TextDateAnnotations.java +src/main/resources/application.properties diff --git a/server/.openapi-generator/VERSION b/server/.openapi-generator/VERSION index ecedc98..1a487e1 100644 --- a/server/.openapi-generator/VERSION +++ b/server/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.1 \ No newline at end of file +5.0.0-beta2 \ No newline at end of file diff --git a/server/Dockerfile b/server/Dockerfile index 863fde5..6031b44 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,8 +1,7 @@ FROM python:3.8.5-slim-buster -ENV PIP_NO_CACHE_DIR=off ENV APP_DIR=/opt/app -ENV APP_VERSION="0.1.6" +ENV APP_VERSION="0.2.2" # Safer bash scripts with 'set -euxo pipefail' SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] @@ -14,11 +13,8 @@ RUN mkdir -p /usr/share/man/man1 # hadolint ignore=DL3008 RUN apt-get update -qq -y \ && apt-get install --no-install-recommends -qq -y \ - build-essential \ + # build-essential \ gosu \ - libpcre3 \ - libpcre3-dev \ - # Java default-jre \ maven \ && apt-get -y autoclean \ @@ -27,13 +23,10 @@ RUN apt-get update -qq -y \ # Copy server files COPY src ${APP_DIR}/src -COPY requirements.txt pom.xml app.ini ${APP_DIR}/ +COPY pom.xml ${APP_DIR}/ COPY docker-entrypoint.sh / RUN chmod +x /docker-entrypoint.sh -# Install dependencies -RUN pip install -r ${APP_DIR}/requirements.txt - # Build app WORKDIR ${APP_DIR} RUN mvn package \ @@ -43,6 +36,4 @@ RUN mvn package \ EXPOSE 8080 # Set the entrypoint script and the default command run by the container -ENTRYPOINT ["java", "-jar", "target/app.jar"] -# ENTRYPOINT ["/docker-entrypoint.sh"] -# CMD ["uwsgi", "--ini", "app.ini", "--http-socket", ":8080"] \ No newline at end of file +ENTRYPOINT ["java", "-jar", "target/app.jar"] \ No newline at end of file diff --git a/server/app.ini b/server/app.ini deleted file mode 100644 index 2f48245..0000000 --- a/server/app.ini +++ /dev/null @@ -1,15 +0,0 @@ -[uwsgi] -# Configuration required by the NLP Sandbox -# The variables http and *-socket are passed as command line arguments and -# must not be specified in this file. -wsgi-file = openapi_server/__main__.py -callable = app -uid = www-data -gid = www-data -processes = 1 # Number of concurrent processes / workers -threads = 1 # Number of threads per process -master = true -chmod-sock = 660 -vacuum = true -die-on-term = true -thunder-lock = true \ No newline at end of file diff --git a/server/docker-entrypoint.sh b/server/docker-entrypoint.sh index 6e19b2a..87ec9f5 100644 --- a/server/docker-entrypoint.sh +++ b/server/docker-entrypoint.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -if [ "$1" = 'uwsgi' ]; then +if [ "$1" = 'java' ]; then cd ${APP_DIR} exec gosu www-data "$@" fi diff --git a/server/pom.xml b/server/pom.xml index bd8c6ad..9eb3e60 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -4,17 +4,17 @@ openapi-spring jar openapi-spring - 0.1.6 + 0.2.2 1.8 ${java.version} ${java.version} - 2.8.0 + 2.9.2 org.springframework.boot spring-boot-starter-parent - 2.3.5.RELEASE + 2.3.3.RELEASE src/main/java diff --git a/server/requirements.txt b/server/requirements.txt deleted file mode 100644 index 891c5b9..0000000 --- a/server/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -uWSGI == 2.0.19.1 \ No newline at end of file diff --git a/server/src/main/java/org/nlpsandbox/DateExtractor.java b/server/src/main/java/org/nlpsandbox/DateExtractor.java new file mode 100644 index 0000000..d010cb5 --- /dev/null +++ b/server/src/main/java/org/nlpsandbox/DateExtractor.java @@ -0,0 +1,82 @@ +package org.nlpsandbox; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.openapitools.model.TextDateAnnotation; + +public class DateExtractor { + + class NamedPattern{ + public String name; + public Pattern pattern; + + public NamedPattern(String name, Pattern pattern){ + this.name = name; + this.pattern = pattern; + } + } + + class Span{ + int begin; + int end; + int length; + + public Span(int begin, int end){ + this.begin = begin; + this.end = end; + this.length = end - begin; + } + } + + static List datePatterns; + + public DateExtractor(){ + datePatterns = new ArrayList<>(); + datePatterns.add(new NamedPattern("DD/MM/YYYY", + Pattern.compile( + "\\b([1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])(/)([1-9]|0[1-9]|1[0-2])(/)(19[0-9][0-9]|20[0-9][0-9])"))); + + datePatterns.add(new NamedPattern("MM/DD/YYYY", + Pattern.compile( + "\\b([1-9]|0[1-9]|1[0-2])(/)([1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])(/)(19[0-9][0-9]|20[0-9][0-9])"))); + + datePatterns.add(new NamedPattern("MM-DD-YYYY", + Pattern.compile( + "\\b([1-9]|0[1-9]|1[0-2])(-)([1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])(-)(19[0-9][0-9]|20[0-9][0-9])"))); + + datePatterns.add(new NamedPattern("MMMM", + Pattern.compile("\\b(January|February|March|April|May|June|" + + "July|August|September|October|November|" + + "December)"))); + } + + public List findDatesFromString(String sentence){ + + List annotations = new ArrayList<>(); + for (NamedPattern np: datePatterns) { + // Now create matcher object. + Matcher m = np.pattern.matcher(sentence); + while (m.find()) { + annotations.add(new TextDateAnnotation() + .start(m.start(0)) + .length(m.group(0).length()) + .text(m.group(0)) + .dateFormat(np.name) + .confidence(92.5f)); + } + } + return annotations; + } + + public static void main(String[] args) { + DateExtractor de = new DateExtractor(); + String str1 = "Today is 10/26/2020, and yesterday is 10/25/2020. "; + de.findDatesFromString(str1); + + String str2 = "Today is 26/11/2020. "; + de.findDatesFromString(str2); + } +} diff --git a/server/src/main/java/org/openapitools/RFC3339DateFormat.java b/server/src/main/java/org/openapitools/RFC3339DateFormat.java index 026bb31..bcd3936 100644 --- a/server/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/server/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -1,22 +1,38 @@ package org.openapitools; -import com.fasterxml.jackson.databind.util.ISO8601DateFormat; -import com.fasterxml.jackson.databind.util.ISO8601Utils; +import com.fasterxml.jackson.databind.util.StdDateFormat; +import java.text.DateFormat; import java.text.FieldPosition; +import java.text.ParsePosition; import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); -public class RFC3339DateFormat extends ISO8601DateFormat { + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); - private static final long serialVersionUID = 1L; + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } - // Same as ISO8601DateFormat but serializing milliseconds. @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - String value = ISO8601Utils.format(date, true); - toAppendTo.append(value); - return toAppendTo; + return fmt.format(date, toAppendTo, fieldPosition); } + @Override + public Object clone() { + return this; + } } \ No newline at end of file diff --git a/server/src/main/java/org/openapitools/api/DatesApi.java b/server/src/main/java/org/openapitools/api/DatesApi.java deleted file mode 100644 index 74be047..0000000 --- a/server/src/main/java/org/openapitools/api/DatesApi.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (4.3.1). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.openapitools.model.DateAnnotation; -import org.openapitools.model.Error; -import java.util.List; -import org.openapitools.model.Note; -import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -@Validated -@Api(value = "dates", description = "the dates API") -public interface DatesApi { - - default Optional getRequest() { - return Optional.empty(); - } - - /** - * POST /dates : Get all date annotations - * Returns the date annotations - * - * @param note (optional) - * @return Success (status code 200) - * or Unauthorized (status code 403) - */ - @ApiOperation(value = "Get all date annotations", nickname = "datesReadAll", notes = "Returns the date annotations", response = DateAnnotation.class, responseContainer = "List", tags={ "Date", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Success", response = DateAnnotation.class, responseContainer = "List"), - @ApiResponse(code = 403, message = "Unauthorized", response = Error.class) }) - @RequestMapping(value = "/dates", - produces = { "application/json" }, - consumes = { "application/json" }, - method = RequestMethod.POST) - default ResponseEntity> datesReadAll(@ApiParam(value = "" ) @Valid @RequestBody(required = false) List note) { - List annotations = new ArrayList(); - note.forEach((n) -> { - // TODO: Extract annotations from the text of the Note object n - String text = n.getText(); - System.out.print(text); - - annotations.add(new DateAnnotation() - .start(123) - .length(10) - .noteId(12) - .text("09-03-1999") - .format("MM-DD-YYYY")); - }); - return new ResponseEntity>(annotations, HttpStatus.OK); - } - -} diff --git a/server/src/main/java/org/openapitools/api/HealthApi.java b/server/src/main/java/org/openapitools/api/HealthApi.java deleted file mode 100644 index 0c97280..0000000 --- a/server/src/main/java/org/openapitools/api/HealthApi.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (4.3.1). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.openapitools.model.Error; -import org.openapitools.model.Health; -import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -@Validated -@Api(value = "health", description = "the health API") -public interface HealthApi { - - default Optional getRequest() { - return Optional.empty(); - } - - /** - * GET /health : Get Health - * Get the health of the API - * - * @return Success (status code 200) - * or Unauthorized (status code 403) - * or The specified resource was not found (status code 404) - */ - @ApiOperation(value = "Get Health", nickname = "health", notes = "Get the health of the API", response = Health.class, tags={ "Health", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Success", response = Health.class), - @ApiResponse(code = 403, message = "Unauthorized", response = Error.class), - @ApiResponse(code = 404, message = "The specified resource was not found", response = Error.class) }) - @RequestMapping(value = "/health", - produces = { "application/json" }, - method = RequestMethod.GET) - default ResponseEntity health() { - // getRequest().ifPresent(request -> { - // for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - // if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - // String exampleString = "{ \"status\" : \"pass\" }"; - // ApiUtil.setExampleResponse(request, "application/json", exampleString); - // break; - // } - // } - // }); - Health health = new Health().status(Health.StatusEnum.PASS); - return new ResponseEntity(health, HttpStatus.OK); - } - -} diff --git a/server/src/main/java/org/openapitools/api/HealthApiController.java b/server/src/main/java/org/openapitools/api/HealthApiController.java deleted file mode 100644 index 8fb764b..0000000 --- a/server/src/main/java/org/openapitools/api/HealthApiController.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openapitools.api; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.NativeWebRequest; -import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -@Controller -@RequestMapping("${openapi.nLPSandboxDateAnnotator.base-path:/api/v1}") -public class HealthApiController implements HealthApi { - - private final NativeWebRequest request; - - @org.springframework.beans.factory.annotation.Autowired - public HealthApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/server/src/main/java/org/openapitools/api/ServiceApi.java b/server/src/main/java/org/openapitools/api/ServiceApi.java index 459bff7..3816b2b 100644 --- a/server/src/main/java/org/openapitools/api/ServiceApi.java +++ b/server/src/main/java/org/openapitools/api/ServiceApi.java @@ -1,5 +1,5 @@ /** - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (4.3.1). + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta2). * https://openapi-generator.tech * Do not edit the class manually. */ @@ -12,14 +12,7 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.multipart.MultipartFile; @@ -29,8 +22,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") @Validated @Api(value = "service", description = "the service API") public interface ServiceApi { @@ -52,22 +44,14 @@ default Optional getRequest() { @ApiResponse(code = 200, message = "Success", response = Service.class), @ApiResponse(code = 403, message = "Unauthorized", response = Error.class), @ApiResponse(code = 404, message = "The specified resource was not found", response = Error.class) }) - @RequestMapping(value = "/service", - produces = { "application/json" }, - method = RequestMethod.GET) + @GetMapping( + value = "/service", + produces = { "application/json" } + ) default ResponseEntity service() { - getRequest().ifPresent(request -> { - // for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - // if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - // String exampleString = "{ \"license\" : \"Apache-2.0\", \"authorEmail\" : \"author@example.com\", \"author\" : \"Example Author\", \"name\" : \"awesome-date-annotator\", \"description\" : \"An awesome Date Annotator based on regex patterns\", \"repository\" : \"github:awesome-org/awesome-date-annotator\", \"version\" : \"1.0.0\", \"url\" : \"https://openapi-generator.tech\" }"; - // ApiUtil.setExampleResponse(request, "application/json", exampleString); - // break; - // } - // } - }); Service service = new Service() - .name("date-annotator-example") - .version("0.1.6") + .name("date-annotator-example-java") + .version("0.2.2") .license("Apache-2.0") .repository("github:nlpsandbox/date-annotator-example-java") .description("An example implementation of the NLP Sandbox Date Annotator") diff --git a/server/src/main/java/org/openapitools/api/ServiceApiController.java b/server/src/main/java/org/openapitools/api/ServiceApiController.java index 2fef950..cbc4654 100644 --- a/server/src/main/java/org/openapitools/api/ServiceApiController.java +++ b/server/src/main/java/org/openapitools/api/ServiceApiController.java @@ -4,8 +4,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") @Controller @RequestMapping("${openapi.nLPSandboxDateAnnotator.base-path:/api/v1}") public class ServiceApiController implements ServiceApi { diff --git a/server/src/main/java/org/openapitools/api/TextDateAnnotationsApi.java b/server/src/main/java/org/openapitools/api/TextDateAnnotationsApi.java new file mode 100644 index 0000000..d5113ca --- /dev/null +++ b/server/src/main/java/org/openapitools/api/TextDateAnnotationsApi.java @@ -0,0 +1,65 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta2). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.Error; +import org.openapitools.model.Note; +import org.openapitools.model.TextDateAnnotationRequest; +import org.openapitools.model.TextDateAnnotation; +import org.openapitools.model.TextDateAnnotations; +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.nlpsandbox.DateExtractor; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") +@Validated +@Api(value = "textDateAnnotations", description = "the textDateAnnotations API") +public interface TextDateAnnotationsApi { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * POST /textDateAnnotations : Annotate dates in a clinical note + * Return the date annotations found in a clinical note + * + * @param textDateAnnotationRequest (optional) + * @return Success (status code 200) + * or Unauthorized (status code 403) + */ + @ApiOperation(value = "Annotate dates in a clinical note", nickname = "createTextDateAnnotations", notes = "Return the date annotations found in a clinical note", response = TextDateAnnotations.class, tags={ "TextDateAnnotation", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success", response = TextDateAnnotations.class), + @ApiResponse(code = 403, message = "Unauthorized", response = Error.class) }) + @PostMapping( + value = "/textDateAnnotations", + produces = { "application/json" }, + consumes = { "application/json" } + ) + default ResponseEntity createTextDateAnnotations(@ApiParam(value = "" ) @Valid @RequestBody(required = false) TextDateAnnotationRequest textDateAnnotationRequest) { + String text = textDateAnnotationRequest.getNote().getText(); + List annotations = new DateExtractor() + .findDatesFromString(text); + TextDateAnnotations res = new TextDateAnnotations() + .textDateAnnotations(annotations); + + return new ResponseEntity(res, HttpStatus.OK); + } + +} diff --git a/server/src/main/java/org/openapitools/api/DatesApiController.java b/server/src/main/java/org/openapitools/api/TextDateAnnotationsApiController.java similarity index 75% rename from server/src/main/java/org/openapitools/api/DatesApiController.java rename to server/src/main/java/org/openapitools/api/TextDateAnnotationsApiController.java index bf54181..98d9a22 100644 --- a/server/src/main/java/org/openapitools/api/DatesApiController.java +++ b/server/src/main/java/org/openapitools/api/TextDateAnnotationsApiController.java @@ -4,16 +4,15 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") @Controller @RequestMapping("${openapi.nLPSandboxDateAnnotator.base-path:/api/v1}") -public class DatesApiController implements DatesApi { +public class TextDateAnnotationsApiController implements TextDateAnnotationsApi { private final NativeWebRequest request; @org.springframework.beans.factory.annotation.Autowired - public DatesApiController(NativeWebRequest request) { + public TextDateAnnotationsApiController(NativeWebRequest request) { this.request = request; } diff --git a/server/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java b/server/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java index 5c7cfaa..327a90b 100644 --- a/server/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java +++ b/server/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java @@ -17,8 +17,7 @@ import javax.servlet.ServletContext; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") @Configuration @EnableSwagger2 public class OpenAPIDocumentationConfig { @@ -30,7 +29,7 @@ ApiInfo apiInfo() { .license("Apache 2.0") .licenseUrl("https://github.com/Sage-Bionetworks/nlp-sandbox/blob/main/LICENSE") .termsOfServiceUrl("https://Sage-Bionetworks.github.io/nlp-sandbox-schemas") - .version("0.1.6") + .version("0.2.2") .contact(new Contact("","", "thomas.schaffter@sagebionetworks.org")) .build(); } diff --git a/server/src/main/java/org/openapitools/model/Annotation.java b/server/src/main/java/org/openapitools/model/Annotation.java deleted file mode 100644 index 4150a0c..0000000 --- a/server/src/main/java/org/openapitools/model/Annotation.java +++ /dev/null @@ -1,290 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import org.openapitools.model.Entity; -import org.openapitools.model.User; -import org.openapitools.jackson.nullable.JsonNullable; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * An annotation in a text - */ -@ApiModel(description = "An annotation in a text") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -public class Annotation { - @JsonProperty("id") - private Integer id; - - @JsonProperty("createdBy") - private User createdBy; - - @JsonProperty("createdAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime createdAt; - - @JsonProperty("updatedBy") - private User updatedBy; - - @JsonProperty("updatedAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime updatedAt; - - @JsonProperty("noteId") - private Integer noteId; - - @JsonProperty("start") - private Integer start; - - @JsonProperty("length") - private Integer length; - - @JsonProperty("text") - private String text; - - public Annotation id(Integer id) { - this.id = id; - return this; - } - - /** - * ID - * @return id - */ - @ApiModelProperty(example = "0", value = "ID") - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Annotation createdBy(User createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * Get createdBy - * @return createdBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(User createdBy) { - this.createdBy = createdBy; - } - - public Annotation createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * When the entity has been created - * @return createdAt - */ - @ApiModelProperty(value = "When the entity has been created") - - @Valid - - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public Annotation updatedBy(User updatedBy) { - this.updatedBy = updatedBy; - return this; - } - - /** - * Get updatedBy - * @return updatedBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(User updatedBy) { - this.updatedBy = updatedBy; - } - - public Annotation updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * When the entity has been updated - * @return updatedAt - */ - @ApiModelProperty(value = "When the entity has been updated") - - @Valid - - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public Annotation noteId(Integer noteId) { - this.noteId = noteId; - return this; - } - - /** - * The note ID - * @return noteId - */ - @ApiModelProperty(value = "The note ID") - - - public Integer getNoteId() { - return noteId; - } - - public void setNoteId(Integer noteId) { - this.noteId = noteId; - } - - public Annotation start(Integer start) { - this.start = start; - return this; - } - - /** - * The position of the first character - * @return start - */ - @ApiModelProperty(value = "The position of the first character") - - - public Integer getStart() { - return start; - } - - public void setStart(Integer start) { - this.start = start; - } - - public Annotation length(Integer length) { - this.length = length; - return this; - } - - /** - * The length of the annotation - * @return length - */ - @ApiModelProperty(value = "The length of the annotation") - - - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - public Annotation text(String text) { - this.text = text; - return this; - } - - /** - * The string annotated - * @return text - */ - @ApiModelProperty(value = "The string annotated") - - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Annotation annotation = (Annotation) o; - return Objects.equals(this.id, annotation.id) && - Objects.equals(this.createdBy, annotation.createdBy) && - Objects.equals(this.createdAt, annotation.createdAt) && - Objects.equals(this.updatedBy, annotation.updatedBy) && - Objects.equals(this.updatedAt, annotation.updatedAt) && - Objects.equals(this.noteId, annotation.noteId) && - Objects.equals(this.start, annotation.start) && - Objects.equals(this.length, annotation.length) && - Objects.equals(this.text, annotation.text); - } - - @Override - public int hashCode() { - return Objects.hash(id, createdBy, createdAt, updatedBy, updatedAt, noteId, start, length, text); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Annotation {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" noteId: ").append(toIndentedString(noteId)).append("\n"); - sb.append(" start: ").append(toIndentedString(start)).append("\n"); - sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/server/src/main/java/org/openapitools/model/DateAnnotation.java b/server/src/main/java/org/openapitools/model/DateAnnotation.java deleted file mode 100644 index da61668..0000000 --- a/server/src/main/java/org/openapitools/model/DateAnnotation.java +++ /dev/null @@ -1,315 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import org.openapitools.model.Annotation; -import org.openapitools.model.User; -import org.openapitools.jackson.nullable.JsonNullable; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * A date annotation in a text - */ -@ApiModel(description = "A date annotation in a text") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -public class DateAnnotation { - @JsonProperty("id") - private Integer id; - - @JsonProperty("createdBy") - private User createdBy; - - @JsonProperty("createdAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime createdAt; - - @JsonProperty("updatedBy") - private User updatedBy; - - @JsonProperty("updatedAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime updatedAt; - - @JsonProperty("noteId") - private Integer noteId; - - @JsonProperty("start") - private Integer start; - - @JsonProperty("length") - private Integer length; - - @JsonProperty("text") - private String text; - - @JsonProperty("format") - private String format; - - public DateAnnotation id(Integer id) { - this.id = id; - return this; - } - - /** - * ID - * @return id - */ - @ApiModelProperty(example = "0", value = "ID") - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public DateAnnotation createdBy(User createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * Get createdBy - * @return createdBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(User createdBy) { - this.createdBy = createdBy; - } - - public DateAnnotation createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * When the entity has been created - * @return createdAt - */ - @ApiModelProperty(value = "When the entity has been created") - - @Valid - - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public DateAnnotation updatedBy(User updatedBy) { - this.updatedBy = updatedBy; - return this; - } - - /** - * Get updatedBy - * @return updatedBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(User updatedBy) { - this.updatedBy = updatedBy; - } - - public DateAnnotation updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * When the entity has been updated - * @return updatedAt - */ - @ApiModelProperty(value = "When the entity has been updated") - - @Valid - - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public DateAnnotation noteId(Integer noteId) { - this.noteId = noteId; - return this; - } - - /** - * The note ID - * @return noteId - */ - @ApiModelProperty(value = "The note ID") - - - public Integer getNoteId() { - return noteId; - } - - public void setNoteId(Integer noteId) { - this.noteId = noteId; - } - - public DateAnnotation start(Integer start) { - this.start = start; - return this; - } - - /** - * The position of the first character - * @return start - */ - @ApiModelProperty(value = "The position of the first character") - - - public Integer getStart() { - return start; - } - - public void setStart(Integer start) { - this.start = start; - } - - public DateAnnotation length(Integer length) { - this.length = length; - return this; - } - - /** - * The length of the annotation - * @return length - */ - @ApiModelProperty(value = "The length of the annotation") - - - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - public DateAnnotation text(String text) { - this.text = text; - return this; - } - - /** - * The string annotated - * @return text - */ - @ApiModelProperty(value = "The string annotated") - - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public DateAnnotation format(String format) { - this.format = format; - return this; - } - - /** - * Date format (ISO 8601) - * @return format - */ - @ApiModelProperty(value = "Date format (ISO 8601)") - - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DateAnnotation dateAnnotation = (DateAnnotation) o; - return Objects.equals(this.id, dateAnnotation.id) && - Objects.equals(this.createdBy, dateAnnotation.createdBy) && - Objects.equals(this.createdAt, dateAnnotation.createdAt) && - Objects.equals(this.updatedBy, dateAnnotation.updatedBy) && - Objects.equals(this.updatedAt, dateAnnotation.updatedAt) && - Objects.equals(this.noteId, dateAnnotation.noteId) && - Objects.equals(this.start, dateAnnotation.start) && - Objects.equals(this.length, dateAnnotation.length) && - Objects.equals(this.text, dateAnnotation.text) && - Objects.equals(this.format, dateAnnotation.format); - } - - @Override - public int hashCode() { - return Objects.hash(id, createdBy, createdAt, updatedBy, updatedAt, noteId, start, length, text, format); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DateAnnotation {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" noteId: ").append(toIndentedString(noteId)).append("\n"); - sb.append(" start: ").append(toIndentedString(start)).append("\n"); - sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" format: ").append(toIndentedString(format)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/server/src/main/java/org/openapitools/model/Entity.java b/server/src/main/java/org/openapitools/model/Entity.java deleted file mode 100644 index 9524566..0000000 --- a/server/src/main/java/org/openapitools/model/Entity.java +++ /dev/null @@ -1,188 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import org.openapitools.model.User; -import org.openapitools.jackson.nullable.JsonNullable; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * Entity - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -public class Entity { - @JsonProperty("id") - private Integer id; - - @JsonProperty("createdBy") - private User createdBy; - - @JsonProperty("createdAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime createdAt; - - @JsonProperty("updatedBy") - private User updatedBy; - - @JsonProperty("updatedAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime updatedAt; - - public Entity id(Integer id) { - this.id = id; - return this; - } - - /** - * ID - * @return id - */ - @ApiModelProperty(example = "0", value = "ID") - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Entity createdBy(User createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * Get createdBy - * @return createdBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(User createdBy) { - this.createdBy = createdBy; - } - - public Entity createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * When the entity has been created - * @return createdAt - */ - @ApiModelProperty(value = "When the entity has been created") - - @Valid - - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public Entity updatedBy(User updatedBy) { - this.updatedBy = updatedBy; - return this; - } - - /** - * Get updatedBy - * @return updatedBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(User updatedBy) { - this.updatedBy = updatedBy; - } - - public Entity updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * When the entity has been updated - * @return updatedAt - */ - @ApiModelProperty(value = "When the entity has been updated") - - @Valid - - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Entity entity = (Entity) o; - return Objects.equals(this.id, entity.id) && - Objects.equals(this.createdBy, entity.createdBy) && - Objects.equals(this.createdAt, entity.createdAt) && - Objects.equals(this.updatedBy, entity.updatedBy) && - Objects.equals(this.updatedAt, entity.updatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, createdBy, createdAt, updatedBy, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Entity {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/server/src/main/java/org/openapitools/model/Error.java b/server/src/main/java/org/openapitools/model/Error.java index e7245ce..b8cc038 100644 --- a/server/src/main/java/org/openapitools/model/Error.java +++ b/server/src/main/java/org/openapitools/model/Error.java @@ -10,10 +10,10 @@ import javax.validation.constraints.*; /** - * Error + * Problem details (tools.ietf.org/html/rfc7807) */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - +@ApiModel(description = "Problem details (tools.ietf.org/html/rfc7807)") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") public class Error { @JsonProperty("title") private String title; @@ -111,7 +111,7 @@ public void setType(String type) { @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -147,7 +147,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(java.lang.Object o) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } diff --git a/server/src/main/java/org/openapitools/model/Health.java b/server/src/main/java/org/openapitools/model/Health.java deleted file mode 100644 index ae552fe..0000000 --- a/server/src/main/java/org/openapitools/model/Health.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.openapitools.jackson.nullable.JsonNullable; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * Health - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -public class Health { - /** - * Health status - */ - public enum StatusEnum { - PASS("pass"), - - WARN("warn"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - } - - @JsonProperty("status") - private StatusEnum status; - - public Health status(StatusEnum status) { - this.status = status; - return this; - } - - /** - * Health status - * @return status - */ - @ApiModelProperty(value = "Health status") - - - public StatusEnum getStatus() { - return status; - } - - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Health health = (Health) o; - return Objects.equals(this.status, health.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Health {\n"); - - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/server/src/main/java/org/openapitools/model/Note.java b/server/src/main/java/org/openapitools/model/Note.java index 96d53c9..505fba0 100644 --- a/server/src/main/java/org/openapitools/model/Note.java +++ b/server/src/main/java/org/openapitools/model/Note.java @@ -3,12 +3,8 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.time.OffsetDateTime; -import org.openapitools.model.Entity; -import org.openapitools.model.User; import org.openapitools.jackson.nullable.JsonNullable; import javax.validation.Valid; import javax.validation.constraints.*; @@ -17,214 +13,105 @@ * A clinical note */ @ApiModel(description = "A clinical note") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") public class Note { @JsonProperty("id") - private Integer id; - - @JsonProperty("createdBy") - private User createdBy; - - @JsonProperty("createdAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime createdAt; - - @JsonProperty("updatedBy") - private User updatedBy; - - @JsonProperty("updatedAt") - @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME) - private OffsetDateTime updatedAt; + private String id; @JsonProperty("text") private String text; - /** - * The note type - */ - public enum TypeEnum { - PATHOLOGY("pathology"), - - PHONE_CALL("phone_call"); - - private String value; + @JsonProperty("noteType") + private String noteType; - TypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - } + @JsonProperty("patientId") + private String patientId; - @JsonProperty("type") - private TypeEnum type; - - public Note id(Integer id) { + public Note id(String id) { this.id = id; return this; } /** - * ID + * The ID of the note * @return id */ - @ApiModelProperty(example = "0", value = "ID") + @ApiModelProperty(readOnly = true, value = "The ID of the note") - public Integer getId() { + public String getId() { return id; } - public void setId(Integer id) { + public void setId(String id) { this.id = id; } - public Note createdBy(User createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * Get createdBy - * @return createdBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(User createdBy) { - this.createdBy = createdBy; - } - - public Note createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * When the entity has been created - * @return createdAt - */ - @ApiModelProperty(value = "When the entity has been created") - - @Valid - - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public Note updatedBy(User updatedBy) { - this.updatedBy = updatedBy; - return this; - } - - /** - * Get updatedBy - * @return updatedBy - */ - @ApiModelProperty(value = "") - - @Valid - - public User getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(User updatedBy) { - this.updatedBy = updatedBy; - } - - public Note updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; + public Note text(String text) { + this.text = text; return this; } /** - * When the entity has been updated - * @return updatedAt + * The content of the clinical note + * @return text */ - @ApiModelProperty(value = "When the entity has been updated") + @ApiModelProperty(example = "On 12/26/2020, Ms. Chloe Price met with Dr. Prescott.", required = true, value = "The content of the clinical note") + @NotNull - @Valid - public OffsetDateTime getUpdatedAt() { - return updatedAt; + public String getText() { + return text; } - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; + public void setText(String text) { + this.text = text; } - public Note text(String text) { - this.text = text; + public Note noteType(String noteType) { + this.noteType = noteType; return this; } /** - * The content of the note - * @return text + * The note type (LOINC concept) + * @return noteType */ - @ApiModelProperty(example = "On 09-03-1999, Ms Chloe Price met with Dr Joe.", value = "The content of the note") + @ApiModelProperty(example = "loinc:LP29684-5", required = true, value = "The note type (LOINC concept)") + @NotNull - public String getText() { - return text; + public String getNoteType() { + return noteType; } - public void setText(String text) { - this.text = text; + public void setNoteType(String noteType) { + this.noteType = noteType; } - public Note type(TypeEnum type) { - this.type = type; + public Note patientId(String patientId) { + this.patientId = patientId; return this; } /** - * The note type - * @return type + * The patient ID + * @return patientId */ - @ApiModelProperty(value = "The note type") + @ApiModelProperty(example = "507f1f77bcf86cd799439011", value = "The patient ID") - public TypeEnum getType() { - return type; + public String getPatientId() { + return patientId; } - public void setType(TypeEnum type) { - this.type = type; + public void setPatientId(String patientId) { + this.patientId = patientId; } @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -233,31 +120,25 @@ public boolean equals(java.lang.Object o) { } Note note = (Note) o; return Objects.equals(this.id, note.id) && - Objects.equals(this.createdBy, note.createdBy) && - Objects.equals(this.createdAt, note.createdAt) && - Objects.equals(this.updatedBy, note.updatedBy) && - Objects.equals(this.updatedAt, note.updatedAt) && Objects.equals(this.text, note.text) && - Objects.equals(this.type, note.type); + Objects.equals(this.noteType, note.noteType) && + Objects.equals(this.patientId, note.patientId); } @Override public int hashCode() { - return Objects.hash(id, createdBy, createdAt, updatedBy, updatedAt, text, type); + return Objects.hash(id, text, noteType, patientId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Note {\n"); - + sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" noteType: ").append(toIndentedString(noteType)).append("\n"); + sb.append(" patientId: ").append(toIndentedString(patientId)).append("\n"); sb.append("}"); return sb.toString(); } @@ -266,7 +147,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(java.lang.Object o) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } diff --git a/server/src/main/java/org/openapitools/model/Service.java b/server/src/main/java/org/openapitools/model/Service.java index 2415d63..616482f 100644 --- a/server/src/main/java/org/openapitools/model/Service.java +++ b/server/src/main/java/org/openapitools/model/Service.java @@ -14,8 +14,7 @@ * Information about an NLP service */ @ApiModel(description = "Information about an NLP service") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") public class Service { @JsonProperty("name") private String name; @@ -204,7 +203,7 @@ public void setUrl(URI url) { @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -248,7 +247,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(java.lang.Object o) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } diff --git a/server/src/main/java/org/openapitools/model/TextAnnotation.java b/server/src/main/java/org/openapitools/model/TextAnnotation.java new file mode 100644 index 0000000..89e60e0 --- /dev/null +++ b/server/src/main/java/org/openapitools/model/TextAnnotation.java @@ -0,0 +1,159 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * An annotation in a text + */ +@ApiModel(description = "An annotation in a text") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") +public class TextAnnotation { + @JsonProperty("start") + private Integer start; + + @JsonProperty("length") + private Integer length; + + @JsonProperty("text") + private String text; + + @JsonProperty("confidence") + private Float confidence; + + public TextAnnotation start(Integer start) { + this.start = start; + return this; + } + + /** + * The position of the first character + * @return start + */ + @ApiModelProperty(example = "42", required = true, value = "The position of the first character") + @NotNull + + + public Integer getStart() { + return start; + } + + public void setStart(Integer start) { + this.start = start; + } + + public TextAnnotation length(Integer length) { + this.length = length; + return this; + } + + /** + * The length of the annotation + * @return length + */ + @ApiModelProperty(example = "10", required = true, value = "The length of the annotation") + @NotNull + + + public Integer getLength() { + return length; + } + + public void setLength(Integer length) { + this.length = length; + } + + public TextAnnotation text(String text) { + this.text = text; + return this; + } + + /** + * The string annotated + * @return text + */ + @ApiModelProperty(value = "The string annotated") + + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public TextAnnotation confidence(Float confidence) { + this.confidence = confidence; + return this; + } + + /** + * The confidence in the accuracy of the annotation + * minimum: 0 + * maximum: 100 + * @return confidence + */ + @ApiModelProperty(example = "95", value = "The confidence in the accuracy of the annotation") + +@DecimalMin("0") @DecimalMax("100") + public Float getConfidence() { + return confidence; + } + + public void setConfidence(Float confidence) { + this.confidence = confidence; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TextAnnotation textAnnotation = (TextAnnotation) o; + return Objects.equals(this.start, textAnnotation.start) && + Objects.equals(this.length, textAnnotation.length) && + Objects.equals(this.text, textAnnotation.text) && + Objects.equals(this.confidence, textAnnotation.confidence); + } + + @Override + public int hashCode() { + return Objects.hash(start, length, text, confidence); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TextAnnotation {\n"); + + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/server/src/main/java/org/openapitools/model/TextDateAnnotation.java b/server/src/main/java/org/openapitools/model/TextDateAnnotation.java new file mode 100644 index 0000000..57e4583 --- /dev/null +++ b/server/src/main/java/org/openapitools/model/TextDateAnnotation.java @@ -0,0 +1,186 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.TextAnnotation; +import org.openapitools.model.TextDateAnnotationAllOf; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * A date annotation in a text + */ +@ApiModel(description = "A date annotation in a text") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") +public class TextDateAnnotation { + @JsonProperty("start") + private Integer start; + + @JsonProperty("length") + private Integer length; + + @JsonProperty("text") + private String text; + + @JsonProperty("confidence") + private Float confidence; + + @JsonProperty("dateFormat") + private String dateFormat; + + public TextDateAnnotation start(Integer start) { + this.start = start; + return this; + } + + /** + * The position of the first character + * @return start + */ + @ApiModelProperty(example = "42", required = true, value = "The position of the first character") + @NotNull + + + public Integer getStart() { + return start; + } + + public void setStart(Integer start) { + this.start = start; + } + + public TextDateAnnotation length(Integer length) { + this.length = length; + return this; + } + + /** + * The length of the annotation + * @return length + */ + @ApiModelProperty(example = "10", required = true, value = "The length of the annotation") + @NotNull + + + public Integer getLength() { + return length; + } + + public void setLength(Integer length) { + this.length = length; + } + + public TextDateAnnotation text(String text) { + this.text = text; + return this; + } + + /** + * The string annotated + * @return text + */ + @ApiModelProperty(value = "The string annotated") + + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public TextDateAnnotation confidence(Float confidence) { + this.confidence = confidence; + return this; + } + + /** + * The confidence in the accuracy of the annotation + * minimum: 0 + * maximum: 100 + * @return confidence + */ + @ApiModelProperty(example = "95", value = "The confidence in the accuracy of the annotation") + +@DecimalMin("0") @DecimalMax("100") + public Float getConfidence() { + return confidence; + } + + public void setConfidence(Float confidence) { + this.confidence = confidence; + } + + public TextDateAnnotation dateFormat(String dateFormat) { + this.dateFormat = dateFormat; + return this; + } + + /** + * Date format (ISO 8601) + * @return dateFormat + */ + @ApiModelProperty(example = "MM/DD/YYYY", value = "Date format (ISO 8601)") + + + public String getDateFormat() { + return dateFormat; + } + + public void setDateFormat(String dateFormat) { + this.dateFormat = dateFormat; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TextDateAnnotation textDateAnnotation = (TextDateAnnotation) o; + return Objects.equals(this.start, textDateAnnotation.start) && + Objects.equals(this.length, textDateAnnotation.length) && + Objects.equals(this.text, textDateAnnotation.text) && + Objects.equals(this.confidence, textDateAnnotation.confidence) && + Objects.equals(this.dateFormat, textDateAnnotation.dateFormat); + } + + @Override + public int hashCode() { + return Objects.hash(start, length, text, confidence, dateFormat); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TextDateAnnotation {\n"); + + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" dateFormat: ").append(toIndentedString(dateFormat)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/server/src/main/java/org/openapitools/model/TextDateAnnotationAllOf.java b/server/src/main/java/org/openapitools/model/TextDateAnnotationAllOf.java new file mode 100644 index 0000000..24c493e --- /dev/null +++ b/server/src/main/java/org/openapitools/model/TextDateAnnotationAllOf.java @@ -0,0 +1,79 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * TextDateAnnotationAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") +public class TextDateAnnotationAllOf { + @JsonProperty("dateFormat") + private String dateFormat; + + public TextDateAnnotationAllOf dateFormat(String dateFormat) { + this.dateFormat = dateFormat; + return this; + } + + /** + * Date format (ISO 8601) + * @return dateFormat + */ + @ApiModelProperty(example = "MM/DD/YYYY", value = "Date format (ISO 8601)") + + + public String getDateFormat() { + return dateFormat; + } + + public void setDateFormat(String dateFormat) { + this.dateFormat = dateFormat; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TextDateAnnotationAllOf textDateAnnotationAllOf = (TextDateAnnotationAllOf) o; + return Objects.equals(this.dateFormat, textDateAnnotationAllOf.dateFormat); + } + + @Override + public int hashCode() { + return Objects.hash(dateFormat); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TextDateAnnotationAllOf {\n"); + + sb.append(" dateFormat: ").append(toIndentedString(dateFormat)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/server/src/main/java/org/openapitools/model/TextDateAnnotationRequest.java b/server/src/main/java/org/openapitools/model/TextDateAnnotationRequest.java new file mode 100644 index 0000000..4d3237e --- /dev/null +++ b/server/src/main/java/org/openapitools/model/TextDateAnnotationRequest.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Note; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * An annotation request + */ +@ApiModel(description = "An annotation request") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") +public class TextDateAnnotationRequest { + @JsonProperty("note") + private Note note; + + public TextDateAnnotationRequest note(Note note) { + this.note = note; + return this; + } + + /** + * Get note + * @return note + */ + @ApiModelProperty(value = "") + + @Valid + + public Note getNote() { + return note; + } + + public void setNote(Note note) { + this.note = note; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TextDateAnnotationRequest textDateAnnotationRequest = (TextDateAnnotationRequest) o; + return Objects.equals(this.note, textDateAnnotationRequest.note); + } + + @Override + public int hashCode() { + return Objects.hash(note); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TextDateAnnotationRequest {\n"); + + sb.append(" note: ").append(toIndentedString(note)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/server/src/main/java/org/openapitools/model/TextDateAnnotations.java b/server/src/main/java/org/openapitools/model/TextDateAnnotations.java new file mode 100644 index 0000000..feca89a --- /dev/null +++ b/server/src/main/java/org/openapitools/model/TextDateAnnotations.java @@ -0,0 +1,93 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.model.TextDateAnnotation; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * A list of text date annotations + */ +@ApiModel(description = "A list of text date annotations") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-26T14:44:24.992301-08:00[America/Los_Angeles]") +public class TextDateAnnotations { + @JsonProperty("textDateAnnotations") + @Valid + private List textDateAnnotations = null; + + public TextDateAnnotations textDateAnnotations(List textDateAnnotations) { + this.textDateAnnotations = textDateAnnotations; + return this; + } + + public TextDateAnnotations addTextDateAnnotationsItem(TextDateAnnotation textDateAnnotationsItem) { + if (this.textDateAnnotations == null) { + this.textDateAnnotations = new ArrayList<>(); + } + this.textDateAnnotations.add(textDateAnnotationsItem); + return this; + } + + /** + * A list of text date annotations + * @return textDateAnnotations + */ + @ApiModelProperty(value = "A list of text date annotations") + + @Valid + + public List getTextDateAnnotations() { + return textDateAnnotations; + } + + public void setTextDateAnnotations(List textDateAnnotations) { + this.textDateAnnotations = textDateAnnotations; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TextDateAnnotations textDateAnnotations = (TextDateAnnotations) o; + return Objects.equals(this.textDateAnnotations, textDateAnnotations.textDateAnnotations); + } + + @Override + public int hashCode() { + return Objects.hash(textDateAnnotations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TextDateAnnotations {\n"); + + sb.append(" textDateAnnotations: ").append(toIndentedString(textDateAnnotations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/server/src/main/java/org/openapitools/model/User.java b/server/src/main/java/org/openapitools/model/User.java deleted file mode 100644 index 7ae57d6..0000000 --- a/server/src/main/java/org/openapitools/model/User.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.openapitools.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.openapitools.jackson.nullable.JsonNullable; -import javax.validation.Valid; -import javax.validation.constraints.*; - -/** - * User - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2020-11-03T16:14:43.095400-08:00[America/Los_Angeles]") - -public class User { - @JsonProperty("username") - private String username; - - @JsonProperty("firstName") - private String firstName; - - @JsonProperty("lastName") - private String lastName; - - @JsonProperty("email") - private String email; - - public User username(String username) { - this.username = username; - return this; - } - - /** - * Get username - * @return username - */ - @ApiModelProperty(example = "John78", required = true, value = "") - @NotNull - -@Size(min=4) - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public User firstName(String firstName) { - this.firstName = firstName; - return this; - } - - /** - * Get firstName - * @return firstName - */ - @ApiModelProperty(example = "John", required = true, value = "") - @NotNull - - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public User lastName(String lastName) { - this.lastName = lastName; - return this; - } - - /** - * Get lastName - * @return lastName - */ - @ApiModelProperty(example = "Smith", required = true, value = "") - @NotNull - - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public User email(String email) { - this.email = email; - return this; - } - - /** - * User email address - * @return email - */ - @ApiModelProperty(example = "john.smith@example.com", required = true, value = "User email address") - @NotNull - - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email); - } - - @Override - public int hashCode() { - return Objects.hash(username, firstName, lastName, email); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} -