Skip to content

Commit

Permalink
version update 0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fenke committed May 27, 2024
1 parent 4aaacc8 commit 7fe6dc0
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,4 @@ checklink/cookies.txt

# Quarto
.quarto
.devenv-corebridge/
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
This package provides functions and classes to run wodan style
processing functions in the Stactics AICore environment.

## Install
## Installation

Use

``` sh
pip install corebridge
```

to install corebrdige.

## How to use

### Introduction

#### Wodan processing functions

Wodan is a proprietary backend service that applies high performance,
custom analytical processing to timeseries data in the Whysor data and
dashboarding environment.
Expand All @@ -38,13 +40,17 @@ def multiply(data:np.ndarray, multiplier:float=1.0):
```

#### AICore modules
Wodan binds this function to a service endpoint and takes care of
fetching data and parameters and converting the result for the caller.

### AICore modules

For AICore one defines a class, always named `Module` with a constructor
`__init__` and a method `infer`.
For AICore users define a class, always named `Module` with a
constructor `__init__` and a method `infer`.

This package defines a baseclass to quickly construct a custom `Module`
class that uses a wodan processor function inside the AICore system:
class that is able to use a wodan processor function inside the AICore
system:

``` {python}
import numpy as np
Expand All @@ -55,23 +61,32 @@ def multiply(data:np.ndarray, multiplier:float=1.0):
class Module(corebridge.aicorebridge.AICoreModule):
def __init__(self, save_dir, assets_dir, *args, **kwargs):
super().__init__(read, save_dir, assets_dir, *args, **kwargs)
super().__init__(multiply, save_dir, assets_dir, *args, **kwargs)
```

That’s it. Well, you can add parameters to `__init__` that can be used
as hyperparameters and you could override `infer` for the same reason.
as hyperparameters in the web-interface and you could override `infer`
for the same reason. The baseclass takes care of converting call
parameters and data to the function specification and, calls the
function and converts the result for the caller, similar to the original
Wodan service.

``` python
```
## Development

Setup a virtual environment, activate it and install the development
package and dependencies with, on linux

pip install -e ‘.\[dev\]’

or on Windows

2
pip install -e .\[dev\]

## nbdev cycle
### nbdev cycle

- edit
- nbdev_export
- pip install -e ‘.\[dev\]
- nbdev_test
- nbdev_clean
- nbdev_readme
Expand Down
2 changes: 1 addition & 1 deletion corebridge/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.4"
__version__ = "0.2.5"
8 changes: 5 additions & 3 deletions corebridge/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,17 @@ def timeseries_dataframe_from_datadict(

if orient == 'records':
df = pd.DataFrame.from_records(data)
time_column = [C for C in df.columns if C.lower() in timecolumns][0]
time_column = [C for C in df.columns if C in timecolumns][0]

elif orient == 'table':
time_column = data['schema']['primaryKey'][0]
df = pd.DataFrame.from_dict(data['data']).set_index(data['schema']['primaryKey'])
df.index.name = 'time'
else:
time_column = [C for C in df.columns if C in timecolumns][0]


df.columns = [C.lower() for C in df.columns]
time_column = [C for C in df.columns if C in timecolumns][0]
df.columns = list(df.columns)
df[time_column] = pd.to_datetime(df[time_column],utc=True,format='ISO8601')
df.set_index(time_column, inplace=True)
#df.index = pd.DatetimeIndex(df.index).round('ms')
Expand Down
4 changes: 2 additions & 2 deletions settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Python library ###
repo = corebridge
lib_name = %(repo)s
version = 0.2.4
version = 0.2.5
min_python = 3.7
license = apache2
black_formatting = False
Expand Down Expand Up @@ -39,5 +39,5 @@ user = fenke

### Optional ###
requirements = python-dateutil pytz numpy pandas scipy scikit-learn fastcore twine
dev_requirements = python-dateutil pytz numpy pyarrow pandas scipy scikit-learn fastcore jupyter ipywidgets jupyterlab>4 jupyter_contrib_nbextensions jupyterlab-git jupyterlab-quarto nbdev aiohttp asyncpg apscheduler twine
dev_requirements = python-dateutil pytz numpy pyarrow pandas scipy scikit-learn fastcore jupyter ipywidgets jupyterlab>4 jupyter_contrib_nbextensions jupyterlab-git jupyterlab-quarto nbdev aiohttp asyncpg apscheduler twine addroot
# console_scripts =

0 comments on commit 7fe6dc0

Please sign in to comment.