from geomancer import SpellBook
# When you want to register spells
my_spellbook = SpellBook([
DistanceToNearest("embassy", within=10000, source_table="tm-geospatial.ph_osm.pois"), # From BQ
DistanceToNearest("hospital", within=5000, source_table="pois"), # From Spatialite
])
# You can then do multiple casts
my_features = my_spellbook.cast(df, host=[bigquery.Client(), "tests/data/source.sqlite"])
# Saving the Spellbook
my_spellbook.author = "Lj Miranda" # optional
my_spellbook.description = "Some cool features for other stuff" # optional
my_spellbook.to_json("path/to/my/own/features.json")
Some potential challenges:
It is possible to create a spellbook with spells coming from different warehouses (one feature from BQ, another from SQLite, etc.). However, setting the source_table and the host is decoupled (one during init, another during cast()).
Concatenating everything inside a dataframe (similar output column names, etc.). We should do some validation before doing concat?
Some preliminary tasks:
Write down all possible metadata to include: things that are automatically generated (date? unique ID? etc.) and those that are manually set).
Usage ideas:
Some potential challenges:
source_table
and thehost
is decoupled (one during init, another duringcast()
).Some preliminary tasks: