Last change
on this file since 187 was
187,
checked in by keesvb, 12 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.1 KB
|
Rev | Line | |
---|
[106] | 1 | package dbnp.clinicaldata |
---|
| 2 | |
---|
[187] | 3 | import dbnp.data.FeatureType |
---|
| 4 | |
---|
[106] | 5 | class ClinicalMeasurement |
---|
| 6 | extends dbnp.data.FeatureBase { |
---|
| 7 | |
---|
[187] | 8 | // For now, let's assume that quantitative values are stored as float, |
---|
| 9 | // and qualitative values as string |
---|
| 10 | // We can always add an additional ClinicalMeasurementType datatype (FLOAT, INTEGER etc.) later (as was here until rev 186) |
---|
| 11 | |
---|
[106] | 12 | String referenceValues |
---|
| 13 | float detectableLimit |
---|
| 14 | String correctionMethod |
---|
| 15 | boolean isDrug |
---|
| 16 | boolean isIntake |
---|
| 17 | boolean inSerum |
---|
| 18 | |
---|
| 19 | static constraints = { |
---|
[187] | 20 | name(unique:true) |
---|
[186] | 21 | referenceValues(nullable: true, blank: true) |
---|
| 22 | detectableLimit(nullable: true) |
---|
| 23 | correctionMethod(nullable: true, blank: true) |
---|
[106] | 24 | } |
---|
[187] | 25 | |
---|
| 26 | Map getValues(long assayID, String[] sampleIDs) { |
---|
| 27 | FeatureType featureType = type |
---|
| 28 | switch(featureType) { |
---|
| 29 | case FeatureType.QUANTITATIVE: |
---|
| 30 | def values = ClinicalFloatData.withCriteria { |
---|
| 31 | assay { eq("id",assayID) } |
---|
| 32 | eq("measurement",this) |
---|
| 33 | 'in'("sample",sampleIDs) |
---|
| 34 | } |
---|
| 35 | def result = new HashMap<String,Float>(); |
---|
| 36 | values.each { |
---|
| 37 | result.put(it.sample,it.value) |
---|
| 38 | } |
---|
| 39 | return result |
---|
| 40 | default: |
---|
| 41 | throw new NoSuchFieldException("Feature type ${featureType} not supported") |
---|
| 42 | } |
---|
| 43 | } |
---|
[106] | 44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.