|
7 | 7 |
|
8 | 8 | __author__ = 'jmeline' |
9 | 9 |
|
| 10 | + |
| 11 | +class DetailedResult: |
| 12 | + def __init__(self, result, |
| 13 | + samplingFeature, |
| 14 | + method, variable, |
| 15 | + processingLevel, |
| 16 | + unit): |
| 17 | + # result.result_id etc. |
| 18 | + self.resultID = result.ResultID |
| 19 | + self.samplingFeatureCode = samplingFeature.SamplingFeatureCode |
| 20 | + self.methodCode = method.MethodCode |
| 21 | + self.variableCode = variable.VariableCode |
| 22 | + self.processingLevelCode = processingLevel.ProcessingLevelCode |
| 23 | + self.unitsName = unit.UnitsName |
| 24 | + |
| 25 | + self.samplingFeatureName = samplingFeature.SamplingFeatureName |
| 26 | + self.methodName = method.MethodName |
| 27 | + self.variableNameCV = variable.VariableNameCV |
| 28 | + self.processingLevelDef = processingLevel.Definition |
| 29 | + |
| 30 | + |
10 | 31 | class ReadODM2( serviceBase ): |
11 | 32 | ''' |
12 | 33 | def __init__(self, session): |
@@ -101,6 +122,22 @@ def getCVUnitsTypes(self): |
101 | 122 | # ################################################################################ |
102 | 123 |
|
103 | 124 |
|
| 125 | + def getDetailedResultInfo(self, resultTypeCV): |
| 126 | + q = self._session.query(Results, SamplingFeatures, Methods, Variables, |
| 127 | + ProcessingLevels, Units).filter(Results.VariableID==Variables.VariableID)\ |
| 128 | + .filter(Results.UnitsID==Units.UnitsID)\ |
| 129 | + .filter(Results.FeatureActionID==FeatureActions.FeatureActionID)\ |
| 130 | + .filter(FeatureActions.SamplingFeatureID==SamplingFeatures.SamplingFeatureID)\ |
| 131 | + .filter(FeatureActions.ActionID==Actions.ActionID)\ |
| 132 | + .filter(Actions.MethodID==Methods.MethodID)\ |
| 133 | + .filter(Results.ProcessingLevelID==ProcessingLevels.ProcessingLevelID)\ |
| 134 | + .filter(Results.ResultTypeCV==resultTypeCV) |
| 135 | + resultList = [] |
| 136 | + for r,s,m,v,p,u in q.all(): |
| 137 | + detailedResult = DetailedResult(\ |
| 138 | + r,s,m,v,p,u) |
| 139 | + resultList.append(detailedResult) |
| 140 | + return resultList |
104 | 141 |
|
105 | 142 | """ |
106 | 143 | Variable |
@@ -302,6 +339,27 @@ def getGeometryTest(self, TestGeom): |
302 | 339 |
|
303 | 340 | print GeomText |
304 | 341 |
|
| 342 | + """ |
| 343 | + Action |
| 344 | + """ |
| 345 | + |
| 346 | + def getActions(self): |
| 347 | + """ |
| 348 | + Select all on Action |
| 349 | + """ |
| 350 | + print self._session.query(Actions).all() |
| 351 | + return self._session.query(Actions).all() |
| 352 | + |
| 353 | + def getActionById(self, actionId): |
| 354 | + """ |
| 355 | + Select by actionId |
| 356 | + """ |
| 357 | + try: |
| 358 | + return self._session.query(Actions).filter_by(ActionID=actionId).first() |
| 359 | + except: |
| 360 | + return None |
| 361 | + |
| 362 | + |
305 | 363 | """ |
306 | 364 | Unit |
307 | 365 | """ |
|
0 commit comments