-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathhc_create_wf1_take2.sql
More file actions
728 lines (672 loc) · 40 KB
/
hc_create_wf1_take2.sql
File metadata and controls
728 lines (672 loc) · 40 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
-- these are all the raw materials we need to get started!
select * from vw_material where description in ('Gamma-Butyrolactone', 'Formic Acid', 'Lead Diiodide', 'Ethylammonium Iodide');
insert into vw_action_def (description) values ('bring_to_temperature');
insert into vw_action_parameter_def_assign (action_def_uuid, parameter_def_uuid) values
(
(select action_def_uuid from vw_action_def where description = 'bring_to_temperature'),
(select parameter_def_uuid from vw_parameter_def where description='temperature')
);
insert into vw_inventory_material (inventory_uuid, description, material_uuid)
values (
(select inventory_uuid from vw_inventory where description = 'HC Test Inventory'),
'Lead Diiodide',
(select material_uuid from vw_material where description = 'Lead Diiodide')
);
insert into vw_inventory_material (inventory_uuid, description, material_uuid)
values (
(select inventory_uuid from vw_inventory where description = 'HC Test Inventory'),
'Ethylammonium Iodide',
(select material_uuid from vw_material where description = 'Ethylammonium Iodide')
);
insert into vw_material (description) values ('Tube: 5mL'); -- for mixing stocks
insert into vw_inventory_material (inventory_uuid, description, material_uuid)
values (
(select inventory_uuid from vw_inventory where description = 'HC Test Inventory'),
'Tube: 5mL',
(select material_uuid from vw_material where description = 'Tube: 5mL')
);
insert into vw_inventory_material (inventory_uuid, description, material_uuid)
values (
(select inventory_uuid from vw_inventory where description = 'HC Test Inventory'),
'Plate: 96 Well',
(select material_uuid from vw_material where description = 'Plate: 96 Well')
);
insert into vw_experiment (ref_uid,
description,
-- experiment_type,
parent_uuid, owner_uuid, operator_uuid, lab_uuid, status_uuid)
values (
'perovskite_demo', 'perovskite_demo',
--(select experiment_type_uuid from vw_experiment_type where description = 'template'),
null,
(select actor_uuid from vw_actor where description = 'HC'),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select actor_uuid from vw_actor where description = 'HC'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_bom (experiment_uuid, description, actor_uuid, status_uuid) values
((select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
'Perovskite Demo Materials',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
-- then add materials to BOM
insert into vw_bom_material (bom_uuid, description, inventory_material_uuid) values (
(select bom_uuid from vw_bom where description = 'Perovskite Demo Materials'),
'Acid',
(select inventory_material_uuid from vw_inventory_material where description = 'Stock FAH'));
insert into vw_bom_material (bom_uuid, description, inventory_material_uuid) values (
(select bom_uuid from vw_bom where description = 'Perovskite Demo Materials'),
'Solvent',
(select inventory_material_uuid from vw_inventory_material where description = 'Neat GBL'));
insert into vw_bom_material (bom_uuid, description, inventory_material_uuid) values (
(select bom_uuid from vw_bom where description = 'Perovskite Demo Materials'),
'Organic',
(select inventory_material_uuid from vw_inventory_material where description = 'Ethylammonium Iodide'));
insert into vw_bom_material (bom_uuid, description, inventory_material_uuid) values (
(select bom_uuid from vw_bom where description = 'Perovskite Demo Materials'),
'Inorganic',
(select inventory_material_uuid from vw_inventory_material where description = 'Lead Diiodide'));
insert into vw_bom_material (bom_uuid, description, inventory_material_uuid) values (
(select bom_uuid from vw_bom where description = 'Perovskite Demo Materials'),
'Plate',
(select inventory_material_uuid from vw_inventory_material where description = 'Plate: 96 Well'));
insert into vw_bom_material (bom_uuid, description, inventory_material_uuid) values (
(select bom_uuid from vw_bom where description = 'Perovskite Demo Materials'),
'Stock A',
(select inventory_material_uuid from vw_inventory_material where description = 'Tube: 5mL'));
insert into vw_bom_material (bom_uuid, description, inventory_material_uuid) values (
(select bom_uuid from vw_bom where description = 'Perovskite Demo Materials'),
'Stock B',
(select inventory_material_uuid from vw_inventory_material where description = 'Tube: 5mL'));
insert into vw_workflow (workflow_type_uuid, description, actor_uuid, status_uuid)
values
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Preheat Plate',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Prepare Stock A',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Prepare Stock B',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Dispense Solvent',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Dispense Stock A',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Dispense Stock B',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Dispense Acid Vol 1',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Heat Stir 1',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Dispense Acid Vol 2',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Heat Stir 2',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select workflow_type_uuid from vw_workflow_type where description = 'template'),
'Perovskite Demo: Heat',
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_experiment_workflow (experiment_workflow_seq, experiment_uuid, workflow_uuid)
values
(1,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Preheat Plate')),
(2,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A')),
(3,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock B')),
(4,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Solvent')),
(5,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Stock A')),
(6,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Stock B')),
(7,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Acid Vol 1')),
(8,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 1')),
(9,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Acid Vol 2')),
(10,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 2')),
(11,
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat'));
insert into vw_calculation_def (short_name, description, calc_definition) values
(
'sampleSolvent',
'Null calculation: dispense solvent into samples',
'null'
),
(
'sampleStockA',
'Null calculation: dispense stock A into samples',
'null'
),
(
'sampleStockB',
'Null calculation: dispense stock B into samples',
'null'
),
(
'sampleAcid1',
'Null calculation: dispense Acid 1 into samples',
'null'
),
(
'sampleAcid2',
'Null calculation: dispense Acid 2 into samples',
'null'
);
insert into vw_parameter_def (description, default_val) values
(
'Sample Solvent Volume',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
('Sample Stock A Volume',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
(
'Sample Stock B Volume',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
(
'Sample Acid Volume 1',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
(
'Sample Acid Volume 2',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
);
insert into vw_calculation_parameter_def (calculation_def_uuid, parameter_def_uuid) values
(
(select calculation_def_uuid
from vw_calculation_def
where short_name = 'sampleSolvent'),
(select parameter_def_uuid
from vw_parameter_def
where description = 'Sample Solvent Volume')
),
(
(select calculation_def_uuid
from vw_calculation_def
where short_name = 'sampleStockA'),
(select parameter_def_uuid
from vw_parameter_def
where description = 'Sample Stock A Volume')
),
(
(select calculation_def_uuid
from vw_calculation_def
where short_name = 'sampleStockB'),
(select parameter_def_uuid
from vw_parameter_def
where description = 'Sample Stock B Volume')
),
(
(select calculation_def_uuid
from vw_calculation_def
where short_name = 'sampleAcid1'),
(select parameter_def_uuid
from vw_parameter_def
where description = 'Sample Acid Volume 1')
),
(
(select calculation_def_uuid
from vw_calculation_def
where short_name = 'sampleAcid2'),
(select parameter_def_uuid
from vw_parameter_def
where description = 'Sample Acid Volume 2')
);
insert into vw_calculation (calculation_def_uuid, calculation_alias_name,out_val) values
(
(select calculation_def_uuid from vw_calculation_def where short_name = 'sampleSolvent'),
'sampleSolvent',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
(
(select calculation_def_uuid from vw_calculation_def where short_name = 'sampleStockA'),
'sampleStockA',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
(
(select calculation_def_uuid from vw_calculation_def where short_name = 'sampleStockB'),
'sampleStockB',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
(
(select calculation_def_uuid from vw_calculation_def where short_name = 'sampleAcid1'),
'sampleAcid1',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
),
(
(select calculation_def_uuid from vw_calculation_def where short_name = 'sampleAcid2'),
'sampleAcid2',
(select put_val(get_type_def('data', 'array_num'), (select array_fill(0., ARRAY[96]))::text, 'mL'))
);
-- dispense workflow action sets
-- delete from vw_workflow_action_set where description = 'Perovskite Demo: Dispense Solvent';
insert into vw_workflow_action_set (description, workflow_uuid, action_def_uuid, start_date, end_date, duration,
repeating,
parameter_def_uuid, parameter_val, calculation_uuid, source_material_uuid, destination_material_uuid,
actor_uuid, status_uuid)
values ('Perovskite Demo: Dispense Solvent',
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Solvent'),
(select action_def_uuid from vw_action_def where description = 'dispense'),
null, null, null, null,
(select parameter_def_uuid
from vw_action_parameter_def
where description = 'dispense' and parameter_description = 'volume'),
--array [(select put_val(get_type_def('data', 'num'),'0', 'mL'))],
null,
(select calculation_uuid from vw_calculation where calculation_alias_name = 'sampleSolvent'),
--null,
array [(select bom_material_index_uuid from vw_bom_material_index where description = 'Solvent'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo'))], -- this has to come from bom_material_index...
(select array(
(select bom_material_index_uuid from vw_bom_material_index where
description similar to '%Plate well#%'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')
)
)),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_action_set (description, workflow_uuid, action_def_uuid, start_date, end_date, duration,
repeating,
parameter_def_uuid, parameter_val, calculation_uuid, source_material_uuid, destination_material_uuid,
actor_uuid, status_uuid)
values ('Dispense Stock A',
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Stock A'),
(select action_def_uuid from vw_action_def where description = 'dispense'),
null, null, null, null,
(select parameter_def_uuid
from vw_action_parameter_def
where description = 'dispense' and parameter_description = 'volume'),
--array [(select put_val(get_type_def('data', 'num'),'0', 'mL'))],
null,
(select calculation_uuid from vw_calculation where calculation_alias_name = 'sampleStockA'),
array [(select bom_material_index_uuid from vw_bom_material_index where description = 'Stock A'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo'))], -- this has to come from bom_material_index...
(select array(
(select bom_material_index_uuid from vw_bom_material_index where
description similar to '%Plate well#%'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')
)
)),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_action_set (description, workflow_uuid, action_def_uuid, start_date, end_date, duration,
repeating,
parameter_def_uuid, parameter_val, calculation_uuid, source_material_uuid, destination_material_uuid,
actor_uuid, status_uuid)
values ('Dispense Stock B',
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Stock B'),
(select action_def_uuid from vw_action_def where description = 'dispense'),
null, null, null, null,
(select parameter_def_uuid
from vw_action_parameter_def
where description = 'dispense' and parameter_description = 'volume'),
--array [(select put_val(get_type_def('data', 'num'),'0', 'mL'))],
null,
(select calculation_uuid from vw_calculation where calculation_alias_name = 'sampleStockB'),
array [(select bom_material_index_uuid from vw_bom_material_index where description = 'Stock B'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo'))], -- this has to come from bom_material_index...
(select array(
(select bom_material_index_uuid from vw_bom_material_index where
description similar to '%Plate well#%'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')
)
)),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_action_set (description, workflow_uuid, action_def_uuid, start_date, end_date, duration,
repeating,
parameter_def_uuid, parameter_val, calculation_uuid, source_material_uuid, destination_material_uuid,
actor_uuid, status_uuid)
values ('Dispense Acid Vol 1',
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Acid Vol 1'),
(select action_def_uuid from vw_action_def where description = 'dispense'),
null, null, null, null,
(select parameter_def_uuid
from vw_action_parameter_def
where description = 'dispense' and parameter_description = 'volume'),
--array [(select put_val(get_type_def('data', 'num'),'0', 'mL'))],
null,
(select calculation_uuid from vw_calculation where calculation_alias_name = 'sampleAcid1'),
array [(select bom_material_index_uuid from vw_bom_material_index where description = 'Acid'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo'))], -- this has to come from bom_material_index...
(select array(
(select bom_material_index_uuid from vw_bom_material_index where
description similar to '%Plate well#%'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')
)
)),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_action_set (description, workflow_uuid, action_def_uuid, start_date, end_date, duration,
repeating,
parameter_def_uuid, parameter_val, calculation_uuid, source_material_uuid, destination_material_uuid,
actor_uuid, status_uuid)
values ('Dispense Acid Vol 2',
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Dispense Acid Vol 2'),
(select action_def_uuid from vw_action_def where description = 'dispense'),
null, null, null, null,
(select parameter_def_uuid
from vw_action_parameter_def
where description = 'dispense' and parameter_description = 'volume'),
--array [(select put_val(get_type_def('data', 'num'),'0', 'mL'))],
null,
(select calculation_uuid from vw_calculation where calculation_alias_name = 'sampleAcid2'),
array [(select bom_material_index_uuid from vw_bom_material_index where description = 'Acid'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo'))], -- this has to come from bom_material_index...
(select array(
(select bom_material_index_uuid from vw_bom_material_index where
description similar to '%Plate well#%'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')
)
)),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
-- Stock A
insert into vw_action (action_def_uuid, workflow_uuid, action_description,
source_material_uuid,
destination_material_uuid,
actor_uuid, status_uuid)
values (
(select action_def_uuid from vw_action_def where description = 'dispense'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
'Perovskite Demo: Add Solvent to Stock A',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Solvent'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Stock A'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select action_def_uuid from vw_action_def where description = 'dispense_solid'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
'Perovskite Demo: Add Organic to Stock A',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Organic'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Stock A'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select action_def_uuid from vw_action_def where description = 'dispense_solid'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
'Perovskite Demo: Add Inorganic to Stock A',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Inorganic'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Stock A'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select action_def_uuid from vw_action_def where description = 'dispense'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock B'),
'Perovskite Demo: Add Solvent to Stock B',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Solvent'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Stock B'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select action_def_uuid from vw_action_def where description = 'dispense_solid'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock B'),
'Perovskite Demo: Add Organic to Stock B',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Organic'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Stock B'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_object (workflow_uuid, action_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Add Solvent to Stock A')),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Add Organic to Stock A')),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Add Inorganic to Stock A'));
insert into vw_workflow_step (workflow_uuid, workflow_object_uuid, parent_uuid, status_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Add Solvent to Stock A')),
null,
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_step (workflow_uuid, workflow_object_uuid, parent_uuid, status_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Add Organic to Stock A')),
(select workflow_step_uuid from vw_workflow_step where workflow_object_uuid =
(select workflow_object_uuid from vw_workflow_object where
object_type = 'action'
and object_description = 'Perovskite Demo: Add Solvent to Stock A')),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_step (workflow_uuid, workflow_object_uuid, parent_uuid, status_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock A'),
(select workflow_object_uuid
from vw_workflow_object
where object_type = 'action'
and object_description = 'Perovskite Demo: Add Inorganic'),
(select workflow_step_uuid
from vw_workflow_step
where workflow_object_uuid =
(select workflow_object_uuid
from vw_workflow_object
where
object_type = 'action'
and object_description = 'Perovskite Demo: Add Organic to Stock A')),
(select status_uuid from vw_status where description = 'dev_test'));
-- Stock B
insert into vw_workflow_object (workflow_uuid, action_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock B'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Add Solvent to Stock B')),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock B'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Add Organic to Stock B'));
insert into vw_workflow_step (workflow_uuid, workflow_object_uuid, parent_uuid, status_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock B'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Add Solvent to Stock B')),
null,
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_step (workflow_uuid, workflow_object_uuid, parent_uuid, status_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Prepare Stock B'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Add Organic to Stock B')),
(select workflow_step_uuid from vw_workflow_step where workflow_object_uuid = (select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Add Solvent to Stock B'))),
(select status_uuid from vw_status where description = 'dev_test'));
-- heat and heat stirs
insert into vw_action (action_def_uuid, workflow_uuid, action_description,
source_material_uuid,
destination_material_uuid,
actor_uuid, status_uuid) values
((select action_def_uuid from vw_action_def where description = 'bring_to_temperature'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Preheat Plate'),
'Perovskite Demo: Preheat Plate',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid = (select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select action_def_uuid from vw_action_def where description = 'heat_stir'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 1'),
'Perovskite Demo: Heat Stir 1',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid = (select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select action_def_uuid from vw_action_def where description = 'heat_stir'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 2'),
'Perovskite Demo: Heat Stir 2',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid = (select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test')),
((select action_def_uuid from vw_action_def where description = 'heat'),
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat'),
'Perovskite Demo: Heat',
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid = (select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select bom_material_index_uuid from vw_bom_material_index where description = 'Plate'
and bom_uuid =
(select bom_uuid from vw_bom where experiment_description = 'perovskite_demo')),
(select actor_uuid from vw_actor where description = 'Mike Tynes'),
(select status_uuid from vw_status where description = 'dev_test'));
insert into vw_workflow_object (workflow_uuid, action_uuid)
values (
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Preheat Plate'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Preheat Plate')),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 1'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Heat Stir 1')),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 2'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Heat Stir 2')),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat'),
(select action_uuid from vw_action where action_description = 'Perovskite Demo: Heat'));
insert into vw_workflow_step (workflow_uuid, workflow_object_uuid, parent_uuid, status_uuid)
values
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Preheat Plate'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Preheat Plate')),
null,
(select status_uuid from vw_status where description = 'dev_test')
),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 1'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Heat Stir 1')),
null,
(select status_uuid from vw_status where description = 'dev_test')
),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat Stir 2'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Heat Stir 2')),
null,
(select status_uuid from vw_status where description = 'dev_test')
),
(
(select workflow_uuid from vw_workflow where description = 'Perovskite Demo: Heat'),
(select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Perovskite Demo: Heat')),
null,
(select status_uuid from vw_status where description = 'dev_test')
);
insert into vw_outcome (experiment_uuid, description)
values (
(select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
'Crystal Scores');
insert into vw_property_def (description, short_description, val_type_uuid, valunit ) values
('Crystal Score', 'crystalscore',
(select get_type_def ('data', 'int')),
'');
insert into vw_measure_def (default_measure_type_uuid, description, default_measure_value, property_def_uuid) values
((select measure_type_uuid from vw_measure_type where description = 'manual'),
'crystal_score',
(select put_val(
(select get_type_def ('data', 'int')),
'0',
'')),
(select property_def_uuid from vw_property_def where description = 'Crystal Score'));
insert into vw_measure (measure_def_uuid, measure_type_uuid, ref_measure_uuid, description, measure_value) values
((select measure_def_uuid from vw_measure_def where description = 'crystal_score'),
(select measure_type_uuid from vw_measure_type where description = 'manual'),
(select outcome_uuid from vw_outcome where description = 'Crystal Scores'),
'sample_crystal_scores',
(select put_val(
(select get_type_def ('data', 'array_int')),
(select array_fill(1, ARRAY[96])::text),
''))
);
--select * from vw_measure;
-- select experiment_copy ((select experiment_uuid from vw_experiment where description = 'perovskite_demo'),
-- 'perov_instance_1');
-- heat and heat stirs we dont do these as wafss because waffs cant handle multi-parameter actions :shrug:
-- i wonder if it makes more sense to just have a 'set heat'...
-- insert into vw_action (action_def_uuid, workflow_uuid, action_description, actor_uuid, status_uuid)
-- values (
-- (select action_def_uuid from vw_action_def where description = 'heat_stir'),
-- (select workflow_uuid from vw_workflow where description = 'Heat Stir 1'),
-- 'Heat Stir 1',
-- (select actor_uuid from vw_actor where description = 'Mike Tynes'),
-- (select status_uuid from vw_status where description = 'dev_test'));
-- insert into vw_workflow_object (workflow_uuid, action_uuid)
-- values (
-- (select workflow_uuid from vw_workflow where description = 'Heat Stir 1'),
-- (select action_uuid from vw_action where action_description = 'Heat Stir 1'));
-- insert into vw_workflow_step (workflow_uuid, workflow_object_uuid, parent_uuid, status_uuid)
-- values (
-- (select workflow_uuid from vw_workflow where description = 'Heat Stir 1'),
-- (select workflow_object_uuid from vw_workflow_object where (object_type = 'action' and object_description = 'Heat Stir 1')),
-- null,
-- (select status_uuid from vw_status where description = 'dev_test'));
-- update vw_action_parameter set parameter_val = (
-- select put_val((select get_type_def('data', 'num')), '15', 'mins'))
-- where action_description = 'Heat Stir 1'
-- and parameter_def_description = 'duration';
-- update vw_action_parameter set parameter_val = (
-- select put_val((select get_type_def('data', 'num')), '750', 'rpm'))
-- where action_description = 'Heat Stir 1'
-- and parameter_def_description = 'speed';
-- update vw_action_parameter set parameter_val = (
-- select put_val((select get_type_def('data', 'num')), '95', 'degC'))
-- where action_description = 'Heat Stir 1'
-- and parameter_def_description = 'temperature';