Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomag-algorithms
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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
a6ddc639
Commit
a6ddc639
authored
5 years ago
by
Jeremy M Fee
Committed by
Claycomb, Abram Earl
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Proposed Metadata model for flags, etc
parent
d2fc4758
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/webservice/metadata.py
+89
-0
89 additions, 0 deletions
geomagio/webservice/metadata.py
with
89 additions
and
0 deletions
geomagio/webservice/metadata.py
0 → 100644
+
89
−
0
View file @
a6ddc639
from
__future__
import
absolute_import
import
datetime
from
.database
import
db
# known category values as constants
CATEGORY_FLAG
=
'
flag
'
CATEGORY_ADJUSTED_MATRIX
=
'
adjusted-matrix
'
class
Metadata
(
db
.
Model
):
"""
Metadata database model.
This class is used for Data flagging and other Metadata.
Flag example:
```
automatic_flag = Metadata(
created_by =
'
algorithm/version
'
,
start_time = UTCDateTime(
'
2020-01-02T00:17:00.1Z
'
),
end_time = UTCDateTime(
'
2020-01-02T00:17:00.1Z
'
),
network =
'
NT
'
,
station =
'
BOU
'
,
channel =
'
BEU
'
,
category = CATEGORY_FLAG,
comment =
"
spike detected
"
,
priority = 1,
data_valid = False)
```
Adjusted Matrix example:
```
adjusted_matrix = Metadata(
created_by =
'
algorithm/version
'
,
start_time = UTCDateTime(
'
2020-01-02T00:17:00Z
'
),
end_time = None,
network =
'
NT
'
,
station =
'
BOU
'
,
category = CATEGORY_ADJUSTED_MATRIX,
comment =
'
automatic adjusted matrix
'
,
priority = 1,
value = {
'
parameters
'
=> {
'
x
'
: 1,
'
y
'
: 2,
'
z
'
: 3}
'
matrix
'
=> [ ... ]
}
)
```
"""
# table and primary key
__tablename__
=
'
metadata
'
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
# author
created_by
=
db
.
Column
(
db
.
Text
,
index
=
True
)
# email/program id
created_time
=
db
.
Column
(
db
.
DateTime
,
default
=
datetime
.
datetime
.
utcnow
)
# time range
start_time
=
db
.
Column
(
db
.
DateTime
,
index
=
True
,
nullable
=
True
)
end_time
=
db
.
Column
(
db
.
DateTime
,
index
=
True
,
nullable
=
True
)
# data this metadata applies to
# channel/location nullable for wildcard
network
=
db
.
Column
(
db
.
Text
,
index
=
True
,
nullable
=
False
)
station
=
db
.
Column
(
db
.
Text
,
index
=
True
,
nullable
=
False
)
channel
=
db
.
Column
(
db
.
Text
,
index
=
True
,
nullable
=
True
)
location
=
db
.
Column
(
db
.
Text
,
index
=
True
,
nullable
=
True
)
# metadata
# category (flag, matrix, etc)
category
=
db
.
Column
(
db
.
Text
,
index
=
True
,
nullable
=
False
)
# comment
comment
=
db
.
Column
(
db
.
Text
,
nullable
=
True
)
# higher priority overrides lower priority
priority
=
db
.
Column
(
db
.
Integer
,
default
=
1
,
index
=
True
)
# whether data is valid during
data_valid
=
db
.
Column
(
db
.
Boolean
,
default
=
True
,
index
=
True
)
# json encoded value
value
=
db
.
Column
(
db
.
JSON
,
nullable
=
False
)
# reviewer
# email
reviewed_by
=
db
.
Column
(
db
.
Text
)
# when reviewed
reviewed_time
=
db
.
Column
(
db
.
DateTime
)
# comments by reviewer
review_comment
=
db
.
Column
(
db
.
Text
)
# whether data rejected during review
review_reject
=
db
.
Column
(
db
.
Boolean
,
default
=
False
,
index
=
True
)
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