@@ -27,6 +27,16 @@ def __init__(self, result,
2727 self .variableNameCV = variable .VariableNameCV
2828 self .processingLevelDef = processingLevel .Definition
2929
30+ class DetailedAffiliation :
31+ def __init__ (self , person , org ):
32+ self .name = person .PersonFirstName + \
33+ " " + \
34+ person .PersonLastName
35+ self .organization = "(" + org .OrganizationCode + ") " + \
36+ org .OrganizationName
37+
38+ #def __repr__(self):
39+ # return str(self.name) + " " + str(self.organization)
3040
3141class ReadODM2 ( serviceBase ):
3242 '''
@@ -117,10 +127,31 @@ def getCVUnitsTypes(self):
117127 """
118128 return self ._session .query (CVUnitsType ).all ()
119129
130+ def getCVActionTypes (self ):
131+ """
132+ Select all on CVActionType
133+ """
134+ return self ._session .query (CVActionType ).all ()
135+
136+ def getCVMethodTypes (self ):
137+ """
138+ Select all on CVMethodType
139+ """
140+ return self ._session .query (CVMethodType ).all ()
141+
120142# ################################################################################
121143# Core
122144# ################################################################################
123-
145+
146+ def getDetailedAffiliationInfo (self ):
147+ q = self ._session .query (Affiliations , People , Organizations )\
148+ .filter (Affiliations .PersonID == People .PersonID )\
149+ .filter (Affiliations .OrganizationID == Organizations .OrganizationID )
150+ affiliationList = []
151+ for a ,p ,o in q .all ():
152+ detailedAffiliation = DetailedAffiliation (p ,o )
153+ affiliationList .append (detailedAffiliation )
154+ return affiliationList
124155
125156 def getDetailedResultInfo (self , resultTypeCV ):
126157 q = self ._session .query (Results , SamplingFeatures , Methods , Variables ,
@@ -226,6 +257,9 @@ def getMethodByCode(self, methodCode):
226257 return self ._session .query (Methods ).filter_by (MethodCode = methodCode ).first ()
227258 except :
228259 return None
260+
261+ def getMethodsByType (self , methodTypeCV ):
262+ return self ._session .query (Methods ).filter_by (MethodTypeCV = methodTypeCV ).all ()
229263
230264 """
231265 ProcessingLevel
@@ -347,7 +381,6 @@ def getActions(self):
347381 """
348382 Select all on Action
349383 """
350- print self ._session .query (Actions ).all ()
351384 return self ._session .query (Actions ).all ()
352385
353386 def getActionById (self , actionId ):
@@ -358,7 +391,7 @@ def getActionById(self, actionId):
358391 return self ._session .query (Actions ).filter_by (ActionID = actionId ).first ()
359392 except :
360393 return None
361-
394+
362395
363396 """
364397 Unit
@@ -487,6 +520,9 @@ def getAffiliationByPersonAndOrg(self, personfirst, personlast, orgcode):
487520 .filter (People .PersonLastName .ilike (personlast )).first ()
488521 except :
489522 return None
523+
524+ def getAffiliations (self ):
525+ return self ._session .query (Affiliations ).all ()
490526
491527 def getAffiliationsByPerson (self , personfirst , personlast ):
492528 """
0 commit comments