Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce CLI and NPM package #663

Open
2 of 9 tasks
ivan-aksamentov opened this issue May 8, 2020 · 1 comment
Open
2 of 9 tasks

Introduce CLI and NPM package #663

ivan-aksamentov opened this issue May 8, 2020 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed IMPORTANT Take this immediately! s:algo Scope: related to the algorithm, modelling or other scientific concerns t:feat Type: request of a new feature, functionality, enchancement

Comments

@ivan-aksamentov
Copy link
Member

ivan-aksamentov commented May 8, 2020

馃檵 Feature Request

馃敠 Context

We would like to allow our users to run the algorithm "in bulk", for different scenarios, without the need to operate the UI.

馃槸 Describe the feature

NPM package would contain all the necessary algorithmic parts, data and schemas and will implement:

  • CLI
  • programmatic Node.js API (a set of functions to be imported and used in user's scripts)
  • transpile and bundle Typescript (with rollup), with typings included
  • reading input parameters from JSON file
  • overriding input parameters with command line arguments
  • producing TSV outputs (detailed or summary)
  • using schemas as much as possible: to generate command line arguments, serialize and validate payloads etc.
  • (possibly) structure the package such that it would allow to easy integrate it into API servers and other value-added products
  • (possibly) wrappers for different languages (Python and R are the most requested)

馃捇 Examples

馃拋 Possible Solution

Related

@ivan-aksamentov ivan-aksamentov added t:feat Type: request of a new feature, functionality, enchancement help wanted Extra attention is needed s:algo Scope: related to the algorithm, modelling or other scientific concerns IMPORTANT Take this immediately! good first issue Good for newcomers labels May 8, 2020
@ivan-aksamentov
Copy link
Member Author

ivan-aksamentov commented May 20, 2020

#689 adds some very basic CLI.

Some immediate improvements would be:

  • create a cli/ directory
  • implement a proper CLI arguments parser (with a library. For example, I like neodoc)
  • wrap run() into another function, which can be exported from an NPM package for programmatic access. run function should not be exposed directly, to reserve the right of changing it's signature internally.
  • validate user's inputs using a schema (see below)
  • severity and age distribution json files are imported (bundled along with corresponding get*() function), but should be read as JSON files instead
  • probably no need to validate severity and age distribution separately, because they are validated upon generation. The validation in get*() functions in the app is mostly a precaution for development mode
  • the external API should use Shareable schema and corresponding deserialization and validation (reuse the code for URL and scenario file imports. This code should probably moved out of components/). This however assumes user provides their own severity and age distribution. One can still read and merge the default severity and age distribution if needed though (this should be coltrolled with optional cll arguments and optional fields in the programmatic API)
  • reading JSON files could be done with fs-extra, instead of a manual solution
  • for console output the console.log should not be used outside of debugging. Use more fine-grained console.{info,warn,error}, or, better, a proper solution such as debug package.
  • CLI and programmatic API should be transpiled with rollup and published on NPM

@ivan-aksamentov ivan-aksamentov changed the title Introduce NPM package Introduce CLI and NPM package Jun 24, 2020
@nspringman nspringman mentioned this issue Jul 27, 2020
Closed
@r-s-rai r-s-rai mentioned this issue Jul 27, 2020
@ivan-aksamentov ivan-aksamentov mentioned this issue Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed IMPORTANT Take this immediately! s:algo Scope: related to the algorithm, modelling or other scientific concerns t:feat Type: request of a new feature, functionality, enchancement
Projects
None yet
Development

No branches or pull requests

1 participant