@@ -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 '''
@@ -132,7 +142,16 @@ def getCVMethodTypes(self):
132142# ################################################################################
133143# Core
134144# ################################################################################
135-
145+
146+ def getDetailedAffiliationInfo (self , affiliationID ):
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
136155
137156 def getDetailedResultInfo (self , resultTypeCV ):
138157 q = self ._session .query (Results , SamplingFeatures , Methods , Variables ,
@@ -501,6 +520,9 @@ def getAffiliationByPersonAndOrg(self, personfirst, personlast, orgcode):
501520 .filter (People .PersonLastName .ilike (personlast )).first ()
502521 except :
503522 return None
523+
524+ def getAffiliations (self ):
525+ return self ._session .query (Affiliations ).all ()
504526
505527 def getAffiliationsByPerson (self , personfirst , personlast ):
506528 """
0 commit comments