Changeset 1604


Ignore:
Timestamp:
Mar 8, 2011, 6:01:16 PM (13 years ago)
Author:
s.h.sikkema@…
Message:

Added two flushes so that gscf starts correctly on an empty PostgresQL database

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/conf/dbnp/configuration/ExampleTemplates.groovy

    r1588 r1604  
    6666                                ncboId: '1007',
    6767                                ncboVersionedId: '44746'
    68                         ).save(failOnError:true)
     68                        ).save(failOnError:true, flush:true)
    6969
    7070                }
     
    666666                                new TemplateFieldListItem(name: 'HPLC')
    667667                            ])
    668                 ).save(failOnError:true)
     668                ).save(failOnError:true, flush:true)
    669669        }
    670670
    671671}
    672 
    673 ///**
    674 // * @Author kees
    675 // * @Since Jun 25, 2010
    676 // *
    677 // * Revision information:
    678 // * $Rev$
    679 // * $Author$
    680 // * $Date$
    681 // */
    682 //package dbnp.configuration
    683 //
    684 //
    685 //import dbnp.studycapturing.*
    686 //import org.dbnp.gdt.*
    687 //import org.codehaus.groovy.grails.commons.GrailsApplication
    688 //
    689 //class ExampleTemplates {
    690 //
    691 //      /**
    692 //       * Add the ontologies that are necessary for the templates below manually
    693 //       * This function can be called to avoid the HTTP requests to BioPortal each time
    694 //       * (e.g. in development or automated test environments)
    695 //       */
    696 //      public static void initTemplateOntologies() {
    697 //              "inserting initial ontologies".grom()
    698 //
    699 //              // If running in development or test mode, add ontologies manually to speed up development and allow running offline
    700 //              if (grails.util.GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT || grails.util.GrailsUtil.environment == GrailsApplication.ENV_TEST) {
    701 //
    702 //                      // add Species ontology which is used for a.o. the Subject domain field 'species'
    703 //                      def speciesOntology = new Ontology(
    704 //                              name: 'NCBI organismal classification',
    705 //                              description: 'A taxonomic classification of living organisms and associated artifacts for their controlled description within the context of databases.',
    706 //                              url: 'http://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/',
    707 //                              versionNumber: '1.2',
    708 //                              ncboId: '1132',
    709 //                              ncboVersionedId: '38802'
    710 //                      ).with { if (!validate()) { errors.each { println it} } else save()}
    711 //
    712 //                      // add Sample>material ontology
    713 //                      def brendaOntology = new Ontology(
    714 //                              name: 'BRENDA tissue / enzyme source',
    715 //                              description: 'A structured controlled vocabulary for the source of an enzyme. It comprises terms for tissues, cell lines, cell types and cell cultures from uni- and multicellular organisms.',
    716 //                              url: 'http://www.brenda-enzymes.info',
    717 //                              versionNumber: '1.3',
    718 //                              ncboId: '1005',
    719 //                              ncboVersionedId: '40643'
    720 //                      ).with { if (!validate()) { errors.each { println it} } else save()}
    721 //
    722 //                      // add NCI ontology which is used in Mouse genotype template field
    723 //                      def nciOntology = new Ontology(
    724 //                              name: 'NCI Thesaurus',
    725 //                              description: 'A vocabulary for clinical care, translational and basic research, and public information and administrative activities.',
    726 //                              url: 'http://ncicb.nci.nih.gov/core/EVS',
    727 //                              versionNumber: '10.03',
    728 //                              ncboId: '1032',
    729 //                              ncboVersionedId: '42838'
    730 //                      ).with { if (!validate()) { errors.each { println it} } else save()}
    731 //
    732 //                      // add CHEBI ontology which is used for describing chemicals in e.g. events
    733 //                      def chebiOntology = new Ontology(
    734 //                              name: 'Chemical entities of biological interest',
    735 //                              description: 'A structured classification of chemical compounds of biological relevance.',
    736 //                              url: 'http://www.ebi.ac.uk/chebi',
    737 //                              versionNumber: '1.73',
    738 //                              ncboId: '1007',
    739 //                              ncboVersionedId: '44746'
    740 //                      ).with { if (!validate()) { errors.each { println it} } else save()}
    741 //
    742 //              }
    743 //              // otherwise, this may be a production demo instance, so initialize the ontologies dynamically from BioPortal
    744 //              else {
    745 //
    746 //                      def speciesOntology = Ontology.getOrCreateOntologyByNcboId(1132)
    747 //                      def brendaOntology = Ontology.getOrCreateOntologyByNcboId(1005)
    748 //                      def nciOntology = Ontology.getOrCreateOntologyByNcboId(1032)
    749 //                      def chebiOntology = Ontology.getOrCreateOntologyByNcboId(1007)
    750 //              }
    751 //      }
    752 //
    753 //
    754 //      /**
    755 //       * Add example templates, this function would normally be called on an empty database
    756 //       */
    757 //      public static void initTemplates() {
    758 //              "inserting initial templates".grom()
    759 //
    760 //              def genderField = new TemplateField(
    761 //                      name: 'Gender',type: TemplateFieldType.STRINGLIST, entity: Subject,
    762 //                      listEntries: [new TemplateFieldListItem(name:'Male'),new TemplateFieldListItem(name: 'Female'),new TemplateFieldListItem(name: 'Unknown')])
    763 //              .with { if (!validate()) { errors.each { println it} } else save()}
    764 //
    765 //              def ageField = new TemplateField(
    766 //                      name: 'Age',type: TemplateFieldType.LONG,entity: Subject,unit: 'years',comment: 'Either include age at the start of the study or date of birth (if known)')
    767 //              .with { if (!validate()) { errors.each { println it} } else save()}
    768 //
    769 //              def genotypeField = new TemplateField(
    770 //                      name: 'Genotype', type: TemplateFieldType.ONTOLOGYTERM,entity: Subject,
    771 //                      comment: 'If present, indicate the genetic variance of the subject (e.g., mutagenized populations,knock-out/in,transgene etc)')
    772 //              .with { if (!validate()) { errors.each { println it} } else save()}
    773 //
    774 //               def genotypeTypeField = new TemplateField(
    775 //                      name: 'Genotype type',type: TemplateFieldType.STRINGLIST,entity: Subject,
    776 //                      listEntries: [new TemplateFieldListItem(name:'wildtype'),
    777 //                              new TemplateFieldListItem(name:'transgenic'),
    778 //                              new TemplateFieldListItem(name:'knock-out'),
    779 //                              new TemplateFieldListItem(name:'knock-in')],
    780 //                      comment: 'If a genotype was specified, please indicate here the type of the genotype')
    781 //              .with { if (!validate()) { errors.each { println it} } else save()}
    782 //
    783 //              def varietyField = new TemplateField(
    784 //                      name: 'Variety', type: TemplateFieldType.STRING,entity: Subject,
    785 //                      comment: 'taxonomic category consisting of members of a species that differ from others of the same species in minor but heritable characteristics')
    786 //              .with { if (!validate()) { errors.each { println it} } else save()}
    787 //
    788 //              def ecotypeField = new TemplateField(
    789 //                      name: 'Ecotype', type: TemplateFieldType.STRING,entity: Subject,
    790 //                       comment: 'a type or subspecies of life that is especially well adapted to a certain environment'
    791 //              )
    792 //               .with { if (!validate()) { errors.each { println it} } else save()}
    793 //
    794 //              // Nutritional study template
    795 //              def studyTemplate = new Template(
    796 //                      name: 'Academic study',
    797 //                      entity: dbnp.studycapturing.Study
    798 //              )
    799 //              .addToFields(new TemplateField(name: 'Objectives',type: TemplateFieldType.TEXT,entity: Study,comment:'Fill out the aim or questions of the study'))
    800 //              .addToFields(new TemplateField(name: 'Consortium',type: TemplateFieldType.STRING,entity: Study,comment:'If the study was performed within a consortium (e.g. NMC, NuGO), you can indicate this here'))
    801 //              .addToFields(new TemplateField(name: 'Cohort name',type: TemplateFieldType.STRING,entity: Study,comment:'If a cohort was used the name or code of the cohort can be define here (define a cohort template)'))
    802 //              .addToFields(new TemplateField(name: 'Lab id',type: TemplateFieldType.STRING,entity: Study,comment:'In which lab was the study performed; indicate the roomnumber.'))
    803 //              .addToFields(new TemplateField(name: 'Institute',type: TemplateFieldType.STRING,entity: Study,comment:'In which institute was the study performed; indicate the full address information (to be replaced by persons-affiliations?)'))
    804 //              .addToFields(new TemplateField(name: 'Study protocol',type: TemplateFieldType.FILE,entity: Study,comment:'Optionally attach a file in which the protocol in the study is described'))
    805 //              .with { if (!validate()) { errors.each { println it} } else save()}
    806 //
    807 //              // Mouse template
    808 //              def mouseTemplate = new Template(
    809 //                      name: 'Mouse', entity: dbnp.studycapturing.Subject)
    810 //              .addToFields(new TemplateField(
    811 //                      name: 'Strain', type: TemplateFieldType.ONTOLOGYTERM, ontologies: [Ontology.getOrCreateOntologyByNcboId(1032)], entity: Subject, comment: "This is an ontology term, if the right strain is not in the list please add it with 'add more'"))
    812 //              .addToFields(genotypeField)
    813 //              .addToFields(genotypeTypeField)
    814 //              .addToFields(genderField)
    815 //              .addToFields(new TemplateField(
    816 //                      name: 'Age', type: TemplateFieldType.LONG, entity: Subject, unit: 'weeks', comment: 'Age at start of study'))
    817 //              .addToFields(new TemplateField(
    818 //                      name: 'Age type',type: TemplateFieldType.STRINGLIST,entity: Subject,
    819 //                      listEntries: [new TemplateFieldListItem(name:'postnatal'),new TemplateFieldListItem(name:'embryonal')]))
    820 //              .addToFields(new TemplateField(
    821 //                      name: 'Cage',type: TemplateFieldType.STRING,entity: Subject,comment:'Indicate the cage used for housing (type and/or size)'))
    822 //              .addToFields(new TemplateField(
    823 //                      name: '#Mice in cage',type: TemplateFieldType.LONG,entity: Subject,comment:'If known, indicate the number of mice per cage'))
    824 //              .addToFields(new TemplateField(
    825 //                      name: 'Litter size',type: TemplateFieldType.LONG,entity: Subject,comment:'If known, indicate the litter size of the litter from which the subject originates'))
    826 //              .addToFields(new TemplateField(
    827 //                      name: 'Weight', type: TemplateFieldType.DOUBLE, unit: 'gram',entity: Subject,comment:'If known indicate the weight of the subject in grams at the start of the study'))
    828 //              .with { if (!validate()) { errors.each { println it} } else save()}
    829 //
    830 //              // Human template
    831 //              def humanTemplate = new Template(
    832 //                      name: 'Human', entity: dbnp.studycapturing.Subject)
    833 //              .addToFields(genderField)
    834 //              .addToFields(ageField)
    835 //              .addToFields(new TemplateField(
    836 //                      name: 'DOB',type: TemplateFieldType.DATE,entity: Subject,comment:'Date of birth'))
    837 //              .addToFields(new TemplateField(
    838 //                      name: 'Height',type: TemplateFieldType.DOUBLE, entity: Subject, unit: 'm'))
    839 //              .addToFields(new TemplateField(
    840 //                      name: 'Weight',type: TemplateFieldType.DOUBLE, entity: Subject, unit: 'kg'))
    841 //              .addToFields(new TemplateField(
    842 //                      name: 'BMI',type: TemplateFieldType.DOUBLE, entity: Subject, unit: 'kg/m2',comment:'Body-mass-index'))
    843 //              .addToFields(new TemplateField(
    844 //                      name: 'Race',type: TemplateFieldType.STRING,entity: Subject, comment:'If known and of interest the ethnic group can be indicated'))
    845 //              .addToFields(new TemplateField(
    846 //                      name: 'Waist circumference',type: TemplateFieldType.DOUBLE, unit: 'cm',entity: Subject, comment:'The waist circumference is measured just above the hip bone. Indicate the measure at the start of the study.'))
    847 //              .addToFields(new TemplateField(
    848 //                      name: 'Hip circumference',type: TemplateFieldType.DOUBLE, unit: 'cm',entity: Subject, comment:'The hip circumference is measured at the level of the two bony prominences front of the hips. Indicate the measure at the start of the study.'))
    849 //              .addToFields(new TemplateField(
    850 //                      name: 'Systolic blood pressure',type: TemplateFieldType.DOUBLE, unit: 'mmHg',entity: Subject, comment:'Indicate the levels at the start of the study in mmHG'))
    851 //              .addToFields(new TemplateField(
    852 //                      name: 'Diastolic blood pressure',type: TemplateFieldType.DOUBLE, unit: 'mmHg',entity: Subject, comment:'Indicate the levels at the start of the study in mmHG'))
    853 //              .addToFields(new TemplateField(
    854 //                      name: 'Heart rate',type: TemplateFieldType.DOUBLE, unit: 'beats/min',entity: Subject, comment:'Indicate the heart rate at the start of in study in beats per minute'))
    855 //              .addToFields(new TemplateField(
    856 //                      name: 'Run-in-food',type: TemplateFieldType.TEXT,entity: Subject, comment:'If defined, give a short description of the food used before the measurements'))
    857 //              .with { if (!validate()) { errors.each { println it} } else save()}
    858 //
    859 //              def sampleRemarksField = new TemplateField(
    860 //                      name: 'Remarks',
    861 //                      type: TemplateFieldType.TEXT,
    862 //                  entity: Sample
    863 //              )
    864 //              .with { if (!validate()) { errors.each { println it} } else save()}
    865 //
    866 //              def sampleVialTextField = new TemplateField(
    867 //                      name: 'Text on vial',
    868 //                      type: TemplateFieldType.STRING,
    869 //                  entity: Sample
    870 //              )
    871 //              .with { if (!validate()) { errors.each { println it} } else save()}
    872 //
    873 //              // Human tissue sample template
    874 //              def humanSampleTemplate = new Template(
    875 //                      name: 'Human tissue sample',
    876 //                      entity: dbnp.studycapturing.Sample
    877 //              )
    878 //              .addToFields(sampleRemarksField)
    879 //              .addToFields(sampleVialTextField)
    880 //              .addToFields(
    881 //                      new TemplateField(
    882 //                          name: 'Sample measured weight',
    883 //                          unit: 'mg',
    884 //                          type: TemplateFieldType.DOUBLE,
    885 //                      entity: Sample
    886 //                      )
    887 //              )
    888 //              .with { if (!validate()) { errors.each { println it} } else save()}
    889 //
    890 //              // Human blood sample template
    891 //              def humanBloodSampleTemplate = new Template(
    892 //                  name: 'Human blood sample',
    893 //                      entity: dbnp.studycapturing.Sample
    894 //              )
    895 //              .addToFields(sampleRemarksField)
    896 //              .addToFields(sampleVialTextField)
    897 //              .addToFields(
    898 //                      new TemplateField(
    899 //                          name: 'Sample measured volume',
    900 //                          unit: 'ml',
    901 //                          type: TemplateFieldType.DOUBLE,
    902 //                              entity: Sample
    903 //                      )
    904 //              )
    905 //              .with { if (!validate()) { errors.each { println it} } else save()}
    906 //
    907 //
    908 //              /*
    909 //               * Add NMC - DCL Sample Mapping Template
    910 //               * by Michael van Vliet
    911 //               *
    912 //               * For the Pilot running in Leiden (NOV2010)
    913 //               */
    914 //              def sampleDCLTextField = new TemplateField(
    915 //                      name: 'DCL Sample Reference',
    916 //                      type: TemplateFieldType.STRING,
    917 //                      entity: Sample
    918 //              )
    919 //              .with { if (!validate()) { errors.each { println it} } else save()}
    920 //
    921 //              // Human tissue sample template
    922 //              def dclSampleTemplate = new Template(
    923 //                      name: 'DCL Sample information',
    924 //                      entity: dbnp.studycapturing.Sample
    925 //              )
    926 //              .addToFields(sampleDCLTextField)
    927 //              .with { if (!validate()) { errors.each { println it} } else save()}
    928 //              // EO DCL Sample Mapping Template**********************************
    929 //
    930 //
    931 //              /*
    932 //              def GrowthTreatmentTemplate = new Template(
    933 //                      name: 'Growth treatment',
    934 //                      entity: dbnp.studycapturing.Event
    935 //              )
    936 //              .addToFields(sampleDescriptionField)
    937 //              .addToFields(new TemplateField(name: 'position X',type: TemplateFieldType.STRING))
    938 //              .addToFields(new TemplateField(name: 'position Y',type: TemplateFieldType.STRING))
    939 //              .addToFields(new TemplateField(name: 'Block',type: TemplateFieldType.STRING))
    940 //              .addToFields(new TemplateField(name: 'Temparature Day',type: TemplateFieldType.STRING))
    941 //              .addToFields(new TemplateField(name: 'Temparature Night',type: TemplateFieldType.STRING))
    942 //              .addToFields(new TemplateField(name: 'Light Intensity',type: TemplateFieldType.STRING))
    943 //              .addToFields(new TemplateField(name: 'Harvest Delay',type: TemplateFieldType.STRING))
    944 //              .with { if (!validate()) { errors.each { println it} } else save()}
    945 //               */
    946 //
    947 //              //Plant template
    948 //              def greenHouseTemplate = new Template(
    949 //                      name: 'Plant-green house ',
    950 //                      entity: dbnp.studycapturing.Subject
    951 //              )
    952 //              .addToFields(varietyField)
    953 //              .addToFields(ecotypeField)
    954 //               .addToFields(genotypeField)
    955 //              /*
    956 //              .addToFields(genotypeTypeField)
    957 //              .addToFields(
    958 //                      new TemplateField(
    959 //                              name: 'Growth location', type: TemplateFieldType.STRINGLIST,
    960 //                              listEntries: [
    961 //                                      new TemplateFieldListItem(name:'Greenhouse'),
    962 //                                      new TemplateFieldListItem(name: 'Field')
    963 //                              ]
    964 //                      )
    965 //              )
    966 //              .addToFields(
    967 //                      new TemplateField(
    968 //                              name: 'Room', type: TemplateFieldType.STRING,
    969 //                              comment: 'Chamber number in case of Greenhouse'
    970 //                      )
    971 //              )
    972 //              */
    973 //              .addToFields(
    974 //                      new TemplateField(
    975 //                              name: 'Chamber no.',
    976 //                              type: TemplateFieldType.STRING,
    977 //                              entity: Subject,
    978 //                              comment: 'Chamber number in the Greenhouse'
    979 //                      )
    980 //              )
    981 //              .addToFields(
    982 //                      new TemplateField(
    983 //                              name: 'Growth type',
    984 //                              entity: Subject,
    985 //                              type: TemplateFieldType.STRINGLIST,
    986 //                              listEntries: [
    987 //                                      new TemplateFieldListItem(name:'Standard'),
    988 //                              new TemplateFieldListItem(name: 'Experimental'),
    989 //                              new TemplateFieldListItem(name: 'Unknown')
    990 //                              ]
    991 //                      )
    992 //              )
    993 //              .addToFields(new TemplateField(
    994 //                      name: 'Growth protocol', entity: Subject, type: TemplateFieldType.TEXT))
    995 //              .addToFields(new TemplateField(
    996 //                      name: 'Position X', entity: Subject, type: TemplateFieldType.DOUBLE))
    997 //              .addToFields(new TemplateField(
    998 //                      name: 'Position Y', entity: Subject, type: TemplateFieldType.DOUBLE))
    999 //              .addToFields(new TemplateField(
    1000 //                      name: 'Block', entity: Subject, type: TemplateFieldType.STRING))
    1001 //              .addToFields(new TemplateField(
    1002 //                      name: 'Temperature at day', entity: Subject, type: TemplateFieldType.DOUBLE))
    1003 //              .addToFields(new TemplateField(
    1004 //                      name: 'Temperature at night', entity: Subject, type: TemplateFieldType.DOUBLE))
    1005 //              .addToFields(new TemplateField(
    1006 //                      name: 'Photo period', entity: Subject, type: TemplateFieldType.STRING))
    1007 //              .addToFields(new TemplateField(
    1008 //                      name: 'Light intensity', entity: Subject, type: TemplateFieldType.STRING))
    1009 //              .addToFields(new TemplateField(
    1010 //                      name: 'Start date', entity: Subject, type: TemplateFieldType.DATE))
    1011 //              .addToFields(new TemplateField(
    1012 //                      name: 'Harvest date', entity: Subject, type: TemplateFieldType.DATE))
    1013 //              .addToFields(new TemplateField(
    1014 //                      name: 'Harvest delay', entity: Subject, type: TemplateFieldType.TEXT))
    1015 //              .addToFields(new TemplateField(
    1016 //                      name: 'Additional info', entity: Subject, type: TemplateFieldType.TEXT))
    1017 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1018 //
    1019 //              def FieldTemplate = new Template(
    1020 //                      name: 'Plant-open field',
    1021 //                      entity: dbnp.studycapturing.Subject
    1022 //              )
    1023 //              .addToFields(varietyField)
    1024 //              .addToFields(ecotypeField)
    1025 //              .addToFields(genotypeField)
    1026 //              .addToFields(new TemplateField(
    1027 //                      name: 'Start date', entity: Subject, type: TemplateFieldType.DATE))
    1028 //              .addToFields(new TemplateField(
    1029 //                      name: 'Harvest date', entity: Subject, type: TemplateFieldType.DATE))
    1030 //              .addToFields(new TemplateField(
    1031 //                      name: 'Growth type', entity: Subject, type: TemplateFieldType.STRINGLIST,
    1032 //                      listEntries: [new TemplateFieldListItem(name:'Standard'),new TemplateFieldListItem(name: 'Experimental')]))
    1033 //              .addToFields(new TemplateField(
    1034 //                      name: 'Growth protocol', entity: Subject, type: TemplateFieldType.TEXT))
    1035 //              .addToFields(new TemplateField(
    1036 //                      name: 'Harvest delay', entity: Subject, type: TemplateFieldType.TEXT))
    1037 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1038 //
    1039 //              //Plant template
    1040 //              def chamberTemplate = new Template(
    1041 //                      name: 'Plant-chamber',
    1042 //                      entity: dbnp.studycapturing.Subject
    1043 //              )
    1044 //              .addToFields(varietyField)
    1045 //              .addToFields(ecotypeField)
    1046 //              .addToFields(genotypeField)
    1047 //              /*
    1048 //              .addToFields(genotypeTypeField)
    1049 //              .addToFields(
    1050 //                      new TemplateField(
    1051 //                              name: 'Growth location',
    1052 //                              type: TemplateFieldType.STRINGLIST,
    1053 //                              listEntries: [
    1054 //                                      new TemplateFieldListItem(name:'Greenhouse'),
    1055 //                                      new TemplateFieldListItem(name: 'Field')
    1056 //                              ]
    1057 //                      )
    1058 //              )
    1059 //              */
    1060 //              .addToFields(new TemplateField(
    1061 //                      name: 'Room', type: TemplateFieldType.STRING, entity: Subject,
    1062 //                      comment: 'room number'))
    1063 //              .addToFields(new TemplateField(
    1064 //                      name: 'Chamber no.', type: TemplateFieldType.STRING, entity: Subject,
    1065 //                      comment: 'Chamber number'))
    1066 //              .addToFields(new TemplateField(
    1067 //                      name: 'Block', type: TemplateFieldType.STRING, entity: Subject))
    1068 //              .addToFields(new TemplateField(
    1069 //                      name: 'Position X', type: TemplateFieldType.DOUBLE, entity: Subject))
    1070 //              .addToFields(new TemplateField(
    1071 //                      name: 'Position Y', type: TemplateFieldType.DOUBLE, entity: Subject))
    1072 //              .addToFields(new TemplateField(
    1073 //                      name: 'Temperature at day', type: TemplateFieldType.DOUBLE, entity: Subject))
    1074 //              .addToFields(new TemplateField(
    1075 //                      name: 'Temperature at night', type: TemplateFieldType.DOUBLE, entity: Subject))
    1076 //              .addToFields(new TemplateField(
    1077 //                      name: 'Photo period', type: TemplateFieldType.STRING, entity: Subject))
    1078 //              .addToFields(new TemplateField(
    1079 //                      name: 'Light intensity', type: TemplateFieldType.STRING, entity: Subject))
    1080 //              .addToFields(new TemplateField(
    1081 //                      name: 'Start date', type: TemplateFieldType.DATE, entity: Subject))
    1082 //              .addToFields(new TemplateField(
    1083 //                      name: 'Harvest date', type: TemplateFieldType.DATE, entity: Subject))
    1084 //              .addToFields(new TemplateField(
    1085 //                      name: 'Growth type', type: TemplateFieldType.STRINGLIST, entity: Subject,
    1086 //                      listEntries: [new TemplateFieldListItem(name:'Standard'),new TemplateFieldListItem(name: 'Experimental')]))
    1087 //              .addToFields(new TemplateField(
    1088 //                      name: 'Growth protocol', type: TemplateFieldType.TEXT, entity: Subject))
    1089 //              .addToFields(new TemplateField(
    1090 //                      name: 'Harvest delay', type: TemplateFieldType.TEXT, entity: Subject))
    1091 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1092 //
    1093 //              def plantSampleTemplate = new Template(
    1094 //                      name: 'Plant sample',
    1095 //                      entity: dbnp.studycapturing.Sample
    1096 //              )
    1097 //              .addToFields(sampleRemarksField)
    1098 //              .addToFields(sampleVialTextField)
    1099 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1100 //
    1101 //              def materialPrepTemplate = new Template(
    1102 //                      name: 'Plant-material preparation',
    1103 //                  description: 'material preparation',
    1104 //                  entity: dbnp.studycapturing.Event
    1105 //              )
    1106 //              .addToFields(new TemplateField(
    1107 //                       name: 'Tissue',
    1108 //                      type: TemplateFieldType.STRING,
    1109 //                      entity: Event,
    1110 //                  comment: 'organ/ fraction of culture/ plant part')
    1111 //              )
    1112 //              .addToFields(
    1113 //                      new TemplateField(
    1114 //                               name: 'Grinding',
    1115 //                              type: TemplateFieldType.STRINGLIST,
    1116 //                              entity: Event,
    1117 //                          listEntries: [
    1118 //                                      new TemplateFieldListItem(name:'yes'),
    1119 //                              new TemplateFieldListItem(name: 'no'),
    1120 //                              new TemplateFieldListItem(name: 'unknown')
    1121 //                              ]
    1122 //                      )
    1123 //              )
    1124 //              .addToFields(
    1125 //                      new TemplateField(
    1126 //                              name: 'Storage location',
    1127 //                              type: TemplateFieldType.STRING,
    1128 //                              entity: Event
    1129 //                      )
    1130 //              )
    1131 //              .addToFields(
    1132 //                      new TemplateField(
    1133 //                              name: 'protocol reference',
    1134 //                              type: TemplateFieldType.STRING,
    1135 //                              entity: Event
    1136 //                      )
    1137 //              )
    1138 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1139 //
    1140 //              def protocolField = new TemplateField(
    1141 //                      name: 'Protocol',
    1142 //                      type: TemplateFieldType.FILE,
    1143 //                      entity: Event,
    1144 //                      comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the event'
    1145 //              )
    1146 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1147 //
    1148 //              // diet treatment template
    1149 //              def dietTreatmentTemplate = new Template(
    1150 //                      name: 'Diet treatment',
    1151 //                      entity: dbnp.studycapturing.Event
    1152 //              )
    1153 //              .addToFields(
    1154 //                      new TemplateField(
    1155 //                              name: 'Diet',
    1156 //                              type: TemplateFieldType.STRINGLIST,
    1157 //                              entity: Event,
    1158 //                              listEntries: [
    1159 //                                      new TemplateFieldListItem(name:'low fat'),
    1160 //                                      new TemplateFieldListItem(name: 'high fat')
    1161 //                              ]
    1162 //                      )
    1163 //              )
    1164 //              .addToFields(protocolField)
    1165 //              .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    1166 //              dietTreatmentTemplate.refresh()
    1167 //
    1168 //              // boost treatment template
    1169 //              def boostTreatmentTemplate = new Template(
    1170 //                      name: 'Compound challenge',
    1171 //                      entity: dbnp.studycapturing.Event
    1172 //              )
    1173 //              .addToFields(
    1174 //                      new TemplateField(
    1175 //                              name: 'Compound',
    1176 //                              type: TemplateFieldType.ONTOLOGYTERM,
    1177 //                              entity: Event,
    1178 //                              ontologies: [Ontology.getOrCreateOntologyByNcboId(1007)]
    1179 //                      )
    1180 //              )
    1181 //              .addToFields(
    1182 //                      new TemplateField(
    1183 //                              name: 'Control',
    1184 //                              type: TemplateFieldType.BOOLEAN,
    1185 //                              entity: Event
    1186 //                      )
    1187 //              )
    1188 //              .addToFields(protocolField)
    1189 //              .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    1190 //              boostTreatmentTemplate.refresh()
    1191 //
    1192 //              // fasting treatment template
    1193 //              def fastingTreatment = new Template(
    1194 //                      name: 'Fasting treatment',
    1195 //                      description: 'Fasting for a specific amount of time',
    1196 //                      entity: dbnp.studycapturing.Event
    1197 //              )
    1198 //              .addToFields(
    1199 //                      new TemplateField(
    1200 //                              name: 'Fasting period',
    1201 //                              type: TemplateFieldType.RELTIME,
    1202 //                              entity: Event
    1203 //                      )
    1204 //              )
    1205 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1206 //
    1207 //              // SamplingEvent templates
    1208 //              def samplingProtocolField = new TemplateField(
    1209 //                      name: 'Sample Protocol',
    1210 //                      entity: SamplingEvent,
    1211 //                      type: TemplateFieldType.FILE,
    1212 //                      comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the sampling event'
    1213 //              )
    1214 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1215 //
    1216 //              // liver sampling event template
    1217 //              def liverSamplingEventTemplate = new Template(
    1218 //                      name: 'Liver extraction',
    1219 //                      description: 'Liver sampling for transcriptomics arrays',
    1220 //                      entity: dbnp.studycapturing.SamplingEvent
    1221 //              )
    1222 //              .addToFields(samplingProtocolField)
    1223 //              .addToFields(
    1224 //                      new TemplateField(
    1225 //                              name: 'Sample weight',
    1226 //                              unit: 'mg',
    1227 //                              entity: SamplingEvent,
    1228 //                              type: TemplateFieldType.DOUBLE
    1229 //                      )
    1230 //              )
    1231 //              .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    1232 //              liverSamplingEventTemplate.refresh()
    1233 //
    1234 //              // blood sampling
    1235 //              def bloodSamplingEventTemplate = new Template(
    1236 //                      name: 'Blood extraction',
    1237 //                      description: 'Blood extraction targeted at lipid assays',
    1238 //                      entity: dbnp.studycapturing.SamplingEvent
    1239 //              )
    1240 //              .addToFields(samplingProtocolField)
    1241 //              .addToFields(
    1242 //                      new TemplateField(
    1243 //                              name: 'Sample volume',
    1244 //                              entity: SamplingEvent,
    1245 //                              unit: 'ml',
    1246 //                              type: TemplateFieldType.DOUBLE
    1247 //                      )
    1248 //              )
    1249 //              .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    1250 //              bloodSamplingEventTemplate.refresh()
    1251 //
    1252 //              // plant sample extraction event template
    1253 //              def plantSamplingExtractEventTemplate = new Template(
    1254 //                      name: 'Plant sample extraction',
    1255 //                      description: 'sample extraction',
    1256 //                      entity: dbnp.studycapturing.SamplingEvent,
    1257 //                  sampleTemplates: [plantSampleTemplate]
    1258 //              )
    1259 //              .addToFields(samplingProtocolField)
    1260 //              .addToFields(
    1261 //                      new TemplateField(
    1262 //                              name: 'Sample weight',
    1263 //                              unit: 'ul',
    1264 //                              entity: SamplingEvent,
    1265 //                              type: TemplateFieldType.DOUBLE
    1266 //                      )
    1267 //              )
    1268 //              .addToFields(
    1269 //                      new TemplateField(
    1270 //                              name: 'Sample when measured',
    1271 //                              type: TemplateFieldType.STRINGLIST,
    1272 //                              entity: SamplingEvent,
    1273 //                           listEntries: [
    1274 //                                       new TemplateFieldListItem(name:'Dried'),
    1275 //                           new TemplateFieldListItem(name: 'Fresh'),
    1276 //                           new TemplateFieldListItem(name: 'Unknown')
    1277 //                               ]
    1278 //                      )
    1279 //              )
    1280 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1281 //
    1282 //              // plant sampling event template
    1283 //              def plantSamplingEventTemplate = new Template(
    1284 //                      name: 'Plant-sample',
    1285 //                      description: 'plant sample ',
    1286 //                      entity: dbnp.studycapturing.SamplingEvent,
    1287 //                  sampleTemplates: [plantSampleTemplate]
    1288 //              )
    1289 //              //.addToFields(samplingProtocolField)
    1290 //              .addToFields(
    1291 //                      new TemplateField(
    1292 //                              name: 'material',
    1293 //                          comment: 'physical charecteristic. e.g, grounded powder of tomato seed or liquid',
    1294 //                              entity: SamplingEvent,
    1295 //                              type: TemplateFieldType.STRING
    1296 //                      )
    1297 //              )
    1298 //              .addToFields(
    1299 //                      new TemplateField(
    1300 //                              name: 'Description',
    1301 //                              type: TemplateFieldType.STRING,
    1302 //                              entity: SamplingEvent
    1303 //                      )
    1304 //              )
    1305 //              .addToFields(
    1306 //                      new TemplateField(
    1307 //                              name: 'extracted material',
    1308 //                              comment: 'substance to be extracted. e.g., lipids, volatiles, primary metabolites etc',
    1309 //                              type: TemplateFieldType.STRING,
    1310 //                              entity: SamplingEvent
    1311 //                      )
    1312 //              )
    1313 //              .addToFields(
    1314 //                      new TemplateField(
    1315 //                              name: 'Text on vial',
    1316 //                              entity: SamplingEvent,
    1317 //                              type: TemplateFieldType.STRING
    1318 //                      )
    1319 //              )
    1320 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1321 //
    1322 //
    1323 //              // assay templates
    1324 //              def assayDescriptionField = new TemplateField(
    1325 //                              name: 'Description',
    1326 //                          comment: 'add general assay information here',
    1327 //                              entity: Assay,
    1328 //                              type: TemplateFieldType.STRING
    1329 //              );
    1330 //              assayDescriptionField.with { if (!validate()) { errors.each { println it} } else save()}
    1331 //
    1332 //              def ccAssayTemplate = new Template(
    1333 //                      name: 'Clinical chemistry assay',
    1334 //                      description: 'Clinical chemistry assay stored in a SAM module',
    1335 //                      entity: dbnp.studycapturing.Assay
    1336 //              )
    1337 //              .addToFields(assayDescriptionField)
    1338 //              .with { if (!validate()) { errors.each { println it} } else save()}
    1339 //
    1340 //              def metAssayTemplate = new Template(
    1341 //                      name: 'Metabolomics assay',
    1342 //                      description: 'Metabolomics assay stored in a metabolomics module',
    1343 //                      entity: dbnp.studycapturing.Assay
    1344 //              )
    1345 //              .addToFields(assayDescriptionField)
    1346 //              .addToFields(
    1347 //                      new TemplateField(
    1348 //                              name: 'Spectrometry technique',
    1349 //                          comment: 'Select the used metabolomics technique',
    1350 //                              entity: Assay,
    1351 //                              type: TemplateFieldType.STRINGLIST,
    1352 //                          listEntries: [
    1353 //                                      new TemplateFieldListItem(name: 'GC/MS'),
    1354 //                              new TemplateFieldListItem(name: 'LC/MS'),
    1355 //                              new TemplateFieldListItem(name: 'NMR'),
    1356 //                              new TemplateFieldListItem(name: 'HPLC')
    1357 //                          ])
    1358 //              )
    1359 //              .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    1360 //              metAssayTemplate.refresh()
    1361 //      }
    1362 //
    1363 //}
Note: See TracChangeset for help on using the changeset viewer.