Skip to content

Commit 6f62e08

Browse files
committed
concluding merge
2 parents f5e7bfa + cadf0d2 commit 6f62e08

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

services/api-v3/api/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
import api.routes.security
1111
from api.database import connect_engine, dispose_engine
12+
from api.routes.dev import dev_router
1213
from api.routes.ingest import router as ingest_router
1314
from api.routes.object import router as object_router
1415
from api.routes.sources import router as sources_router
15-
from api.routes.dev import dev_router
1616

1717

1818
@asynccontextmanager

services/api-v3/api/models/field_site.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
from pydantic import BaseModel
2-
from typing import Optional, Literal
31
from datetime import datetime
42
from enum import Enum
3+
from typing import Literal, Optional
4+
5+
from pydantic import BaseModel
6+
57

68
class Location(BaseModel):
79
"""
810
Location model representing a geographical location with latitude and longitude.
911
"""
12+
1013
latitude: float
1114
longitude: float
1215
elevation: Optional[float] = None
@@ -20,49 +23,59 @@ class Location(BaseModel):
2023
class IdentifiedModel(BaseModel):
2124
id: int
2225

26+
2327
class Photo(IdentifiedModel):
2428
"""
2529
A photo.
2630
"""
31+
2732
# URL at which the photo should be fetchable
2833
url: str
2934
width: int
3035
height: int
3136
checksum: str
3237

38+
3339
class BeddingFacing(Enum):
3440
upright = "upright"
3541
overturned = "overturned"
3642
unknown = "unknown"
3743

44+
3845
class PlanarOrientation(BaseModel):
3946
strike: float
4047
dip: float
4148
facing: BeddingFacing = BeddingFacing.upright
4249
notes: Optional[str] = None
4350
associated: list["Orientation"] = []
4451

52+
4553
class LinearOrientation(BaseModel):
4654
plunge: float
4755
trend: float
4856
notes: Optional[str] = None
4957

58+
5059
class Texture(BaseModel):
5160
name: str
5261

62+
5363
Orientation = PlanarOrientation | LinearOrientation
5464

65+
5566
class GeologicAgeInterval(IdentifiedModel):
5667
name: str
5768
t_age: Optional[float] = None
5869
b_age: Optional[float] = None
5970

71+
6072
class Lithology(IdentifiedModel):
6173
name: str
6274
parents: Optional[list[int]] = None
6375
color: Optional[str] = None
6476
pattern: Optional[str] = None
6577

78+
6679
class LithodemeType(Enum):
6780
Formation = "formation"
6881
Member = "member"
@@ -76,30 +89,37 @@ class LithodemeType(Enum):
7689
Intrusion = "intrusion"
7790
...
7891

92+
7993
class LithodemeName(GeologicAgeInterval):
80-
"""A lithodeme or stratigraphic unit name """
94+
"""A lithodeme or stratigraphic unit name"""
95+
8196
parent: Optional[int] = None
8297
type: LithodemeType
8398
t_interval: Optional[float] = None
8499
b_interval: Optional[float] = None
85100

101+
86102
class RockUnit(IdentifiedModel):
87103
name: str
88104
abbreviation: Optional[str] = None
89105
liths: list[Lithology] = []
90106
age: Optional[GeologicAgeInterval] = None
91107
entity: Optional[LithodemeName] = None
92108

109+
93110
class Fossil(IdentifiedModel):
94111
description: str
95112
taxa: Optional[str] = None
96113

114+
97115
AnyData = Orientation | Photo | RockUnit | Texture | Lithology | Fossil
98116

117+
99118
class Observation(BaseModel):
100119
notes: Optional[str] = None
101120
data: AnyData
102121

122+
103123
class Person(IdentifiedModel):
104124
name: str
105125
email: Optional[str] = None
@@ -112,22 +132,26 @@ class Sample(IdentifiedModel):
112132
"""
113133
A sample of a rock or sediment
114134
"""
135+
115136
name: str
116137
description: Optional[str] = None
117138
sample_type: Literal["rock", "sediment", "soil", "water"]
118139
igsn: Optional[str] = None
119140
collected: datetime
120141

142+
121143
class SocialInfo(BaseModel):
122144
likes: int
123145
comments: int
124146
rating: Optional[int] = None
125147

148+
126149
class FieldSite(BaseModel):
127150
"""
128151
A site of with associated field observations
129152
"""
130-
id: int|str
153+
154+
id: int | str
131155
name: Optional[str] = None
132156
location: Location
133157
created: datetime
@@ -139,4 +163,3 @@ class FieldSite(BaseModel):
139163
social: Optional[SocialInfo] = None
140164
children: Optional[list["FieldSite"]] = None
141165
contributors: Optional[list[Person]] = None
142-

0 commit comments

Comments
 (0)