Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
api: Remove ModelSlug enum.
Browse files Browse the repository at this point in the history
This was no longer being used as an enum now that model connectors have
been made independent and their Docker image is supplied as part of the
payload. However, because it was still being validated as part of the
schema it was making it more difficult to add new models.
  • Loading branch information
gorzell committed May 12, 2020
1 parent 4aa457c commit d3ab649
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@covid-modeling/api",
"version": "0.9.1",
"version": "0.10.0",
"main": "dist/src/index",
"types": "dist/src/index.d.ts",
"scripts": {
Expand Down
11 changes: 1 addition & 10 deletions packages/api/schema/runner.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"type": "string"
},
"slug": {
"$ref": "#/definitions/ModelSlug"
"type": "string"
}
},
"required": [
Expand Down Expand Up @@ -122,15 +122,6 @@
],
"type": "object"
},
"ModelSlug": {
"enum": [
"mrc-ide-covid-sim",
"basel",
"mc19",
"idm-covasim"
],
"type": "string"
},
"RequestInput": {
"additionalProperties": false,
"properties": {
Expand Down
11 changes: 2 additions & 9 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,14 @@ export enum RunStatus {
}

export interface RunOutput {
modelSlug: ModelSlug
modelSlug: string
status: RunStatus
resultsLocation: string
exportLocation: string
workflowRunID?: string
}

export enum ModelSlug {
MRCIDECovidSim = 'mrc-ide-covid-sim',
Basel = 'basel',
MC19 = 'mc19',
IDMCovasim = 'idm-covasim',
}

export interface Model {
slug: ModelSlug
slug: string
imageURL: string
}
4 changes: 2 additions & 2 deletions packages/model-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@covid-modeling/model-runner",
"version": "1.1.2",
"version": "1.2.0",
"main": "dist/index.js",
"scripts": {
"test": "PATH=$PATH:../../node_modules/.bin && mocha --debug-brk --ui tdd -r ts-node/register test/unit/*-test.ts",
Expand All @@ -19,7 +19,7 @@
"dependencies": {
"@azure/identity": "^1.1.0-preview1",
"@azure/storage-blob": "^12.1.1",
"@covid-modeling/api": "0.9.1",
"@covid-modeling/api": "^0.10.0",
"archiver": "^4.0.1",
"d3": "^5.15.0",
"dockerode": "^3.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/model-runner/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as pino from 'pino'
import * as path from 'path'
import * as mkdirp from 'mkdirp'
import { ModelSlug, RunStatus, RequestInput } from '@covid-modeling/api'
import { RunStatus, RequestInput } from '@covid-modeling/api'
import { BlobStorage } from './blobstore'
import { notifyUI } from './notify-ui'
import { logger } from './logger'
Expand All @@ -23,7 +23,7 @@ import { enforceRunnerInputSchema, enforceOutputSchema } from './schema'

let inputID: string | number | null = null
let callbackURL: string | null = null
let modelSlug: ModelSlug | null = null
let modelSlug: string | null = null

const handleRejection: NodeJS.UnhandledRejectionListener = err => {
const finalLogger = pino.final(logger)
Expand Down
2 changes: 1 addition & 1 deletion packages/mrc-ide-covidsim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"license": "MIT",
"dependencies": {
"@covid-modeling/api": "0.9.*",
"@covid-modeling/api": "^0.10.0",
"d3": "^5.15.0",
"jsen": "^0.6.6",
"luxon": "^1.23.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from 'fs'
import { assert } from 'chai'
import { ImperialModel } from '../../src/imperial'
import { BIN_DIR, MODEL_DATA_DIR } from '../../src/config'
import { input, ModelSlug } from '@covid-modeling/api'
import { input } from '@covid-modeling/api'

suite('imperial integration', () => {
test('run imperial model for Wyoming', async () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/mrc-ide-covidsim/test/unit/convert-output-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from 'chai'
import { ModelSlug, input } from '@covid-modeling/api'
import { input } from '@covid-modeling/api'
import { convertOutput } from '../../src/convert-output'

const parameters: input.ModelParameters = {
Expand All @@ -13,10 +13,6 @@ const parameters: input.ModelParameters = {
suite('converting imperial model output to JSON', () => {
test('returns a time series for each metric', () => {
const input = {
model: {
slug: ModelSlug.MRCIDECovidSim,
imageURL: '',
},
region: 'US',
subregion: 'US-WY',
parameters,
Expand Down
2 changes: 1 addition & 1 deletion packages/neherlab-covid-19-scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"license": "MIT",
"dependencies": {
"@covid-modeling/api": "0.9.*",
"@covid-modeling/api": "^0.10.0",
"d3": "^5.15.0",
"jsen": "^0.6.6",
"luxon": "^1.23.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path'
import * as temp from 'temp'
import * as fs from 'fs'
import { assert } from 'chai'
import { input, ModelSlug } from '@covid-modeling/api'
import { input } from '@covid-modeling/api'
import { BaselModel } from '../../src/basel'
import { BIN_DIR, MODEL_DATA_DIR } from '../../src/config'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from 'chai'
import { input, ModelSlug, output } from '@covid-modeling/api'
import { input, output } from '@covid-modeling/api'

import { AlgorithmResult, Scenario, AllParams } from '../../src/basel-api'
import { BaselConnector, BaselRunnerModelInput } from '../../src/basel'
Expand Down

0 comments on commit d3ab649

Please sign in to comment.