Oms API POST upload workset initiate - openmpp/openmpp.github.io GitHub Wiki
POST model workset upload request: upload workset zip file on server and start copy it into database.
This method only avaliable if server configured to create uploads for user.
This is a beta version and may change in the future.
Workset is a set of model input parameters (a.k.a. "scenario" input). Workset can be used to run the model.
As result of workset upload oms
service does:
- upload archive, for example:
RiskPaths.set.New-Data.zip
- extract workset
.csv
files with parameters intoRiskPaths.set.New-Data
folder - extract workset
.json
metadata file - create new or update existing New-Data workset in RiskPaths model database
Workset .zip
archive does not have to conatin workset .json
metadata file, it can include only .csv
files with parameter values.
If workset .zip
created by dbcopy
utility or as result of UI download then it always contain workset .json
metadata file, for example:
{
"ModelName": "RiskPaths",
"ModelDigest":"d90e1e9a49a06d972ecf1d50e684c62b",
"Name": "New-Data",
"IsReadonly": false,
"Txt": [{
"LangCode": "EN",
"Descr": "Model modified set of input parameters",
"Note": ""
}, {
"LangCode": "FR",
"Descr": "Modèle modifié ensemble de paramètres d'entrée",
"Note": "Remarques sur l'ensemble d'entrées modifiées par le modèle"
}
],
"Param": [{
"Name": "AgeBySex",
"SubCount": 1,
"Txt": [{
"LangCode": "EN",
"Note": "Age by Sex modified values"
}
]
}
]
}
Method:
POST /api/upload/model/:model/workset
POST /api/upload/model/:model/workset/:set
Arguments:
:model - (required) model digest or model name
Model can be identified by digest or by model name. It is recommended to use digest because it is uniquely identifies model. It is possible to use model name, which is more human readable than digest, but if there are multiple models with same name in database than result is undefined.
:set - (optional) workset name
Workset is uniquely identified by name (inside the model).
Different models can have worksets with same name, i.e. each model can have workset with name "Default".
This argument is and can ommited if workset .zip
archive contain .json
file with workset metadata, which must include name.
Multi-part form body
Posted multi-part form consists of two parts:
- (optional) "workset-upload-options" part with JSON upload options;
- (required) workset.zip file.
JSON upload options are:
{
"NoDigestCheck": true
}
If NoDigestCheck
is true
then method calls dbcopy
with -dbcopy.NoDigetCheck
option.
By default dbcopy
imports workset only if ModelDigest
from source json
metadata identical to destination model digest.
If you are using NoDigestCheck
then dbcopy
do ignore source digest and rely on model name only.
Call examples:
curl -v -X POST -F "[email protected]" http://localhost:4040/api/upload/model/modelOne/workset/New
curl -v -X POST -F "[email protected]" http://localhost:4040/api/upload/model/modelOne/workset
curl -v -X POST -F "[email protected]" -F "[email protected]" http://localhost:4040/api/upload/model/zz_201208171604590148_/workset