RENCI / pds

PDS application (tx-router plugin)
MIT License
1 stars 0 forks source link

[BUG] (pds-config) refactor pds-config API (deliverable 5.2) #133

Closed krobasky closed 4 years ago

krobasky commented 4 years ago

Which repo (e.g., tx-logging)? pds-config

Expected Behavior pds-config to demonstrate phase 2 api designs; since this is a plugin should we call it pdspi-config?

Actual Behavior pds-config currently demonstrates phase 1 api design

Information

Don't close the ticket until:

  1. the spec below has been fully implemented (talk to me if changes are required)
  2. test cases for calling the endpoints are deployed and configured for autotest/autobuild on dockerhub for v0.2.0 (stable release) and 'unstable' (master branch), using the file 'env.TAG' in ./pds-config (see tx-router/env.TAG and tx-router/test/test.sh for example code)
  3. the new plugin is deployed on pds.renci.org and both endpoints are fully working with the deployed containers for pds-config
  4. all the environmental variable values in all the dockercompose files are set using variables (not hard-coded) and those variables are documented and explained in the pds repo (see tx-router/test/test.sh and tx-router/test/docker-compose.yml for examples)
  5. the pdspi-guidance-example repo docker-compose.yml files are pointing to the :unstable version of dependent containers.
  6. there is documentation on the pdspi-config repo README on how to install/configure/deploy (can be pointing to other repos), especially HOW to set the environmental variables that are required by the Docker and docker-compose.yml files
  7. Somebody on the team has done a code-review and an acceptance test of the solution

the specific, API design for the refactored, Phase 2 API is at: https://app.swaggerhub.com/apis/krobasky/pdspi-config/2.0.0

the yaml:

openapi: 3.0.0
# Added by API Auto Mocking Plugin
servers:
  - description: Example PDS config plugin
    url: https://virtserver.swaggerhub.com/krobasky/pdspi-config/1.0.0
info:
  description: This is the PDS config API
  version: "2.0.0"
  title: Config plugin API
  contact:
    email: txscience@lists.renci.org
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
paths:
  /config:
    get:
      summary: returns all the enabled plugin ids
      operationId: api.get_config
      parameters:
        - name: pitype
          example: "guidance"
          in: query
          required: true
          schema:
            type: string
          description: returns a list of all the installed plugin ids and whether or not they are enabled
      responses:
        '200':
          description: config
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Plugin'
        '400':
          description: bad input parameter
  /enable-guidance:
    post:
      summary: enables the specified plugin as a guidance type
      operationId: api.set_enabled
      responses:
        '200':
          description: enable matching query
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PluginConfig'
        '400':
          description: bad input parameter
      requestBody:
        description: plugin ID and enable = true or false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Enable'
components:
  schemas:
    Plugin:
      type: object
      required:
        - piid
        - pluginType
      properties:
        piid:
          type: string
          description: unique plugin id
          example: "pdspi-guidance-example"
        pluginType:
          type: string
          description: the type pof plugin, 'guidance | fhir | mapper'
          example: "guidance"
        enabled:
          type: string
          description: the plugin status, true = enabled, false =  disabled
          example: "true"
    PluginConfig:
      type: object
      properties:
        title:
          type: string
          description: "Meaningful name for this plugin"
          example: "Aminogycoside dosing guidance"
        piid:
          type: string
          description: "A string, unique to this deployment, used to identify this plugin in realtime"
          example: "pdspi-aminogycoside-nomogram"
        pluginSelectors:
          type: array
          items:
            $ref: '#/components/schemas/PluginSelector'
        pluginParameterDefaults:
          type: array
          items:
            $ref: '#/components/schemas/PluginParameter'
        requiredPatientVariables:
          type: array
          items:
            $ref: '#/components/schemas/PatientVariableType'
    PluginSelector:
      description: The combination of selector values map to a unique plugin. That is, no two plugins can install with the identical vectors of selector values.  
      type: object
      properties:
        title:
          type: string
          example: "Gentamicin"
        code:
          type: string
          example: "1596450"
        selectorType:
          $ref: '#/components/schemas/PluginSelectorType'
    PluginSelectorType:
      description: Plugins providing Drug selector types will always use RxCUI when naming the drug. Diagnosis types will use ICD10, and genetics will use SNP for variants and NCBI for gene and transcript names.  
      type: object
      properties:
        title:
          type: string
          example: "Drug"
        system:
          type: string
          example: "RxCUI"
    PluginParameter:
      type: object
      properties:
        value:
          type: string
          description: the actual value of the model parameter
          example: "Hartford"
        units:
          type: string
          description: "The unit is standard throughout the pds system. It's up to the guidance plugin to make unit conversions as needed by the guidance model, just as it is up to the dashboard to make unit conversions as needed by the end user."
          example: "none"
        parameterType:
          $ref: '#/components/schemas/PluginParameterType'
    PluginParameterType:
      type: object
      properties:
        title:
          type: string
          example: "Extended interval nomogram"
        code:  
          type: string
          example: "PDS:01"
        system: 
          type: string
          example: "PDS.plugin.parameters"
        legalValues:
          type: string
          example: 'enum: ["Hartford", "Urban-Craig", "Conventional A", "Conventional B"]'
        description:
          type: string
          example: "This calculator uses one of four extended-interval nomograms. Please choose one nomogram."
    PatientVariableType:
      type: object
      properties:
        title:
          type: string
          example: "Age"
        clinicalFeatureVariable:
          type: string
          example: "LOINC:30525-0"
        description: 
          type: string
          example: "Age is a floating point number; e.g., a 6 month old child is 0.5 years."
        why:
          type: string
          example: "Age is used to calculate the creatinine clearance. Dosing is lower for geriatric patient and contraindicated for pediatric patients"
    Enable:
      type: object
      required:
        - piid
        - action
      properties:
        piid:
          type: string
          description: unique plugin id
          example: "pdspi-guidance-example"
        action:
          type: string
          description: '[enable | disable | delete]'
          example: 'disable'
krobasky commented 4 years ago

Here's a figure to help inform the implementation: image

krobasky commented 4 years ago

see also figure on #130 related are #131, #132

krobasky commented 4 years ago

latest api : http://pds.renci.org:8080/v1/plugin/pdspi-config/ui/#