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
d4503891
Commit
d4503891
authored
4 years ago
by
Rivers, Travis (Contractor) Creighton
Browse files
Options
Downloads
Patches
Plain Diff
add readonly, public metadata service
parent
cd484d62
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!146
Release CMO metadata to production
,
!22
Add readonly, public metadata service
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geomagio/api/ws/app.py
+2
-1
2 additions, 1 deletion
geomagio/api/ws/app.py
geomagio/api/ws/metadata.py
+37
-0
37 additions, 0 deletions
geomagio/api/ws/metadata.py
with
39 additions
and
1 deletion
geomagio/api/ws/app.py
+
2
−
1
View file @
d4503891
...
@@ -7,7 +7,7 @@ from fastapi.middleware.cors import CORSMiddleware
...
@@ -7,7 +7,7 @@ from fastapi.middleware.cors import CORSMiddleware
from
fastapi.responses
import
JSONResponse
,
PlainTextResponse
,
RedirectResponse
from
fastapi.responses
import
JSONResponse
,
PlainTextResponse
,
RedirectResponse
from
obspy
import
UTCDateTime
from
obspy
import
UTCDateTime
from
.
import
algorithms
,
data
,
elements
,
observatories
from
.
import
algorithms
,
data
,
elements
,
metadata
,
observatories
ERROR_CODE_MESSAGES
=
{
ERROR_CODE_MESSAGES
=
{
...
@@ -28,6 +28,7 @@ app = FastAPI(docs_url="/docs", root_path="/ws")
...
@@ -28,6 +28,7 @@ app = FastAPI(docs_url="/docs", root_path="/ws")
app
.
include_router
(
algorithms
.
router
)
app
.
include_router
(
algorithms
.
router
)
app
.
include_router
(
data
.
router
)
app
.
include_router
(
data
.
router
)
app
.
include_router
(
elements
.
router
)
app
.
include_router
(
elements
.
router
)
app
.
include_router
(
metadata
.
router
)
app
.
include_router
(
observatories
.
router
)
app
.
include_router
(
observatories
.
router
)
...
...
This diff is collapsed.
Click to expand it.
geomagio/api/ws/metadata.py
0 → 100644
+
37
−
0
View file @
d4503891
from
typing
import
List
from
fastapi
import
APIRouter
,
Body
,
Response
from
obspy
import
UTCDateTime
from
...metadata
import
Metadata
,
MetadataCategory
from
..secure.MetadataQuery
import
MetadataQuery
from
..db
import
metadata_table
router
=
APIRouter
()
@router.get
(
"
/metadata
"
,
response_model
=
List
[
Metadata
])
async
def
get_metadata
(
category
:
MetadataCategory
=
None
,
starttime
:
UTCDateTime
=
None
,
endtime
:
UTCDateTime
=
None
,
network
:
str
=
None
,
station
:
str
=
None
,
channel
:
str
=
None
,
location
:
str
=
None
,
data_valid
:
bool
=
None
,
metadata_valid
:
bool
=
True
,
):
query
=
MetadataQuery
(
category
=
category
,
starttime
=
starttime
,
endtime
=
endtime
,
network
=
network
,
station
=
station
,
channel
=
channel
,
location
=
location
,
data_valid
=
data_valid
,
metadata_valid
=
metadata_valid
,
)
metas
=
await
metadata_table
.
get_metadata
(
**
query
.
datetime_dict
(
exclude
=
{
"
id
"
}))
return
metas
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