{"id":31766093,"url":"https://github.com/ibmdecisionoptimization/do-ws-js","last_synced_at":"2025-10-10T00:29:18.910Z","repository":{"id":57213765,"uuid":"152200841","full_name":"IBMDecisionOptimization/do-ws-js","owner":"IBMDecisionOptimization","description":"This library provides prototypes of both back-end and front-end services and APIs to ease the development of LoB application using Decision Optimization and Machine Learning for Watson Studio and Watson Machine Learning.","archived":false,"fork":false,"pushed_at":"2020-11-30T14:30:22.000Z","size":1047,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-24T16:10:18.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBMDecisionOptimization.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-09T06:42:51.000Z","updated_at":"2022-05-26T15:20:00.000Z","dependencies_parsed_at":"2022-08-29T02:10:39.743Z","dependency_job_id":null,"html_url":"https://github.com/IBMDecisionOptimization/do-ws-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IBMDecisionOptimization/do-ws-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdo-ws-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdo-ws-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdo-ws-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdo-ws-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBMDecisionOptimization","download_url":"https://codeload.github.com/IBMDecisionOptimization/do-ws-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdo-ws-js/sbom","scorecard":{"id":64491,"data":{"date":"2025-08-11","repo":{"name":"github.com/IBMDecisionOptimization/do-ws-js","commit":"63323cd701628f86b647ec774f3ca67cd22ce724"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-15T02:19:17.173Z","repository_id":57213765,"created_at":"2025-08-15T02:19:17.173Z","updated_at":"2025-08-15T02:19:17.173Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002359,"owners_count":26083356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-10T00:28:58.658Z","updated_at":"2025-10-10T00:29:18.902Z","avatar_url":"https://github.com/IBMDecisionOptimization.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# do-ws-js\nThis library provides both **back-end** and **front-end** services and APIs to ease the development of LoB application using Decision Optimization and Machine Learning for Watson Studio and Watson Machine Learning, including integration with Planning Analytics.\n\nIt includes support for:\n* **scenario management** of LoB application: store different sets of data as scenario.\n* **LoB User Interface** using google and d3 components: tables, charts, gantt charts, etc.\n* **integration of deployed optimization and machine learning models execution** easer using Watson Studio or Watson Machine Learning.\n* **integration with decision optimization and machine learning models development in Watson Studio** pushing production data to the development environment projects.\n* **integration with Planning Analytics** for more complete mulyti user interactive strategic what-if applications.\n\n##### Table of Contents  \n* [Technical pre-requisites](#Technical-pre-requisites)  \n* [Release Notes](#Release-Notes)\n* [Functionalities](#Functionalities)\n  * [Scenario Management](#Scenario-Management)\n  * [LoB User Interface](#LoB-User-Interface)\n  * [Decision Optimization](#Decision-Optimization)\n  * [Machine Learning](#Machine-Learning)\n  * [Watson Studio](#Watson-Studio)\n  * [Planning Analytics](#Planning-Analytics)\n* [Documentation](#Documentation)\n  * [REST APIs](#REST-APIs)\n  * [JavaScript classes and methods](#JavaScript-classes-and-methods)\n  * [Configuration file format](#Configuration-file-format)\n\n## Technical pre-requisites\n\nIt is constructed around the Node js framework, including:\n* a set of back-end services provided as REST APIs which can be added to an express Node JS server\n* a set of corresponding front end Javascript classes and functions, which use these back end APIs and support the creation of front end. \n\nA demonstration application is available at: https://github.com/IBMDecisionOptimization/do-ws-pa\n\n### Setting package dependency\n\nTo use this module, include it in your package.json file:\n```\n  \"dependencies\": {\n   ...\n    \"do-ws-js\": \"0.1.x\"\n  },\n```\n  \nTo use the back end functions, extend the express router of your node.js app doing, for example with the scenario componetn of the dods part.\n```\nvar router = express.Router();              // get an instance of the express Router\nvar dods = require('do-ws-js/dods');\ndods.routeScenario(router);\n```\n\nTo use the front end functions, include the right Javascript file, for example:\n```\n\u003cscript type=\"text/javascript\" src=\"./do-ws-js/scenario.js\"\u003e\u003c/script\u003e\n```\n\n### Configuration\n\nThe configuration for the different set of back end APis can be provided either at the initialization:\n```\nconfigdo = {\n  url:  'https://api-oaas.docloud.ibmcloud.com/job_manager/rest/v1/',\n  key: 'api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n  model: 'model.py'\n}\n\ndods.routeSolve(router, configdo);\n```\n\nOr using a configuration under:\n```\n./workspaces/default/config.json\n```\n\nUsing configuration files, you can manage several configurations in the same instance of the service.\nSee documentation below on configuration file format\n\n## Release Notes\n* 1.145 add support for includeAllOutputs for scoring\n* 1.144 minor fixes + checked support for ML models on WML v2 instances\n* 1.143 support for DO models on WML v2 instances\n* 1.140-1.141 better mapping editor\n* 1.139 renaming of dimensions\n* 1.136-1.138 support of PA pre and post process, fix one table grid widget\n* 1.135 support for local OPL and PA dummy value name and value.\n```\n                        \"dummyDimensionName\" : \"MaskOutputDimension\",\n                        \"dummyDimensionValue\" : \"Value\",\n```\n* 1.134 improved callScript to ease debugging\n* 1.133 polishes in PA config panel, and in WML dev panel\n* 1.132 polishes in PA UI\n* 1.131 PA mapping editor\n* 1.130 push assets to WS Cloud\n* 1.129 shared import app/pa\n* 1.128 delete pa + string dimensions\n* 1.126-127 improvements on PA connections, more settings\n* 1.123 dokey and addSolveWidget\n* 1.122 mlkey and score widget\n* 1.118 improved vega widget (container arg and resize)\n* 1.114-1.117 Fixed use of WML from some cloud servers which was crashing.\n* 1.113 edition of tables without id\n* 1.111-1.112 better list of deployed models and deployements for MWL, with DELETE, and manual deployment\n* 1.104-1.110 merge pa and app codes, added pa.js file.\n* 1.103 removed pa output prefix\n* 1.102 improved PA init \n* 1.101 added code to allow initialization of PA from a workspace and scenario\n* 1.98/1.99 ws condif taken form the right workspace, and paameters table Id configurable\n* 1.97 now support new DO for WML deployment to solve optimization, see additional do configurtion below\n* 1.96 all DSX references have been renamed to WS, in APIs, configurations, UI, etc\n* 1.90 for consistency config.mapping should now be in config.pa.mapping\n* 1.89 **new structure for configuration and workspaces** + nicer scenario explorer\n* 1.85 lots of improvements for sensitivity analysis\n* 1.81 improved performance on PA import/export + solve on desktop.\n* 1.78 improve status for import/export PA\n* 1.77 lots of new stuf including **modeling assistant support**\n* 1.64 maintenance\n* 1.59 **workspaces overview**\n* 1.57 json editor\n* 1.56 d3 fixed for v3\n* 1.54 **configurations under config directory and use of workspace URL parameter**  and fixes\n* 1.47 fixes between import progress and grid redraw\n* 1.46 job ids used in dodata saved local files\n* 1.43 **ML support**\n* 1.42 sensitivity chart and run on grid, scnerioa run, dsx on cloud\n* 1.41 scanerio chart select KPI + KPI chart on selected/reference\n* 1.39 id -\u003e allow edition\n* 1.38 import and put model, workspace for model\n* 1.37 small fixes\n* 1.36 config in scenariomgr + autoid **need to pass config in scenariomgr constructor**\n* 1.35 fix diffs\n* 1.34 scenario workspace **need subfolder on data**\n* 1.33 import all scenario, dashboard checkbox, multiple tables widget\n* 1.32 much better import (select models, etc)\n* 1.31 better import\n* 1.30 inputs and outputs, delete scenario, vega lite multiple scenario, kpis update\n* 1.29 dsx timeout\n* 1.28 gridconfig and do config **need app config for optim**\n\n## Functionalities\n\n### Scenario Management\n\n#### back-end\nThese APIs support scenariomanagement on server side.\nScenarios are currently persisted as csv files in the file system (and hence are not appropriate for very large scenarios size).\nMultiple scenarios are supported.\n  \nAPIs include the ability to list all scenarios,, create new ones, delete existing ones. For a given scenario, list all tables, get content for a table, update table content, etc.\n\nIncluded in the dods set of back end functions.\n  \n#### front-end\nThese functions allow to use the back end scenario APIs without writing any REST API code but using scenario manager and scenario Javascript objects and load or save them easily from/to the back-end / front-end.\nFunctions to create some HTML components to manage scenarios are also available.\n\nYou can hence create a scenario selector widget with:\n```\nscenariomgr = new ScenarioManager();        \nscenariomgr.loadScenarios(scenariocfg);\nscenariomgr.showAsSelector(`scenario_div`, onChangeScenario);\n```\n\nThat will look like:\n\n![Scenario selector](/images/scenarios.png)\n\nThe currently selected scenario can be accessed using:\n```\nscenariomgr.getSelectedScenario()\n```\n\nThe scenario configuration allows to select the tables to use, the id columns of the table to use, and customize some visual elements like titles to be used when displaying.\n\nHere is an example of configuration:\n```\nscenariocfg = {        \n        'Canals' : { id:\"id\", title:\"Canals\", allowEdition:true},\n        'Pipes' : { id:\"id\", title:\"Pipes\", allowEdition:true},\n        'Stations' : { id:\"id\", title:\"Stations\", allowEdition:true},\n        'Dams' : { id:\"id\", title:\"Dams\", allowEdition:true},\n        'Tanks' : { id:\"id\", title:\"Tanks\",allowEdition:true},\n        'Wells' : { id:\"id\", title:\"Wells\", allowEdition:true},\n\n        'Nodes' : { id:\"id\", title:\"Nodes\"},\n        'Links' : { title:\"Links\"}, // no id\n\n        \"kpis\" : { cb : showKpis },\n\n        \"$scenario\" : { cb : showInputsAndOutputs }\n};\n```\n\nThis configuration is given to the constructor of the scenario manager.\nIt can be included in the config.json configuration file.\n\n### LoB User Interface\n\nOn the front-end side, many functions are available to easily enable a User Interface for the Line of Business user to interact with the scenarios and optimization and/or machine learning.\n\n#### scenario-grid:\n\nThe scenario grid component allows to create a grid of widget that can be given a layout which can be changed by LoB.\n\nThe code to use is pretty starightforwrad:\n```\n        scenariogrid = new ScenarioGrid('UnitCommitment Demo', 'scenario_grid_div', scenariomgr);\n\n        scenariogrid.addScenarioWidget(onChangeScenario, 0, 0, 2, 2);\n\n        scenariogrid.addKPIsWidget(2, 0, 10, 5);\n```        \n\nWhich will render like:\n![Scenario Grid](/images/grid.png)\n\nMany predefined types of components are available to be used in the grid or without the grid.\n\n#### scenario-google:\n\nThis library of javascript functions allows to easily create HTML google tables or charts on the data of the scenario, using the previous scenario APIs.\nYou can create a multi tab table view of a set of tables using:\n```\nshowAsGoogleTables(scenario, 'inputs_div', 'input',\n                undefined,\n                 scenariocfg)\n```\n\nThat will look like:\n\n![Scenario selector](/images/table.png)\n\nThe google table allows **edition** of rows if the allowEdition option as been set to true in the scenario configuration for the corresponding table.\n\nThat will look like:\n\n![Edition](/images/edit.png)\n\nThe table also support pair wise scenario comparison:\n\n![Comparison](/images/comparison.png)\n\nYou can also create KPI comparison charts which will look like:\n\n![Charts](/images/charts.png)\n\nAnd other types of charts:\n\n![Scenario selector](/images/kpis.png)\n\n#### scenario-d3\n\nThis library allows to easily create d3 charts using the scenario library. d3 is a framework to create interactive charts oin the web, see lots of examples at https://github.com/d3/d3/wiki/Gallery\n\nThat can look like:\n\n![d3charts](/images/d3.png)\n\nOr like:\n\n![d3nvcharts](/images/d3charts.png)\n\n#### scenario-gantt\nThis library allows to easily create gantt charts using the scenario library.\n\nThat will look like:\n\n![Scenario selector](/images/gantt.png)\n\n### Decision Optimization\nThis library of back end and front end functions allow to easily integrate the call to a deployed Decision Optimization in Watson Studio from a node js application.\n  \nIncluded in the dods set of back end functions.\n\n#### DO runtimes supported\nYou can solve using:\n* **Watson Studio Local \u003c= 1.2.3 Model Management and Deployment APIs**: you need to provide the URL and key of the deployed model. You dont need to provide a model as it is deployed.\n```\n    \"do\" : {\n        \"url\" : \"https://9.20.64.100/dsvc/v1/cps/domodel/optim/model/CPS_LM_saved\",\n        \"key\" : \"Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n    }\n```\n* **DO CPLEX CLOUD**: you must provide the URL of DO CPLEX CLOUD, your API key and the model to use: (the model.py file should be in the do directory on the back end side).\n```\n    \"do\" : {  \n        \"url\":  \"https://api-oaas.docloud.ibmcloud.com/job_manager/rest/v1/\",\n        \"key\": \"api_7fe447c0-46eb-4f68-a7e5-196c95be0260\",\n        \"model\": \"model.py\"\n    }\n```\n* **Desktop**: you just provide the name of the model to use (traken from do directory). You need your backend server to have python, docplex and cplex installed correctly:\n```\n    \"do\": {\n        \"model\": \"model.py\",\n        \"type\": \"desktop\"\n    }\n```    \n* **WML**: *coming soon*\n\n#### Solve using scenario\n\nUsing the scenario on the front end allows to use very simple action functions. To solve, use:\n```\nlet scenario = scenariomgr.getSelectedScenario();\nscenario.solve(\n    function (status) {\n        // disply status\n    }, function () { \n        // do something with scenario when finished\n    });\n```\n\n#### Solve without using a scenario\n\nIf you prefer not use the scenario but want to solve a model using a set of csv file, you can still get support from the back end functions doing something like :\n\n```\nfunction solve() {\n        var data = new FormData();\n\n        let scenario = scenariomgr.getSelectedScenario();\n        let tableIds = scenario.getInputTables()\n        for (t in tableIds)  {\n                let tableId = tableIds[t];\n                data.append(tableId+\".csv\", scenario.getTableAsCSV(tableId));\n        }\n        \n        axios({\n                method: 'post',\n                url: './api/optim/solve',\n                data: data\n        }).then(function(response) {\n                jobId = response.data.jobId                        \n                console.log(\"Job ID: \"+ jobId);\n                intervalId = setInterval(checkStatus, 1000)\n        }).catch(showHttpError);\n}\n```\n\nAnd check the status and get solution using:\n```\nfunction checkStatus() {\n        let scenario = scenariomgr.getSelectedScenario();\n        axios.get(\"/api/optim/status?jobId=\"+jobId)\n        .then(function(response) {\n                executionStatus = response.data.solveState.executionStatus\n                console.log(\"JobId: \"+jobId +\" Status: \"+executionStatus)\n                document.getElementById('SOLVE').value = executionStatus;\n                                \n                if (executionStatus == \"PROCESSED\" ||\n                        executionStatus == \"INTERRUPTED\" ) {\n                        clearInterval(intervalId);\n                        \n                        let  nout = response.data.outputAttachments.length;\n                        for (var i = 0; i \u003c nout; i++) {\n                                let oa = response.data.outputAttachments[i];\n                                if ('csv' in oa)\n                                    scenario.addTableFromCSV(tableName, oa.csv, 'output', scenariomgr.config[oa.name]);     \n                                else\n                                    scenario.addTableFromRows(oa.name, oa.table.rows, 'output', scenariocfg[oa.name]);   \n                        }\n\n                        showSolution(scenario);\n                        showKpis(scenario);\n                        enableSolve();\n\n                }   \n        })\n        //.catch(showHttpError);    \n}\n```\n\nThe URL and key for optimization is provided on the back end side. The configuration can be either passed to the routing initialization functions or included in a JSON configuration file.\n\nAre currently supported the execution of a WML deployed optimization model (Local only) and the use of the DO CPLEX CLOUD services.\n\n### Machine Learning\n\nThis library of functions allows you to easily run scoring of a machine learning deployed on Watson machine learning.\n\nThe URL and key for machine learning models is provided on the back end side. The configuration can be either passed to the routing initialization functions or included in a JSON configuration file.\n\nAre currently supported the execution of a WML deployed machin model (Cloud only)\n\n### Watson Studio\nThis library of functions allow to easily connect scenarios to Watson Studio (Local) environment so that ethe data scientist can work on creating the models to be deployed and then integrated.\n\nWith simple functions you can create a project in a existing cluster, and push some tables of a scenario as data assets, so that the Data Scientist will be able to formulate and debug an optimization model.\n\n### Planning Analytics\nThis library of back-end and front-end functions allow to easily connect to Planning Analytics.\nFunctions allow to connect to an existing TM1 serverm using authentication, and list cubes and dimensions.\nFunctions allow to read cubes and dimension into scenarios.\nFunctions allow to write scenarios to cubes and dimensions.\n\nWith these APIs and functions you can easily create a widget to integrate DO into PA, such as:\n\n![DO dev in PA](/images/padev.png)\n\n## Documentation\n\n### REST APIs\n\n### JavaScript classes and methods\n\n### Configuration file format\n\n**Since 1.89 all workspaces specific files are under workspaces folder.**\n\nFor each application (that can be used with workspace=XXX), there is a configuration file under workspaces/XXX/config.json It looks like (this one if the default one when no workspace is given):\n\n```\n{\n    \"name\": \"UCP\",\n    \"scenario\" : {        \n        \"config\" : {\n            \"Units\" : { \"id\":\"Units\", \"title\":\"Units\", \"allowEdition\":true},        \n            \"Loads\" : {  \"id\":\"Periods\", \"title\":\"Load\", \"allowEdition\":true},\n            \"UnitMaintenances\" : {\"id\":null, \"title\":\"Maintenances\", \"allowEdition\":true, \"maxSize\":1680},\n            \"Periods\" : { \"id\":\"Id\", \"title\":\"Periods\"},\n            \"Weights\" : { \"id\":\"Id\", \"title\":\"Weights\", \"allowEdition\":true},\n\n            \"production\" : { \"title\":\"Production\", \"columns\": [\"Units\", \"Periods\", \"value\"] },\n            \"started\" : { \"title\":\"Started\", \"columns\": [\"Units\", \"Periods\", \"value\"]},\n            \"used\" : { \"title\":\"Used\", \"columns\": [\"Units\", \"Periods\", \"value\"]},\n            \"kpis\" : { \"id\":\"kpi\", \"title\":\"KPIs\"}\n        }\n    },\n    \"ws\" : {\n        \"type\" : \"local\",\n        \"apiurl\": \"https://xxxxxx\n        \"url\": \"https://xxxxx\n        \"login\": \"alain.chabrier@ibm.com\",\n        \"password\": \"xxxxxxxxxxxxx\",\n        \"projectName\": \"PA3\"\n      },\n    \"do\" : {  \n        \"url\":  \"https://api-oaas.docloud.ibmcloud.com/job_manager/rest/v1/\",\n        \"key\": \"api_xxxxxxxxxxxxxxxxxxxxxxxxx\",\n        \"model\": \"model.py\"\n    },\n    \"ui\" : {\n        \"title\": \"Unit Commitment\",\n        \"grid\" : \"grid.js\"\n    }\n\n}\n```\n\nThe difference sections:\n* **name** the name of the configuration\n* **scenario**: some configuration on the different tables (input and output) used in the scenarios.\n  * **scenario.config** the configuration for scenarios, one item for each table\n    * **scenario.config.table1.id** the id column of the table\n    * **scenario.config.table1.title** the title to use for the table\n    * **scenario.config.table1.allowEdition** will set the table as editable or not.\n* **ws**: (optional) configuration of connection to some Watson Studio Local instance to import models and data.\n* **do**: configuration of how optimization is executed\n  * **do.type** can be used to indcate solve mode (e.g. \"desktop\" means models are solved on the back end server and not sent to a service.\n  * **do.url** the url of the solve service\n  * **do.key** the key for the solve service\n  * **do.model** the name of the model file (stored under ./dodata/myworkspace/) to be used when solving with a service that has not pre-deployed model.\n  * **do.action.text** the text of the button to be used in the default UIs for thesolve button.\n* **ui**: configuration of some additional UI properties, including the use of a separate JS file which will do some more precise setup of the grid layout.\n  * **ui.title** the title of the grid \n  * **ui.gridjs** a file stored beside configuration to be executed with javascript code for creating the grid, see some examples in the different workspaces of the demo application (https://github.com/IBMDecisionOptimization/do-ws-ucp-demo-app/tree/master/config/ta)\n  * **ui.grid** a json configuration of the grid \n* **pa**: (optional) connection to Planning Analytics\n  * **pa.mapping**: (optional) mapping between PA cubes and dimensions and tables.\n\n\n\nYou can refer to [do-ws-pa documentation](https://github.com/IBMDecisionOptimization/do-ws-pa/blob/master/README.md) for more information on the configuration of PA section.\n\n\n#### WS configuration\n\nThe WS configuration is used to set the connection information for the project and data assets creation in the development environment. You can also choose the name of the project to use. The service will create the project if it does not exist. \n\nThis part is only working for WS local only at this point.\n\nIt can be something like:\n\n```\n\t\"ws\": {\n\t\t\"url\": \"https://9.20.64.100\",\n\t\t\"login\": \"alain.chabrier@ibm.com\",\n\t\t\"password\": \"Hot6cold\",\n\t\t\"projectName\": \"PA3\"\n\t},\n```\n\n#### DO configuration\n\nThe DO configuration is used to connect to a DO deployed model to be used to solve the problem from Planning Analytics.\n\nCurrently supported type of configurations are:\n\n\n\n##### DO for WML\n\nThe execution will occur on new Do for WML instance.\nYou can either provide a pre-deployed `deployment_id`, or provide a model which will be deloyed.\n\n\nProviding the `deployment_id`, it will be directly used.\n```\n \"do\": {\n        \"type\": \"wml\",\n        \"apikey\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n        \"instance_id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n        \"url\": \"https://us-south.ml.cloud.ibm.com\",\n        \"action\": {\n            \"text\": \"PLAN\"\n        },\n        \"deployment_id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n    },\n``` \n\nOtherwise, you can provide  the `model` which  will get deployed and startup and then used.\n```\n \"do\": {\n        \"type\": \"wml\",\n        \"apikey\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n        \"instance_id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n        \"url\": \"https://us-south.ml.cloud.ibm.com\",\n        \"model\": \"model.py\"        \n    },\n```\n\n\n##### Desktop\n\nThe CPLEX engines must be installed oin the machine where the service is running\n\n```\n\t\"do\": {\n  \"type\" : \"desktop\",\n\t\t\"model\" : \"model.py\"\n\t},\n```\n \n##### WS Local MMD deployed model\n\n```\n\t\"do\": {\n\t\t\"url\": \"https://9.20.64.100/dsvc/v1/ucp/domodel/optim/model/UCPsaved\",\t\t\n\t\t\"key\": \"Bearer ________________mybearer_____________\"\n\t},\n ```\n \n##### DO CPLEX CLOUD\n\nThe model used should be inclued in the dodata directory.\n\n```\n\t\"do\": {\n\t\t\"model\" : \"model.py\",\n\t\t\"url\": \"https://api-oaas.docloud.ibmcloud.com/job_manager/rest/v1/\",\t\t\n\t\t\"key\": \"api____________________________________\"\n\t},\n```\n\n#### ML configuration\n\nThe ML configuration is used to connect to a ML deployed model to be used to score  from Planning Analytics.\n\nCurrently supported type of configurations are:\n\n#### WML Cloud\n\n```\n\t\"ml\": {\n\t\t\"url\": \"https://us-south.ml.cloud.ibm.com/v3/wml_instances/8a69e5fe-b112-4b92-adfd-0dbce326332b/deployments/25b7a943-3578-4e88-a308-432718177678/online\",\n\t\t\"apikey\": \"_____________________________\",\n\t\t\"input\": \"Diabetes\",\n\t\t\"output\": \"DiabetesOutcome\"\n\t},\n```\n\n#### PA configuration\n\nYour Planning Analytics configuration can point either to a Local or Cloud setup.\n\nThe most complex part is to configure the TM1 authentication credentials.\nSee the page (https://www.ibm.com/support/knowledgecenter/en/SS9RXT_10.2.2/com.ibm.swg.ba.cognos.tm1_rest_api.10.2.2.doc/dg_tm1_odata_auth.html) for information on TM1 \n\n**Local configuration with a login URL**\n```\n\t\"pa\": {\t\n\t\t\"description\": \"PA Local on ibmdemos\",\n\t\t\"loginurl\": \"http://ibmdemos/login\",\n\t\t\"url\": \"http://ibmdemos/tm1/Decision%20Optimisation\",\n\t\t\"username\": \"pm\",\n\t\t\"password\": \"IBMDem0s\",\n\t\t\"mapping\" : {\n\t\t\t...\n\t\t}\n\t}\n```\n\n* `Decision Optimization` is the TM1 server name\n* Ask your PA administrator for the authorized `username` and `password`.\n\n**Local configuration with a CAMNameSpace**\n```\n\t\"palocal\": {\t\n\t\t\"description\": \"PA Local on ibmdemos\",\n\t\t\"url\": \"http://ibmdemos:54045\",\n\t\t\"username\": \"pm\",\n\t\t\"password\": \"IBMDem0s\",\n\t\t\"camnamespace\": \"Harmony LDAP\",\n\t\t\"mapping\" : {\n\t\t\t...\n\t\t}\n\t}\n```\n\n* `\"Harmony LDAP` is the camnamespace\n* Ask your PA administrator for the authorized `username` and `password`.\n\n**Cloud configuration**\n\n```\n\t\"pa\": {\n\t\t\"authurl\" : \"https://ibmtraining.planning-analytics.ibmcloud.com/oauth2/token\",\n\t\t\"url\" : \"https://ibmtraining.planning-analytics.ibmcloud.com/api/v0/tm1/Decision%20Optimisation\",\n\t\t\"accountId\": \"xxxxxxxxxxxx\",\n        \t\"tenantId\": \"xxxxxxxxxxxx\",\n        \t\"userId\": \"xxxxxxxxxxxx\",\n        \t\"username\": \"xxxxxxxxxxxx\",\n\t\t\"password\": \"xxxxxxxxxxxx\",\n\t\t\"mapping\" : {\n\t\t\t...\n\t\t}\n\t}\n```\n* `Decision Optimization` is the TM1 server name\n* Ask your PA administrator for the cerdentals `accountId`, `tenantId`, `userId`, `username` and `password`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibmdecisionoptimization%2Fdo-ws-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibmdecisionoptimization%2Fdo-ws-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibmdecisionoptimization%2Fdo-ws-js/lists"}