Changeset 657 for trunk/src


Ignore:
Timestamp:
Jul 16, 2010, 1:47:33 PM (13 years ago)
Author:
jahn
Message:

The getSample rest resource now fetches Samples instead of Assays (allong with other data).
(Still needs to be implemented like that on SAM).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/groovy/dbnp/rest/common/CommunicationManager.groovy

    r649 r657  
    186186                // register rest resource that returns the results of a full text query on SAM
    187187        // parameters:   query. A string for fulltext search on SAM
    188         // return value: results map. It contains two keys 'studyIds', and 'assays'. 'studyIds'
    189                 //               key maps to a list of Study domain objects of GSCF. 'assays' map to a
    190                 //               list of pairs. Each pair consists of an Assay domain object of GSCF and
    191                 //               additional assay information from SAM provided as a map.
     188        // return value: results map. It contains two keys 'studyIds', and 'samples'. 'studyIds'
     189                //               key maps to a list of Study domain objects of GSCF. 'samples' maps to a
     190                //               list of pairs. Each pair consists of a Sample domain object of GSCF and
     191                //               additional sample information from SAM provided as a map.
    192192                // Example of a returned map:
    193193                //                               ["studies":[NuGO PPS human study],
    194                 //               "assays":[[["isIntake":false, "isDrug":false, "correctionMethod":"test Correction Method 1", "detectableLimit":1, "isNew":false,
    195                 //               "class":"data.SimpleAssay", "externalAssayID":"1", "id":1, "measurements":null, "unit":"Insulin", "inSerum":false,
    196         //                               "name":"test Simple Assay 1", "referenceValues":"test Reference Values 1"], dbnp.studycapturing.Assay : 1]]]
     194                //               "samples":[[ [...], dbnp.studycapturing.Sample: 1]]]
    197195                def closure = { map ->
    198196                    def studies = []
    199                     def assays = []
     197                    def samples = []
    200198                        def studiesHQ = "from dbnp.studycapturing.Study as s where s.code=?"
    201199                        map['studyIds'].each { studies.add( dbnp.studycapturing.Study.find(studiesHQ,[it]) ) }
    202                         map['assays'].each { samAssay ->
    203                                 def assayID = samAssay['externalAssayID']
    204                             def assayHQ = "from dbnp.studycapturing.Assay as a where a.externalAssayID='${assayID}'"
    205                                 def assay = dbnp.studycapturing.Assay.find(assayHQ)
    206                                 assays.add( [samAssay,assay] )
     200                        map['Samples'].each { samSample ->
     201                                def sampleID = samSample['externalSampleID']
     202                            def sampleHQ = "from dbnp.studycapturing.Sample as a where a.externalSampleID='${sampleID}'"
     203                                def sample = dbnp.studycapturing.Sample.find(sampleHQ)
     204                                samples.add( [samSample,sample] )
    207205                        }
    208                         return [studies:studies, assays:assays]
     206                        return [studies:studies, samples:samples]
    209207                }
    210208
Note: See TracChangeset for help on using the changeset viewer.