Changeset 561


Ignore:
Timestamp:
Jun 14, 2010, 1:00:46 PM (13 years ago)
Author:
keesvb
Message:

version 0.3.0: fixed some issues with updating boolean fields, changed events in the bootstrap, restructured menus

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/application.properties

    r542 r561  
    99app.name=gscf
    1010app.servlet.version=2.4
    11 app.version=0.2.5
     11app.version=0.3.0
    1212plugins.crypto=2.0
    1313plugins.db-util=0.4
  • trunk/grails-app/conf/BootStrap.groovy

    r554 r561  
    5656                                ncboVersionedId: '42693'
    5757                        ).with { if (!validate()) { errors.each { println it} } else save()}
    58                        
     58
     59                        // add CHEBI ontology which is used in Mouse genotype template field
     60                        def chebiOntology = new Ontology(
     61                                name: 'Chemical entities of biological interest',
     62                                description: 'A structured classification of chemical compounds of biological relevance.',
     63                                url: 'http://www.ebi.ac.uk/chebi',
     64                                versionNumber: '1.68',
     65                                ncboId: '1007',
     66                                ncboVersionedId: '42878'
     67                        ).with { if (!validate()) { errors.each { println it} } else save()}
     68
    5969                        // add Terms
    6070                        println ".adding mouse term"
     
    100110                                ontology: nciOntology,
    101111                                accession: 'C14424'
     112                        ).with { if (!validate()) { errors.each { println it} } else save()}
     113
     114                        def glucoseTerm = new Term(
     115                                name: 'Glucose',
     116                                ontology: chebiOntology,
     117                                accession: 'CHEBI:17234'
    102118                        ).with { if (!validate()) { errors.each { println it} } else save()}
    103119
     
    552568                        .with { if (!validate()) { errors.each { println it} } else save()}
    553569
     570                        def protocolField = new TemplateField(
     571                                name: 'Protocol',
     572                                type: TemplateFieldType.FILE,
     573                                entity: Event,
     574                                comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the event'
     575                        )
     576                        .with { if (!validate()) { errors.each { println it} } else save()}
     577
    554578                        // diet treatment template
    555579                        println ".adding diet treatement template"
     
    564588                                        entity: Event,
    565589                                        listEntries: [
    566                                                 new TemplateFieldListItem(name:'10% fat (palm oil)'),
    567                                                 new TemplateFieldListItem(name: '45% fat (palm oil)')
     590                                                new TemplateFieldListItem(name:'low fat'),
     591                                                new TemplateFieldListItem(name: 'high fat')
    568592                                        ]
    569593                                )
    570594                        )
     595                        .addToFields(protocolField)
    571596                        .with { if (!validate()) { errors.each { println it} } else save()}
    572597
     
    574599                        println ".adding boost treatment template"
    575600                        def boostTreatmentTemplate = new Template(
    576                                 name: 'Leptin treatment',
     601                                name: 'Compound challenge',
    577602                                entity: dbnp.studycapturing.Event
    578603                        )
     
    580605                                new TemplateField(
    581606                                        name: 'Compound',
    582                                         type: TemplateFieldType.STRINGLIST,
     607                                        type: TemplateFieldType.ONTOLOGYTERM,
    583608                                        entity: Event,
    584                                         listEntries: [
    585                                                 new TemplateFieldListItem(name:'Vehicle'),
    586                                                 new TemplateFieldListItem(name: 'Leptin')
    587                                         ]
    588                                 )
    589                         )
     609                                        ontologies: [chebiOntology]
     610                                )
     611                        )
     612                        .addToFields(
     613                                new TemplateField(
     614                                        name: 'Control',
     615                                        type: TemplateFieldType.BOOLEAN,
     616                                        entity: Event
     617                                )
     618                        )
     619                        .addToFields(protocolField)
    590620                        .with { if (!validate()) { errors.each { println it} } else save()}
    591621
     
    594624                        def fastingTreatment = new Template(
    595625                                name: 'Fasting treatment',
    596                                 description: 'Fasting Protocol NuGO PPSH',
     626                                description: 'Fasting for a specific amount of time',
    597627                                entity: dbnp.studycapturing.Event
    598628                        )
     
    600630                                new TemplateField(
    601631                                        name: 'Fasting period',
    602                                         type: TemplateFieldType.STRING,
     632                                        type: TemplateFieldType.RELTIME,
    603633                                        entity: Event
    604634                                )
     
    611641                name: 'Sample Protocol',
    612642                    entity: SamplingEvent,
    613                                 type: TemplateFieldType.STRING
     643                                type: TemplateFieldType.FILE,
     644                                comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the sampling event'
    614645                        )
    615646            .with { if (!validate()) { errors.each { println it} } else save()}
     
    701732            .addToFields(
    702733                                new TemplateField(
    703                                         name: 'Desription',
     734                                        name: 'Description',
    704735                                        type: TemplateFieldType.STRING,
    705736                                        entity: SamplingEvent
     
    724755
    725756                        // Add example studies
    726                         if (!(grails.util.GrailsUtil.environment == GrailsApplication.ENV_TEST)) {
     757                        if (grails.util.GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT) {
    727758                                println ".adding NuGO PPS3 leptin example study..."
    728759                                def mouseStudy = new Study(
     
    744775                                        template: dietTreatmentTemplate
    745776                                )
    746                                 .setFieldValue( 'Diet','10% fat (palm oil)')
     777                                .setFieldValue( 'Diet','low fat')
    747778                                .with { if (!validate()) { errors.each { println it} } else save()}
    748779
     
    752783                                        template: dietTreatmentTemplate
    753784                                )
    754                                 .setFieldValue( 'Diet','45% fat (palm oil)' )
     785                                .setFieldValue( 'Diet','high fat' )
    755786                                .with { if (!validate()) { errors.each { println it} } else save()}
    756787
     
    760791                                        template: boostTreatmentTemplate
    761792                                )
    762                                 .setFieldValue( 'Compound','Vehicle' )
     793                                .setFieldValue( 'Control','true' )
    763794                                .with { if (!validate()) { errors.each { println it} } else save()}
    764795
     
    768799                                        template: boostTreatmentTemplate
    769800                                )
    770                                 .setFieldValue( 'Compound','Leptin' )
     801                                .setFieldValue( 'Control','false' )
    771802                                .with { if (!validate()) { errors.each { println it} } else save()}
    772803
     
    776807                                        template: dietTreatmentTemplate
    777808                                )
    778                                 .setFieldValue( 'Diet','10% fat (palm oil)')
     809                                .setFieldValue( 'Diet','low fat')
    779810                                .with { if (!validate()) { errors.each { println it} } else save()}
    780811
     
    784815                                        template: dietTreatmentTemplate
    785816                                )
    786                                 .setFieldValue( 'Diet','45% fat (palm oil)' )
     817                                .setFieldValue( 'Diet','high fat' )
    787818                                .with { if (!validate()) { errors.each { println it} } else save()}
    788819
     
    792823                                        template: boostTreatmentTemplate
    793824                                )
    794                                 .setFieldValue( 'Compound','Vehicle' )
     825                                .setFieldValue( 'Control','true' )
    795826                                .with { if (!validate()) { errors.each { println it} } else save()}
    796827
     
    800831                                        template: boostTreatmentTemplate
    801832                                )
    802                                 .setFieldValue( 'Compound','Leptin' )
     833                                .setFieldValue( 'Control','false' )
    803834                                .with { if (!validate()) { errors.each { println it} } else save()}
    804835
  • trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy

    r559 r561  
    418418                TemplateField field = getField(this.giveFields(), fieldName)
    419419
    420                 if( field.type == TemplateFieldType.BOOLEAN ) {
    421                         println( 'Boolean: ' + fieldName + " - " + value );
     420                // Convenience setter for boolean fields
     421                if( field.type == TemplateFieldType.BOOLEAN && value && value.class == String ) {
     422                        if (value.equals("true")) {
     423                                value = true
     424                        }
     425                        else if (value.equals("false")) {
     426                                value = false
     427                        }
     428                        else {
     429                                throw new IllegalArgumentException("Boolean string not recognized: ${value} when setting field ${fieldName}")
     430                        }
    422431                }
    423432
    424433                // Convenience setter for template string list fields: find TemplateFieldListItem by name
    425434                if (field.type == TemplateFieldType.STRINGLIST && value && value.class == String) {
    426                         // Kees insensitive pattern matching ;)
    427435                        def escapedLowerCaseValue = value.toLowerCase().replaceAll("([^a-z0-9])", "_")
    428436                        value = field.listEntries.find {
     
    562570                        def store = getStore(field.type)
    563571
    564                         // If some value is entered (or 0), then save the value
     572                        // If some value is entered (or 0 or BOOLEAN false), then save the value
    565573                        // otherwise, it should not be present in the store, so
    566574                        // it is unset if it is.
    567                         if (value || value == 0) {
     575                        if (value || value == 0 || ( field.type == TemplateFieldType.BOOLEAN && value == false)) {
    568576                                println ".setting [" + ((super) ? super.class : '??') + "] template field: [" + fieldName + "] ([" + value.toString() + "] of type [" + value.class + "])"
    569577
  • trunk/grails-app/views/common/_topnav.gsp

    r526 r561  
    99      <ul class="subnav">
    1010        <li><g:link controller="study" action="list">View studies</g:link></li>
    11                   <li><g:link controller="wizard" action="index">Create study</g:link></li>
    12                   <li><g:link controller="wizard" action="index">Edit study</g:link></li>
     11                  <li><g:link controller="wizard" action="index">Create/edit study</g:link></li>
     12                  <li><g:link controller="importer" action="index">Import study data</g:link></li>
    1313      </ul>
    1414     </li>
     
    2828    </ul>
    2929   </li>
    30          <li><g:link controller="importer" action="index">Import data</g:link></li>
    3130    <g:if env="development">
    3231     <li><g:link controller="query" action="index">Query database</g:link></li>
Note: See TracChangeset for help on using the changeset viewer.