Skip to content

Commit 24dfcd2

Browse files
committed
other models and linkML representations for AtOM
1 parent 516b3f1 commit 24dfcd2

34 files changed

+1574
-18
lines changed

main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
# from internal import admin
55
from routers import biosamples, participants
66

7+
import uvicorn
8+
from fastapi_sqlalchemy import DBSessionMiddleware, db
9+
import os
10+
from dotenv import load_dotenv
11+
12+
load_dotenv('.env')
13+
714
app = FastAPI(dependencies=[Depends(get_query_token)])
815

916

@@ -17,7 +24,14 @@
1724
# responses={418: {"description": "I'm a teapot"}},
1825
# )
1926

27+
# to avoid csrftokenError
28+
app.add_middleware(DBSessionMiddleware, db_url=os.environ['DATABASE_URL'])
2029

2130
@app.get("/")
2231
async def root():
2332
return {"message": "Knowledge Graph API"}
33+
34+
35+
# To run locally
36+
if __name__ == '__main__':
37+
uvicorn.run(app, host='0.0.0.0', port=8000)

models/__init__.py

Whitespace-only changes.

models/annotations.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pydantic import BaseModel
2+
3+
4+
class Annotations(BaseModel):
5+
name: str

models/assay.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pydantic import BaseModel
2+
3+
4+
class Assay(BaseModel):
5+
name: str

models/atlas.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pydantic import BaseModel
2+
3+
4+
class Atlas(BaseModel):
5+
type: Spatial, Dimensional

models/biosample.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from dandischema import DandiBaseModel
2+
3+
4+
class BioSample(DandiBaseModel):
5+
"""Description of the sample that was studied"""
6+
7+
identifier: Identifier = Field(nskey="schema")
8+
sampleType: SampleType = Field(
9+
description="Identifier for the sample characteristics (e.g., from OBI, Encode).",
10+
nskey="dandi",
11+
)
12+
assayType: Optional[List[AssayType]] = Field(
13+
None, description="Identifier for the assay(s) used (e.g., OBI).", nskey="dandi"
14+
)
15+
anatomy: Optional[List[Anatomy]] = Field(
16+
None,
17+
description="Identifier for what organ the sample belongs "
18+
"to. Use the most specific descriptor from sources such as UBERON.",
19+
nskey="dandi",
20+
)
21+
22+
wasDerivedFrom: Optional[List["BioSample"]] = Field(
23+
None,
24+
description="Describes the hierarchy of sample derivation or aggregation.",
25+
nskey="prov",
26+
)
27+
wasAttributedTo: Optional[List[Participant]] = Field(
28+
None,
29+
description="Participant(s) or Subject(s) associated with this sample.",
30+
nskey="prov",
31+
)
32+
sameAs: Optional[List[Identifier]] = Field(None, nskey="schema")
33+
hasMember: Optional[List[Identifier]] = Field(None, nskey="prov")
34+
35+
_ldmeta = {
36+
"rdfs:subClassOf": ["schema:Thing", "prov:Entity"],
37+
"rdfs:label": "Information about the biosample.",
38+
"nskey": "dandi",
39+
}

models/cell.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from pydantic import BaseModel
2+
3+
4+
class Cell(BaseModel):
5+
location: str
6+
cellType: CellType

models/cellbygene.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pydantic import BaseModel
2+
3+
4+
class CellbyGene(BaseModel):
5+
cell: Cell

models/celltype.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pydantic import BaseModel
2+
3+
4+
class CellType(BaseModel):
5+
name: str

models/instrument.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pydantic import BaseModel
2+
3+
4+
class Instrument(BaseModel):
5+
name: str

0 commit comments

Comments
 (0)