Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymoondb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alessandro Frigeri
pymoondb
Commits
a9521606
Commit
a9521606
authored
6 years ago
by
Alessandro Frigeri
Browse files
Options
Downloads
Patches
Plain Diff
updated
parent
57a85b83
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
moondb.py
+41
-14
41 additions, 14 deletions
moondb.py
with
41 additions
and
14 deletions
moondb.py
+
41
−
14
View file @
a9521606
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment