|
| 1 | +let Version = std.contract.from_predicate (std.string.is_match "^\\d+\\.\\d+$") |
| 2 | + |
| 3 | +in |
| 4 | + |
| 5 | +let Nullable = fun Contract => |
| 6 | + std.contract.custom |
| 7 | + (fun value => |
| 8 | + if value == null then |
| 9 | + 'Ok value |
| 10 | + else |
| 11 | + std.contract.check Contract value |
| 12 | + ) |
| 13 | + |
| 14 | +in |
| 15 | + |
| 16 | +let Cell = std.contract.from_predicate (std.string.is_match "^[A-Z]\\d+$") |
| 17 | + |
| 18 | +in |
| 19 | + |
| 20 | +let Range = std.contract.from_predicate (std.string.is_match "^[A-Z]\\d+:[A-Z]\\d+$") |
| 21 | + |
| 22 | +# in |
| 23 | +# |
| 24 | +# let Range = std.contract.from_predicate (std.string.split ":") |
| 25 | + |
| 26 | +in |
| 27 | + |
| 28 | +let Variable = { |
| 29 | + cell | Cell, |
| 30 | + name | String |
| 31 | +} |
| 32 | + |
| 33 | +in |
| 34 | + |
| 35 | +let Translation = { |
| 36 | + long | String, |
| 37 | + short | String |
| 38 | +} |
| 39 | + |
| 40 | +in |
| 41 | + |
| 42 | +let Atom = std.contract.from_predicate (fun value => |
| 43 | + std.array.elem value [ "character", "date", "numeric" ] |
| 44 | +) |
| 45 | + |
| 46 | +in |
| 47 | + |
| 48 | +let Location = { |
| 49 | + sheet | String, |
| 50 | + varname | String, |
| 51 | + type | std.enum.TagOrString |
| 52 | + | [| 'cells, 'keyvalue, 'table, 'platedata |], |
| 53 | + translate | Bool |
| 54 | + | optional |
| 55 | + | default |
| 56 | + = false, |
| 57 | + variables | Array Variable |
| 58 | + | optional, |
| 59 | + atomicclass | Array Atom |
| 60 | + | optional, |
| 61 | + ranges | Array Range |
| 62 | + | optional |
| 63 | +} |
| 64 | + |
| 65 | +in |
| 66 | + |
| 67 | +let Schema = { |
| 68 | + guide.version | Version, |
| 69 | + locations | Array Location, |
| 70 | + plate.format | Number, |
| 71 | + template.max.version | Nullable (Version), |
| 72 | + template.min.version | Version, |
| 73 | + template.name | String, |
| 74 | + translations | Array Translation |
| 75 | +} |
| 76 | + |
| 77 | +in |
| 78 | + |
| 79 | +{ |
| 80 | + guide.version = "1.0", |
| 81 | + template.max.version = null, |
| 82 | + template.min.version = "9.3", |
| 83 | + template.name = "competition", |
| 84 | + plate.format = 96, |
| 85 | + locations = [ |
| 86 | + { |
| 87 | + sheet = "description", |
| 88 | + translate = false, |
| 89 | + type = "cells", |
| 90 | + variables = [ |
| 91 | + { |
| 92 | + cell = "B2", |
| 93 | + name = "version" |
| 94 | + } |
| 95 | + ], |
| 96 | + varname = ".template" |
| 97 | + }, |
| 98 | + { |
| 99 | + atomicclass = [ |
| 100 | + "character", |
| 101 | + "character", |
| 102 | + "character", |
| 103 | + "character", |
| 104 | + "character", |
| 105 | + "date", |
| 106 | + "character", |
| 107 | + "numeric", |
| 108 | + "character", |
| 109 | + "numeric", |
| 110 | + "character", |
| 111 | + "numeric", |
| 112 | + "character", |
| 113 | + "character" |
| 114 | + ], |
| 115 | + ranges = [ |
| 116 | + "A10:B21", |
| 117 | + "A24:B25" |
| 118 | + ], |
| 119 | + sheet = "description", |
| 120 | + translate = true, |
| 121 | + type = "keyvalue", |
| 122 | + varname = "metadata" |
| 123 | + }, |
| 124 | + { |
| 125 | + atomicclass = [ |
| 126 | + "character", |
| 127 | + "numeric", |
| 128 | + "numeric", |
| 129 | + "numeric", |
| 130 | + "numeric", |
| 131 | + "numeric", |
| 132 | + "numeric", |
| 133 | + "character", |
| 134 | + "character", |
| 135 | + "character" |
| 136 | + ], |
| 137 | + ranges = [ |
| 138 | + "A1:M9", |
| 139 | + "A11:M19", |
| 140 | + "A21:M29", |
| 141 | + "A31:M39", |
| 142 | + "A41:M49", |
| 143 | + "A51:M59", |
| 144 | + "A61:M69", |
| 145 | + "A71:M79", |
| 146 | + "A81:M89", |
| 147 | + "A91:M99" |
| 148 | + ], |
| 149 | + sheet = "_data", |
| 150 | + translate = false, |
| 151 | + type = "platedata", |
| 152 | + varname = "plate" |
| 153 | + }, |
| 154 | + { |
| 155 | + ranges = [ |
| 156 | + "A101:B111" |
| 157 | + ], |
| 158 | + sheet = "_data", |
| 159 | + translate = false, |
| 160 | + type = "table", |
| 161 | + varname = "rejections" |
| 162 | + }, |
| 163 | + { |
| 164 | + atomicclass = [ |
| 165 | + "numeric" |
| 166 | + ], |
| 167 | + ranges = [ |
| 168 | + "A24:B24", |
| 169 | + "A27:B28", |
| 170 | + "A31:B32", |
| 171 | + "A35:B36" |
| 172 | + ], |
| 173 | + sheet = "_parameters", |
| 174 | + translate = false, |
| 175 | + type = "keyvalue", |
| 176 | + varname = "parameters" |
| 177 | + }, |
| 178 | + { |
| 179 | + ranges = [ |
| 180 | + "A39:B39" |
| 181 | + ], |
| 182 | + sheet = "_parameters", |
| 183 | + translate = false, |
| 184 | + type = "keyvalue", |
| 185 | + varname = "parameters" |
| 186 | + }, |
| 187 | + { |
| 188 | + atomicclass = [ |
| 189 | + "numeric" |
| 190 | + ], |
| 191 | + ranges = [ |
| 192 | + "J3:M5" |
| 193 | + ], |
| 194 | + sheet = "concentration response", |
| 195 | + translate = false, |
| 196 | + type = "table", |
| 197 | + varname = "userresults" |
| 198 | + }, |
| 199 | + { |
| 200 | + atomicclass = [ |
| 201 | + "numeric" |
| 202 | + ], |
| 203 | + sheet = "BGfluo", |
| 204 | + translate = false, |
| 205 | + type = "cells", |
| 206 | + variables = [ |
| 207 | + { |
| 208 | + cell = "G6", |
| 209 | + name = "spread.itm1" |
| 210 | + }, |
| 211 | + { |
| 212 | + cell = "G33", |
| 213 | + name = "spread.itm2" |
| 214 | + } |
| 215 | + ], |
| 216 | + varname = "userchecks" |
| 217 | + }, |
| 218 | + { |
| 219 | + sheet = "plate + experiment control", |
| 220 | + translate = false, |
| 221 | + type = "cells", |
| 222 | + variables = [ |
| 223 | + { |
| 224 | + cell = "C27", |
| 225 | + name = "rfu.rc.ref" |
| 226 | + }, |
| 227 | + { |
| 228 | + cell = "C28", |
| 229 | + name = "rfu.t4.ref" |
| 230 | + } |
| 231 | + ], |
| 232 | + varname = "userresults" |
| 233 | + } |
| 234 | + ], |
| 235 | + translations = [ |
| 236 | + { |
| 237 | + "long" = "Version", |
| 238 | + "short" = "template.version" |
| 239 | + }, |
| 240 | + { |
| 241 | + "long" = "Template Name", |
| 242 | + "short" = "template.name" |
| 243 | + }, |
| 244 | + { |
| 245 | + "long" = "Study identifier", |
| 246 | + "short" = "studyID" |
| 247 | + }, |
| 248 | + { |
| 249 | + "long" = "Experiment identifier", |
| 250 | + "short" = "exptID" |
| 251 | + }, |
| 252 | + { |
| 253 | + "long" = "Plate identifier", |
| 254 | + "short" = "plateID" |
| 255 | + }, |
| 256 | + { |
| 257 | + "long" = "Run identifier", |
| 258 | + "short" = "runID" |
| 259 | + }, |
| 260 | + { |
| 261 | + "long" = "Instrument identifier", |
| 262 | + "short" = "instrID" |
| 263 | + }, |
| 264 | + { |
| 265 | + "long" = "Experimenter name", |
| 266 | + "short" = "experimenter" |
| 267 | + }, |
| 268 | + { |
| 269 | + "long" = "Date of experiment", |
| 270 | + "short" = "date" |
| 271 | + }, |
| 272 | + { |
| 273 | + "long" = "Laboratory identifier", |
| 274 | + "short" = "labID" |
| 275 | + }, |
| 276 | + { |
| 277 | + "long" = "Temperature (C)", |
| 278 | + "short" = "temp" |
| 279 | + }, |
| 280 | + { |
| 281 | + "long" = "Item 1", |
| 282 | + "short" = "itm1ID" |
| 283 | + }, |
| 284 | + { |
| 285 | + "long" = "Molar mass 1", |
| 286 | + "short" = "itm1Mw" |
| 287 | + }, |
| 288 | + { |
| 289 | + "long" = "Run identifier 1", |
| 290 | + "short" = "run1ID" |
| 291 | + }, |
| 292 | + { |
| 293 | + "long" = "Item 2", |
| 294 | + "short" = "itm2ID" |
| 295 | + }, |
| 296 | + { |
| 297 | + "long" = "Molar mass 2", |
| 298 | + "short" = "itm2Mw" |
| 299 | + }, |
| 300 | + { |
| 301 | + "long" = "Run identifier 2", |
| 302 | + "short" = "run2ID" |
| 303 | + } |
| 304 | + ] |
| 305 | +} | Schema |
0 commit comments