|
| 1 | +# Cookbook |
| 2 | + This is how a cookbook is stored in the data base it looks like this: |
| 3 | + ``` |
| 4 | +{ |
| 5 | + "hash": "hash", |
| 6 | + "name": "name", |
| 7 | + "assetNames": ['machine names'], |
| 8 | + "key_constraint":{ |
| 9 | + 'field': { |
| 10 | + 'fieldName': 'stats__Cylinders__val', |
| 11 | + 'machineId': 'e2df2b4f115b763f45d04fa2', |
| 12 | + 'machineName': 'JB_HM_Diecast_1', |
| 13 | + 'machineDisplayName': 'Hamilton - Diecast 1', |
| 14 | + 'fieldType': 'categorical', |
| 15 | + 'machineType': 'Diecast', |
| 16 | + 'fieldDisplayName': 'Cylinders', |
| 17 | + 'fieldUnit': '' |
| 18 | + }, |
| 19 | + 'valueMap': {'4': 1, '6': 0} |
| 20 | + } |
| 21 | + "recipe_groups": [ |
| 22 | + recipe_groups |
| 23 | + ] |
| 24 | + "metadata":{'created_by': {'id': '5a1c9f9798214579dacc917a', 'email': 'ahome@sightmachine.com', 'metadata': {'first_name': 'Andrew', 'last_name': 'Home', 'tenant': 'demo'}}}, |
| 25 | + "updatetime": '2023-03-16 17:48:55.355000', |
| 26 | + "assets": [], |
| 27 | + "id": '63ab6b263fa4880c06334b03' |
| 28 | +
|
| 29 | +} |
| 30 | + ``` |
| 31 | + |
| 32 | + ## Hash |
| 33 | + A hash of the cookbook object. |
| 34 | + |
| 35 | + ## name |
| 36 | + The name of the cookbook. |
| 37 | + |
| 38 | + ## assetNames |
| 39 | + A list of names of assets used in this cookbook these are often just machine_names. |
| 40 | + |
| 41 | + ## key_constraint |
| 42 | + The field that specifies the product. This also how the system knows which recipe_group to use. |
| 43 | + |
| 44 | + ### field |
| 45 | + This is detailed information on the field being used as the Key Constraint for more info see [levers](#levers). |
| 46 | + |
| 47 | + ### valueMap |
| 48 | + This how the system maps the values of the key constraint on to recipe groups. Value for each key is the index of the recipe group to use. |
| 49 | + |
| 50 | + ## recipe_groups |
| 51 | + A list of recipe groups. They look like the following: |
| 52 | + ``` |
| 53 | + { |
| 54 | + "id": "id" |
| 55 | + "values": [1], |
| 56 | + "runBoundaries": [], |
| 57 | + "maxDuration": {'isEnabled': False, 'minimum': 0, 'unit': 'second'}, |
| 58 | + "topRun": 10, |
| 59 | + "constraints": [], |
| 60 | + "levers": [{'fieldName': 'stats__AluminumTempAvg__val', 'machineId': 'e2df2b4f115b763f45d04fa2', 'machineName': 'JB_HM_Diecast_1', 'machineDisplayName': 'Hamilton - Diecast 1', 'fieldType': 'continuous', 'machineType': 'Diecast', 'fieldDisplayName': 'AluminumTemp - Average', 'fieldUnit': 'celsius'},...], |
| 61 | + "outcomes": [{'field': {'fieldName': 'quality', 'machineId': 'e2df2b4f115b763f45d04fa2', 'machineName': 'JB_HM_Diecast_1', 'machineDisplayName': 'Hamilton - Diecast 1', 'fieldType': 'kpi', 'machineType': 'Diecast', 'fieldDisplayName': 'Quality'}, 'weight': 1, 'optimization_func': 'maximize'}, ...] |
| 62 | + "filters": {'duration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'}, 'recordFilters': []}, |
| 63 | + "dateRange": {'value': {'relativeAmount': 7, 'relativeUnit': 'day'}, 'config': {'mode': 'relative', 'selectableRelativeUnits': ['minute', 'hour', 'day', 'week', 'month', 'year'], 'enableTimeTypeSelection': True, 'showQuarterShortcuts': True}} |
| 64 | + "computeDeployedDateRange": None, |
| 65 | + "statsCalculationSetting": "default", |
| 66 | + "deployed":{recipe_group - deployed field} |
| 67 | + } |
| 68 | + ``` |
| 69 | + |
| 70 | + ### id |
| 71 | + The id of the recipe group. |
| 72 | + |
| 73 | + ### values |
| 74 | + List of values that currently in the goup. |
| 75 | + |
| 76 | + ### runBoundaries |
| 77 | + List of boundaries on runs. |
| 78 | + |
| 79 | + ### maxDuration |
| 80 | + This field is ignored by the system currently |
| 81 | + |
| 82 | + ### topRun |
| 83 | + The number of top runs to consider when computing lever statistics. |
| 84 | + |
| 85 | + ### constraints |
| 86 | + List of fields and values that are used to breakup runs they look like the following: |
| 87 | + ``` |
| 88 | +{ |
| 89 | + "asset": "F1_010_BodyMaker_4", |
| 90 | + "name": "stats__BM 001: Cans Out__val", |
| 91 | + "type": "continuous", |
| 92 | + "values": [ |
| 93 | + { |
| 94 | + "from": null, |
| 95 | + "from_is_inclusive": false, |
| 96 | + "to": 340, |
| 97 | + "to_is_inclusive": false |
| 98 | + }, |
| 99 | + { |
| 100 | + "from": 340, |
| 101 | + "from_is_inclusive": true, |
| 102 | + "to": 6000, |
| 103 | + "to_is_inclusive": true |
| 104 | + }, |
| 105 | + { |
| 106 | + "from": 6000, |
| 107 | + "from_is_inclusive": false, |
| 108 | + "to": null, |
| 109 | + "to_is_inclusive": false |
| 110 | + } |
| 111 | + ] |
| 112 | +} |
| 113 | + ``` |
| 114 | + #### assets |
| 115 | + The name of the asset the field used in the constraint. |
| 116 | + |
| 117 | + #### name |
| 118 | + The name of the field used for the constraint. |
| 119 | + |
| 120 | + #### type |
| 121 | + The data type of the constraint, most commonly continuous or categorical. |
| 122 | + |
| 123 | + #### values |
| 124 | + These are the values to break up runs into. |
| 125 | + |
| 126 | + ### levers |
| 127 | + List of fields that go into recipe runs. Looks like the following: |
| 128 | + ``` |
| 129 | + { |
| 130 | + 'fieldName': 'stats__AluminumTempAvg__val', |
| 131 | + 'machineId': 'e2df2b4f115b763f45d04fa2', |
| 132 | + 'machineName': 'JB_HM_Diecast_1', |
| 133 | + 'machineDisplayName': 'Hamilton - Diecast 1', |
| 134 | + 'fieldType': 'continuous', |
| 135 | + 'machineType': 'Diecast', |
| 136 | + 'fieldDisplayName': 'AluminumTemp - Average', |
| 137 | + 'fieldUnit': 'celsius' |
| 138 | +} |
| 139 | + ``` |
| 140 | + |
| 141 | +#### fieldName |
| 142 | +The name of field being looking. |
| 143 | + |
| 144 | +#### machineId |
| 145 | +The id of the machine this field belongs to. |
| 146 | + |
| 147 | +#### machineName |
| 148 | +The name of the machine this field belongs to. |
| 149 | + |
| 150 | +#### machineDisplayName |
| 151 | +The display name of the machine this field belongs to. |
| 152 | + |
| 153 | +#### fieldType |
| 154 | +What the type of the field is, commonly KPI, Continous or Categorical. |
| 155 | + |
| 156 | +#### machineType |
| 157 | +The machineType of the machine this field bleongs to. |
| 158 | + |
| 159 | +#### fieldDisplayName |
| 160 | +The display name of the field. |
| 161 | + |
| 162 | +#### fieldUnit |
| 163 | +The unit of the field. |
| 164 | + |
| 165 | +### outcomes |
| 166 | +A list of outcomes we are trying to optimize with this recipe_group: |
| 167 | +``` |
| 168 | +{ |
| 169 | + 'field': |
| 170 | + { |
| 171 | + 'fieldName': 'quality', |
| 172 | + 'machineId': 'e2df2b4f115b763f45d04fa2', |
| 173 | + 'machineName': 'JB_HM_Diecast_1', |
| 174 | + 'machineDisplayName': 'Hamilton - Diecast 1', |
| 175 | + 'fieldType': 'kpi', |
| 176 | + 'machineType': 'Diecast', |
| 177 | + 'fieldDisplayName': 'Quality' |
| 178 | + }, |
| 179 | + 'weight': 1, |
| 180 | + 'optimization_func': 'maximize' |
| 181 | +} |
| 182 | +``` |
| 183 | +Here is more detail about each key: |
| 184 | + |
| 185 | +#### field |
| 186 | +The field you are trying to optimize with this outcome. This is the same set up as [levers](#levers). |
| 187 | + |
| 188 | +#### wieght |
| 189 | +The wieght you are putting on this outcome as compared to the others. |
| 190 | + |
| 191 | +#### optimization_func |
| 192 | +How you wish to optimize this field usually 'maximize' or 'minimize'. |
| 193 | + |
| 194 | +### filters |
| 195 | +Object containing a duration filter and list of record filters. It looks like the following: |
| 196 | +``` |
| 197 | +{'duration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'}, 'recordFilters': []} |
| 198 | +``` |
| 199 | + |
| 200 | +#### duration |
| 201 | +This is the minimum run duration. |
| 202 | + |
| 203 | +##### isEnabled |
| 204 | +Whieter or not minimum run duration is enabled. |
| 205 | + |
| 206 | +##### minimum |
| 207 | +The amount of time of what ever unit the minimum run duration is. |
| 208 | + |
| 209 | +##### unit |
| 210 | +The unit of time the minimum run duration uses. |
| 211 | + |
| 212 | +#### recordFilters |
| 213 | +List of record based filters. They look like the following: |
| 214 | +``` |
| 215 | +{ |
| 216 | + asset: "F1_010_BodyMaker_4" |
| 217 | + name: "stats__0_BM: CPM__val" |
| 218 | + op: "gt" |
| 219 | + value: 1 |
| 220 | +} |
| 221 | +``` |
| 222 | + |
| 223 | +##### asset |
| 224 | +Name of the asset the field is on, usually a machine_name. |
| 225 | + |
| 226 | +##### name |
| 227 | +Name of the field. |
| 228 | + |
| 229 | +##### op |
| 230 | +The type of operation used to criteria match this filter. |
| 231 | + |
| 232 | +##### value |
| 233 | +The value of used for the criteria matching operation. |
| 234 | + |
| 235 | +### dateRange |
| 236 | +The date range that runs can look at. Looks like this: |
| 237 | +``` |
| 238 | +{ |
| 239 | + 'value': { |
| 240 | + 'relativeAmount': 7, |
| 241 | + 'relativeUnit': 'day' |
| 242 | + }, |
| 243 | + 'config': { |
| 244 | + ... |
| 245 | + } |
| 246 | +} |
| 247 | +``` |
| 248 | + |
| 249 | +#### value |
| 250 | +The value of the dateRange. For relative config we have two keys, relativeAmount and relativeUnit. This very similiar to [Data Viz time Selection](/docs/commonly_used_data_types/data_viz_query.md#time_selection). |
| 251 | + |
| 252 | +##### relativeAmount |
| 253 | +The amount of the relative range. |
| 254 | + |
| 255 | +##### relativeUnit |
| 256 | +The unit of the amount of the relative range. |
| 257 | + |
| 258 | +#### config |
| 259 | +This is used by the frontend UI and can be safely ignored for our purposes. |
| 260 | + |
| 261 | +### statsCalculationSetting |
| 262 | +A legacy setting currently unused. |
| 263 | + |
| 264 | +### deployed |
| 265 | +The deployed version of this recipe_group. It's a [recipe_group](#recipe_groups) minus this field. |
| 266 | + |
| 267 | +## metadata |
| 268 | +This is created by info, it includes the id of the user that created the cookbook along with their name and email. |
| 269 | + |
| 270 | +## updatetime |
| 271 | +The time the cookbook was last updated. |
| 272 | + |
| 273 | +## assets |
| 274 | +A list of assets used in the cookbook. |
| 275 | + |
| 276 | +## id |
| 277 | +The id of the cookbook |
0 commit comments