Changeset 812 for trunk/grails-app/conf
- Timestamp:
- Aug 16, 2010, 6:04:00 PM (11 years ago)
- Location:
- trunk/grails-app/conf
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r793 r812 40 40 BootStrapStudies.addExampleStudies() 41 41 } 42 43 println "Finished adding templates and studies" 42 44 } 43 45 … … 51 53 TemplateEntity.getField(Sample.domainFields, 'material').ontologies = [Ontology.getOrCreateOntologyByNcboId(1005)] 52 54 55 println "Registering SAM REST methods" 53 56 // register methods for accessing SAM's Rest services 54 57 if (grails.util.GrailsUtil.environment == GrailsApplication.ENV_PRODUCTION) { … … 59 62 } 60 63 CommunicationManager.registerRestWrapperMethodsSAMtoGSCF() 64 65 println "Done with BootStrap" 61 66 } 62 67 -
trunk/grails-app/conf/BootStrapStudies.groovy
r806 r812 231 231 def evS = new SamplingEvent( 232 232 startTime: 3600 +7 * 24 * 3600, 233 endTime: 3600 +7 * 24 * 3600,234 233 template: liverSamplingEventTemplate, 235 234 sampleTemplate: humanTissueSampleTemplate) … … 238 237 def evS4 = new SamplingEvent( 239 238 startTime: 3600 +7 * 24 * 3600, 240 endTime: 3600 +7 * 24 * 3600,241 239 template: liverSamplingEventTemplate, 242 240 sampleTemplate: humanTissueSampleTemplate) … … 314 312 .setFieldValue("Cage", "" + (int)(x/2)) 315 313 314 // We have to save the subject first, otherwise the parentEvent property of the sample cannot be set 315 // (this is possibly a Grails or Hibernate bug) 316 316 mouseStudy.addToSubjects(currentSubject) 317 .with { if (!validate()) { errors.each { println it} } else save()}317 currentSubject.with { if (!validate()) { errors.each { println it} } else save()} 318 318 319 319 // Add subject to appropriate EventGroup … … 333 333 template: humanBloodSampleTemplate, 334 334 parentSubject: currentSubject, 335 parentEvent: x > 40 ? evS4 : evS335 parentEvent: evS //x > 40 ? evS4 : evS 336 336 ); 337 mouseStudy.addToSamples(currentSample) 338 currentSample.with { if (!validate()) { errors.each { println it} } else save()} 337 339 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 338 mouseStudy.addToSamples(currentSample).with { if (!validate()) { errors.each { println it} } else save()}339 340 } 340 341 … … 388 389 def bloodSamplingEvent = new SamplingEvent( 389 390 startTime: 3 * 24 * 3600 + 30 * 3600, 390 endTime: 3 * 24 * 3600 + 30 * 3600,391 391 template: bloodSamplingEventTemplate, 392 392 sampleTemplate: humanBloodSampleTemplate) … … 411 411 .setFieldValue("BMI", 20 + Math.random() * 10F) 412 412 413 humanStudy.addToSubjects(currentSubject) 414 currentSubject.with { if (!validate()) { errors.each { println it} } else save()} 415 413 416 rootGroup.addToSubjects currentSubject 414 417 rootGroup.save() … … 421 424 parentEvent: bloodSamplingEvent 422 425 ); 426 427 humanStudy.addToSamples(currentSample) 428 currentSample.with { if (!validate()) { errors.each { println it} } else save()} 423 429 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 424 425 humanStudy.addToSubjects(currentSubject).addToSamples(currentSample)426 .with { if (!validate()) { errors.each { println it} } else save()}427 430 } 428 431 … … 431 434 humanStudy.addToEventGroups rootGroup 432 435 433 436 println ".adding persons and saving PPSH study..." 434 437 // Add persons to study 435 438 def studyperson3 = new StudyPerson( person: person1, role: role2 ) 436 437 439 humanStudy 438 440 .addToPersons( studyperson3 ) … … 440 442 .with { if (!validate()) { errors.each { println it} } else save()} 441 443 442 // Add clinical data ==> to be moved to SAM 443 444 def lipidAssay = new dbnp.clinicaldata.ClinicalAssay( 445 name: 'Lipid profile', 446 approved: true 447 ).with { if (!validate()) { errors.each { println it} } else save()} 448 449 def ldlMeasurement = new dbnp.clinicaldata.ClinicalMeasurement( 450 name: 'LDL', 451 unit: 'mg/dL', 452 type: dbnp.data.FeatureType.QUANTITATIVE, 453 referenceValues: '100 mg/dL', 454 detectableLimit: 250, 455 isDrug: false, isIntake: true, inSerum: true 456 ).with { if (!validate()) { errors.each { println it} } else save()} 457 458 def hdlMeasurement = new dbnp.clinicaldata.ClinicalMeasurement( 459 name: 'HDL', 460 unit: 'mg/dL', 461 type: dbnp.data.FeatureType.QUANTITATIVE, 462 referenceValues: '50 mg/dL', 463 detectableLimit: 100, 464 isDrug: false, isIntake: true, inSerum: true 465 ).with { if (!validate()) { errors.each { println it} } else save()} 466 467 lipidAssay.addToMeasurements ldlMeasurement 468 lipidAssay.addToMeasurements hdlMeasurement 469 470 def lipidAssayInstance = new dbnp.clinicaldata.ClinicalAssayInstance( 471 assay: lipidAssay 472 ).with { if (!validate()) { errors.each { println it} } else save()} 473 474 humanStudy.samples*.each { 475 new dbnp.clinicaldata.ClinicalFloatData( 476 assay: lipidAssayInstance, 477 measurement: ldlMeasurement, 478 sample: it.name, 479 value: Math.round(Math.random()*ldlMeasurement.detectableLimit) 480 ).with { if (!validate()) { errors.each { println it} } else save()} 481 482 new dbnp.clinicaldata.ClinicalFloatData( 483 assay: lipidAssayInstance, 484 measurement: hdlMeasurement, 485 sample: it.name, 486 value: Math.round(Math.random()*hdlMeasurement.detectableLimit) 487 ).with { if (!validate()) { errors.each { println it} } else save()} 488 } 489 490 // Add assay to study capture module 491 444 println ".adding assay references to mouse example study..." 445 446 // Add SAM assay references 492 447 def clinicalModule = new AssayModule( 493 448 name: 'SAM module for clinical data', … … 510 465 mouseStudy.save() 511 466 512 lipidAssayRef.with { if (!validate()) { errors.each { println it} } else save()} 467 //lipidAssayRef.with { if (!validate()) { errors.each { println it} } else save()} 468 469 println ".adding assay references to human example study..." 513 470 514 471 def glucoseAssay2Ref = new Assay( … … 524 481 ) 525 482 526 humanStudy.addToAssays(glucoseAssay2Ref)527 humanStudy.addToAssays(glucoseAssay3Ref)528 humanStudy.save()529 530 483 humanStudy.samples*.each { 531 484 glucoseAssay2Ref.addToSamples(it) … … 533 486 } 534 487 535 glucoseAssay2Ref.with { if (!validate()) { errors.each { println it} } else save()} 536 glucoseAssay3Ref.with { if (!validate()) { errors.each { println it} } else save()} 488 489 humanStudy.addToAssays(glucoseAssay2Ref) 490 humanStudy.addToAssays(glucoseAssay3Ref) 491 humanStudy.save() 492 println "Saving" 493 //glucoseAssay2Ref.with { if (!validate()) { errors.each { println it} } else save()} 494 //glucoseAssay3Ref.with { if (!validate()) { errors.each { println it} } else save()} 537 495 538 496 }
Note: See TracChangeset
for help on using the changeset viewer.