source: trunk/grails-app/controllers/SandboxController.groovy @ 187

Last change on this file since 187 was 187, checked in by keesvb, 10 years ago

changed definition of clean data layer, implemented it for the clinical data module, added demonstration to the sandbox

  • Property svn:keywords set to
    Date
    Author
    Rev
File size: 1.4 KB
Line 
1import dbnp.studycapturing.*
2import dbnp.clinicaldata.ClinicalFloatData
3import dbnp.clinicaldata.ClinicalMeasurement
4
5// The sandbox is meant for internal communication over code examples etc.
6
7class SandboxController {
8
9        def clinicalDataLayerService
10
11        def index = {
12
13                // Get the example study in a lazy way
14                def st = Study.get(1)
15                def f = st.template.subjectFields
16
17                //println st.giveAllFields()
18
19                // This is a way to iterate over the fields in your controller
20                // And print them to the console
21                // Most of the time, you would just iterate over them in the view using <g:each>
22                // See also views/sandbox/index.gsp
23                f.each {field ->
24                        println field.name + "(" + field.type + ")"
25                }
26
27                //Let's get a certain field for a certain subject
28                /*def subject = st.subjects.get(1)
29
30                if (subject) {
31                println st.template.getSubjectFieldType('Age')
32                println subject.getFieldValue('Genotype')
33                subject.setFieldValue('Genotype','wildtype')
34                println subject.getFieldValue('Genotype')
35                subject.setFieldValue('name','hallo')
36                println subject.name }*/
37
38
39                // Demonstration of querying mechanism
40                println clinicalDataLayerService.getFeaturesQuantitative(1)
41                clinicalDataLayerService.getDataQuantitative('LDL',1,['A1_B','A3_B'] as String[])
42
43                // Specify which variables we want to be available in the controller (implicit return statement)
44                [fields: f, subjects: st.subjects]
45        }
46}
Note: See TracBrowser for help on using the repository browser.