Oms API GET Run Output Table csv calculated expressions Ids - openmpp/openmpp.github.io GitHub Wiki

Calculate and read output table expression(s) values from model run as csv file.

Read output table expressions, calculate additional measure for each expression and get it as response stream UTF-8 outputTable.csv file attachment, optionally starts with byte order mark (BOM).

Measures calculated as one of the following:

  • for each table expression calculate one of: avg, sum, count, max, min, var, sd, se, cv
  • as arbitrary aggreagated expressions provided as comma separated list

Dimension(s) returned as enum id's.

Methods:

GET /api/model/:model/run/:run/table/:name/calc/:calc/csv-id
GET /api/model/:model/run/:run/table/:name/calc/:calc/csv-id-bom

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.

:run - (required) model run digest, run stamp or run name

Model run can be identified by run digest, run stamp or run name. It is recommended to use digest because it is uniquely identifies model run. Run stamp, if not explicitly specified as model run option, automatically generated as timestamp string, ex.: 2016_08_17_21_07_55_123. It is also possible to use name, which is more human readable than digest, but if there are multiple runs with same name in database than result is undefined.

:name - (required) output table name
:calc - (required) name of additional measure to calculate

Additional measure must be one of:

  • avg mean of expression sub-values
  • sum sum of expression sub-values
  • count count of expression sub-values (excluding NULL's)
  • max maximum of expression sub-values
  • min minimum of expression sub-values
  • var variance of expression sub-values
  • sd standard deviation of expression sub-values
  • se standard error of expression sub-values
  • cv coefficient of variation of expression sub-values

Or a list of comma-separated aggreagated expressions, for example: OM_AVG(acc0) , 2 * SQRT(OM_SUM(acc1) - OM_SD(acc0))

It is also possible to use parameter(s) in calculation, parameter must be a scalar of float or integer type. For example: OM_COUNT_IF(acc1 > param.High), where param.High is a value of scalar parameter High in that model run.

Following aggregation functions avaliable:

  • OM_AVG mean of accumulators sub-values
  • OM_SUM sum of accumulators sub-values
  • OM_COUNT count of accumulators sub-values (excluding NULL's)
  • OM_COUNT_IF count values matching condition
  • OM_MAX maximum of accumulators sub-values
  • OM_MIN minimum of accumulators sub-values
  • OM_VAR variance of accumulators sub-values
  • OM_SD standard deviation of accumulators sub-values
  • OM_SE standard error of accumulators sub-values
  • OM_CV coefficient of variation of accumulators sub-values

For more details please see: Model Output Expressions

Call examples:

http://localhost:4040/api/model/RiskPaths/run/RiskPaths_Default/table/T04_FertilityRatesByAgeGroup/calc/avg/csv-id
http://localhost:4040/api/model/RiskPaths/run/RiskPaths_Default/table/T04_FertilityRatesByAgeGroup/calc/sd/csv-id-bom
http://localhost:4040/api/model/_201208171604590148_/run/f172e98da17beb058f30f11768053456/table/salarySex/calc/se/csv-id
http://localhost:4040/api/model/_201208171604590148_/run/2019_01_17_19_59_52_998/table/salarySex/calc/cv/csv-id-bom

http://localhost:4040/api/model/modelOne/run/Default-4/table/salarySex/calc/OM_AVG(acc0),2*SQRT(OM_SUM(acc1)-OM_SD(acc0))/csv-id
http://localhost:4040/api/model/modelOne/run/Default-4/table/salarySex/calc/OM_COUNT_IF(acc0%3Cparam.StartingSeed)/csv-id

Note: OM_COUNT_IF(acc0%3Cparam.StartingSeed) is URL encoded: OM_COUNT_IF(acc0<param.StartingSeed)

Return example:

calc_id column contains output table expression id's: 0 <= expr_id < 12000 or id's of calculated values: expr_id + 12000. For example, id of calculated value SE(Expr2) is: calc_id = 12002

curl http://localhost:4040/api/model/RiskPaths/run/RiskPaths_Default_4/table/T04_FertilityRatesByAgeGroup/calc/avg/csv-id
run_id,calc_id,Dim0,Dim1,calc_value
102,0,0,0,0
102,0,0,1,null
102,0,0,2,null
102,0,0,3,null
102,0,0,4,null
102,0,0,5,null
102,0,1,0,0.0183139978773642
102,0,1,1,0.315246747433367
102,0,1,2,null
102,0,1,3,0
102,0,1,4,0
102,0,1,5,null
102,0,2,0,0.0537541294539804
102,0,2,1,0.713129647941936
102,0,2,2,0.27913884088947
102,0,2,3,0.0340306112997705
102,0,2,4,0.631356771396228
102,0,2,5,null
102,0,3,0,0.0544540553970037
102,0,3,1,0.814226115392992
102,0,3,2,0.225999767108206
102,0,3,3,0.0225289422479095
102,0,3,4,0.552801004995511
102,0,3,5,0
102,0,4,0,0.0539099306643693
102,0,4,1,0.809582230266138
102,0,4,2,0.195155708061047
102,0,4,3,0.0414901238939861
102,0,4,4,0.59945794749404
102,0,4,5,0
102,0,5,0,0.0415985067709889
102,0,5,1,0.602459144412015
102,0,5,2,0.187080449150788
102,0,5,3,0.0203496069483281
102,0,5,4,1.00906724659711
102,0,5,5,0
102,0,6,0,0.0314673689946165
102,0,6,1,0.462198924442823
102,0,6,2,0.137851629822403
102,0,6,3,0.0229824909841167
102,0,6,4,0.362222813716797
102,0,6,5,0.0572026776260319
102,0,7,0,0.0416497396600501
102,0,7,1,0.549536875782365
102,0,7,2,0.110088801281195
102,0,7,3,0.0468326974687102
102,0,7,4,0.330292197388013
102,0,7,5,0
102,0,8,0,0.0221476827597504
102,0,8,1,0.240119203514267
102,0,8,2,0.0732205051114689
102,0,8,3,0
102,0,8,4,0.391609286784764
102,0,8,5,0
102,0,9,0,0.0118488890311401
102,0,9,1,0.131862730376457
102,0,9,2,0.0830998727570066
102,0,9,3,0.0221047417383149
102,0,9,4,0.279863987999404
102,0,9,5,0.114442750608107
102,0,10,0,0.017525081049452
102,0,10,1,0.157747779554811
102,0,10,2,0.0572711925357155
102,0,10,3,0
102,0,10,4,0.169455199059931
102,0,10,5,0
102,0,11,0,0
102,0,11,1,0
102,0,11,2,0
102,0,11,3,0
102,0,11,4,0
102,0,11,5,0
102,12000,0,0,0
102,12000,0,1,null
102,12000,0,2,null
102,12000,0,3,null
102,12000,0,4,null
102,12000,0,5,null
102,12000,1,0,0.0183150153186944
102,12000,1,1,0.316271343152912
102,12000,1,2,null
102,12000,1,3,0
102,12000,1,4,0
102,12000,1,5,null
102,12000,2,0,0.0537675746731247
102,12000,2,1,0.713529542211133
102,12000,2,2,0.290605057165821
102,12000,2,3,0.0257953477423063
102,12000,2,4,0.971013422710935
102,12000,2,5,null
102,12000,3,0,0.054451507853128
102,12000,3,1,0.815769510398502
102,12000,3,2,0.229287238004696
102,12000,3,3,0.0127116167313564
102,12000,3,4,0.429415814994704
102,12000,3,5,0
102,12000,4,0,0.0541040962861145
102,12000,4,1,0.80980843837352
102,12000,4,2,0.195232130104512
102,12000,4,3,0.0425462458785113
102,12000,4,4,0.831967409785808
102,12000,4,5,0
102,12000,5,0,0.0417067099443355
102,12000,5,1,0.602467976857289
102,12000,5,2,0.186968206655534
102,12000,5,3,0.0315133813846249
102,12000,5,4,1.28700220240812
102,12000,5,5,0
102,12000,6,0,0.0314820070793188
102,12000,6,1,0.462127063133201
102,12000,6,2,0.137897098019438
102,12000,6,3,0.0295557293946093
102,12000,6,4,0.268318808255325
102,12000,6,5,0.0267057657548253
102,12000,7,0,0.0416625733706113
102,12000,7,1,0.567544621403048
102,12000,7,2,0.111089012753633
102,12000,7,3,0.0452064833182238
102,12000,7,4,0.463879691400302
102,12000,7,5,0
102,12000,8,0,0.022442211806591
102,12000,8,1,0.26518578732689
102,12000,8,2,0.0759259959848827
102,12000,8,3,0
102,12000,8,4,0.557998028374596
102,12000,8,5,0
102,12000,9,0,0.0110885846008521
102,12000,9,1,0.13577342261578
102,12000,9,2,0.0815471990733788
102,12000,9,3,0.0123398583333944
102,12000,9,4,0.235867044941869
102,12000,9,5,0.0534359868184371
102,12000,10,0,0.0172608633104785
102,12000,10,1,0.165574819914602
102,12000,10,2,0.0569355432493007
102,12000,10,3,0
102,12000,10,4,0.165135000822642
102,12000,10,5,0
102,12000,11,0,0
102,12000,11,1,0
102,12000,11,2,0
102,12000,11,3,0
102,12000,11,4,0
102,12000,11,5,0
⚠️ **GitHub.com Fallback** ⚠️