Spaces:
Runtime error
Runtime error
Create core/schema_definition.py
Browse files
app/core/schema_definition.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/core/schema_definition.py
|
| 2 |
+
from pydantic import BaseModel, Field
|
| 3 |
+
from typing import List, Dict, Optional, Union
|
| 4 |
+
|
| 5 |
+
class ProjectMetadata(BaseModel):
|
| 6 |
+
name: str
|
| 7 |
+
level: str
|
| 8 |
+
unit: str = "meter"
|
| 9 |
+
|
| 10 |
+
class ElementPosition(BaseModel):
|
| 11 |
+
x: float
|
| 12 |
+
y: float
|
| 13 |
+
z: float
|
| 14 |
+
|
| 15 |
+
class ElementDimensions(BaseModel):
|
| 16 |
+
length: Optional[float] = None
|
| 17 |
+
width: Optional[float] = None
|
| 18 |
+
height: Optional[float] = None
|
| 19 |
+
|
| 20 |
+
class BIMElement(BaseModel):
|
| 21 |
+
id: str
|
| 22 |
+
element_type: str # Column, Beam, Wall-Structural, etc.
|
| 23 |
+
position: ElementPosition
|
| 24 |
+
dimensions: ElementDimensions
|
| 25 |
+
material: str
|
| 26 |
+
description: Optional[str] = None
|
| 27 |
+
|
| 28 |
+
class BIMProjectJSON(BaseModel):
|
| 29 |
+
project_metadata: ProjectMetadata
|
| 30 |
+
elements: List[BIMElement]
|