Skip to content

Instantly share code, notes, and snippets.

@cmutel
Created October 6, 2024 11:13
Show Gist options
  • Save cmutel/3bd81d51f4cf5c1959b590bc7dc09429 to your computer and use it in GitHub Desktop.
Save cmutel/3bd81d51f4cf5c1959b590bc7dc09429 to your computer and use it in GitHub Desktop.
from typing import Optional
from pydantic import BaseModel
import pandas as pd
from enum import Enum
class IRI:
# Can look up info
class Demand(BaseModel):
product_iri: IRI
properties: Optional[list]
amount: float
spatial_context: IRI = IRI("https://sws.geonames.org/6295630/")
temporal_range: list[datetime, datetime] # TBD
class DataHandlingStrategy(Enum):
outliers_raise_error: bool = False
class RunConfig(BaseModel):
outlier_strategy: OutlierStrategy = OutlierStrategy.reject
num_samples: int = 1000
class SentierModel:
def __init__(self, demand: Demand, run_config: RunConfig):
pass
def get_model_data(self) -> list[pd.DataFrame]: # Duck typing also fine
pass
def prepare(self) -> None:
self.get_model_data()
self.data_validity_checks()
self.resample()
def run(self) -> list[Demand]:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment