Skip to content
Snippets Groups Projects
Commit a9521606 authored by Alessandro Frigeri's avatar Alessandro Frigeri
Browse files

updated

parent 57a85b83
Branches
No related tags found
No related merge requests found
......@@ -65,25 +65,41 @@ def get_samplingtechnique():
class Filter:
def __init__(self):
self.mission = None
self.landmark = None
self.specimenType = None
self.samplingTechnique = None
self.analyzedMaterial = None
self.analyte = None
self.analysisMethod = None
self.mission = []
self.landmark = []
self.specimenType = []
self.samplingTechnique = []
self.analyzedMaterial = []
self.analyte = []
self.analysisMethod = []
def _toJSON(self):
return json.dumps(self, default=lambda o: o.__dict__,sort_keys=True, indent=4)
#indent=4
return json.dumps(self, default=lambda o: o.__dict__,sort_keys=True,separators=(",", ":"))
def get_results(self):
print self._toJSON()
#print self._toJSON()
#print _url('/data/'+self._toJSON() )
resp = requests.get(_url('/data/'+self._toJSON() ))
res_list = []
for r in resp.json()['results']:
rd = dict(r)
res_list.append(rd)
return res_list
class Mission:
def __init__(self,name):
self.name = name
class Specimen:
def __init__(self):
self.specimenCode = ""
self.specimenName = ""
self.parentSpecimen = ""
self.childSpecimens = ""
self.specimenType = ""
#self.samplingTechnique":null,"mission":"Apollo 12","landmark":null,"lunarStation":null,"returnContainer":null,"weight":null,"pristinity":null,"pristinityDate":null,"description":null}
class AnalysisMethos:
def __init__(self,code,name):
self.name = name
......@@ -99,10 +115,21 @@ if __name__ == "__main__":
m = get_missions()
print m
f = Filter()
f.specimenType = ["SOIL"]
f.analyte = ["H2O","Ti"]
f.mission = ["Apollo 11"]
f.specimenType = ["Breccia"]
print 80*"#"
#print f.toJSON()
print f.get_results()
results = f.get_results()
for r in results:
print r
print "********"
this_res = r['dataResults'][0]
print this_res
var = this_res['variable']
val = this_res['value']
unit = this_res['unit']
print var,": ",val,unit
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment