Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Fitchain Python Client

Project description

### What is this repository for? ###

* python based SDK
* v0.1

This repo implements the SDK to manage projects and models on a local fitchain pod

### Feedback ###
Reach out and tell us how we can improve this SDK to make it easier for you to work with the pod and build your models.

You may always drop us a mail at ``` code@fitchain.io ```


### Getting Started ###
#### Prequisites

Create a virtual environment

``` virtualenv -p python3 venv ```

``` . venv/bin/activate ```

and install all requirements in it

```pip3 install -r requirements.txt```

from this virtualenv run the code submitted by data scientist as in

```python ../../fitchain/machine-learning-models/mlp-reuters/train_mlp.py```


Make sure libmagic is installed:

```
brew install libmagic
```

####Fitchain sdk

First install the fitchain sdk using pip:
```bash
pip install fitchain
```

Once the fitchain sdk has been installed, you can use the library:

```python
from fitchain import Runtime

fc = Runtime()
```

Call the ```projects()``` method to get an overview of all available projects. You may even enter a query string to
filter your results.

```python
projects = fc.projects()
```

Once a project has been chosen, the datasources linked to the project can be retrieved using the ```datasources``` property

```python
project = projects[...]
project_datasources = project.datasources
```

Data for a specific datasource can be loaded by calling the ``` load(<datasource_id) ``` method on the project
```python
project_datasource_id = ...
project.load(project_datasource_id)
```

### Extracting schema and generating data
#### From data owner's pod

```
# Loading data and generating schema
df = dt.DataTemplate()
df.load_data(parentdir+ '/data/titanic_train.csv')
data_schema = df.get_template()

# Save schema to json file
schema_filepath = parentdir+'/data/titanic_schema.json'
print('Saving schema to disk at %s'%schema_filepath)
with open(schema_filepath, 'w') as outfile:
json.dump(data_schema, outfile)
del data_schema
```

#### From model owner's pod


```
# Generating dummy data from local schema
# load schema from json file
print('Loading schema from %s' % schema_filepath)
with open(schema_filepath) as json_data:
schema = json.load(json_data)
json_data.close()
pprint.pprint(schema)

dummy = dd.DummyData(schema)
dummy_df = dummy.generate_data()

# Write model on dummy_df
dummy_df.to_csv(parentdir+'/data/dummy_titanic.csv')
```


### Reference
The following methods are available as part of the SDK

##### Pod Identity #####
```python
identity = fc.identity()
```

##### List projects #####
```python
projects = fc.projects()
```

##### List workspaces #####
```python
workspaces = fc.workspaces()
```

##### List providers #####
```python
providers = fc.providers()
```

##### List Owned Datasources #####
```python
datasources = fc.datasources()
```

##### List jobs #####
```python
jobs = fc.jobs()
```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
fitchain-0.0.18-py3-none-any.whl (24.8 kB) Copy SHA256 hash SHA256 Wheel py3 Sep 20, 2018
fitchain-0.0.18.tar.gz (21.4 kB) Copy SHA256 hash SHA256 Source None Sep 20, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page