stantic.server#

class stantic.server.Server(url: str, docker_compose: Optional[Any] = None)[source]#

Bases: object

Server model of a FROST server instance

delete(E: Type[Entity], id: Optional[int] = None) None[source]#

Delete all or specified entity from server

Parameters
  • E – entity type to delete

  • id – entity id

Returns

Nothing

dump(entity: Optional[Union[Type[Entity], Iterable[Type[Entity]]]] = None) Dict[Type[Entity], List[Entity]][source]#

Get all instances of requested entity type

Parameters

entity – entity type or list of entity types

Returns

Dict with entities

get(E: Type[Entity], id: Optional[int] = None, search: Optional[str] = None) Optional[Union[Entity, Iterable[Entity]]][source]#

Get all or specified entity from server

Parameters
  • E – entity type to get

  • id – entity id

  • search – filter entitites by this search string

Returns

Entity or list of requested entities

property is_alive#

Check if the server can be reached

post(entity: Entity, strict: Optional[bool] = True) Optional[Entity][source]#

Post an entity to the server

Parameters
  • entity – entity instance

  • strict – don’t allow double entry of entities (determined by name attr)

Returns

Posted entity including assigned id

pull_data(datastream: Datastream, *, dt_min: Optional[datetime] = None, dt_max: Optional[datetime] = None, max_requests: Optional[int] = None) DataFrame[source]#

Pull data from datastream

Parameters
  • datastream – source datastream

  • dt_min – start datetime

  • dt_max – end datetime

  • max_requests – max request calls allowed (overwrites default of 100)

Returns

Dataframe with observation values

push_data(datastream: Datastream, df: DataFrame, batch_mode: Optional[bool] = True) None[source]#

Push data to datastream

Parameters
  • datastream – target datastream

  • df – dataframe with observation values

  • batch_mode – push data as one array instead of iterative pushes (much more efficient)

Returns

Nothing

update(entity: Entity) None[source]#

Update/ patch an entity on the server

Parameters

entity – the updated entity to be pushed to the server

Returns

Nothing

update_field(E: Type[Entity], id: int, payload: Dict[str, Any]) Optional[Iterable[Entity]][source]#

Update specific fields of an entity on the server

Parameters
  • E – entity type to update

  • id – entity id

  • payload – entity fields and values to be used in update

Returns

Entity or list of requested entities