objectiv-modelhub


Nameobjectiv-modelhub JSON
Version 0.0.13 PyPI version JSON
download
home_pagehttps://github.com/objectiv/objectiv-analytics/
SummaryThe open model hub is a growing collection of data models that you can take, combine and run for product analysis and exploration.
upload_time2022-06-23 21:17:13
maintainer
docs_urlNone
authorObjectiv B.V.
requires_python>=3.7
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Open model hub

The open model hub consists of pre-built models and operations that you can combine to build advanced compound models with little effort. The open model hub is powered by [Bach](https://objectiv.io/docs/modeling/bach/), our python-based modeling library.

Visit [Objectiv Docs](https://objectiv.io/docs/modeling/open-model-hub/) to learn more

## Start modeling with Objectiv
If you want to use the open model hub, install the package from Pypi as follows:
```bash
pip install objectiv-modelhub
```
You are now ready to use the model hub. Either through your own notebooks/code or through our examples.

### Examples
We have some example notebooks in the 
[/notebooks/](https://github.com/objectiv/objectiv-analytics/tree/main/notebooks) directory of
the repository that demonstrate how you can work with the data in Python. These notebooks can run on _your_
collected data. The only thing that might need to be adjusted is how the connection to the database is 
made (see below). All other instructions live in the README.md in the link above.

### Your own code
To use the model hub in your own code, you can import the package and use it to get a Bach DataFrame 
([What is Bach?](https://www.objectiv.io/docs/modeling/bach/what-is-bach/)) to 
perform your operations on. The object can be instantiated as follows, where the `db_url` and `table_name`
should be adjusted depending on where the data is stored and how to access it.
```python
from modelhub import ModelHub
# instantiate the model hub
modelhub = ModelHub(time_aggregation='%Y-%m-%d')
# get the Bach DataFrame to use with model hub models
df = modelhub.get_objectiv_dataframe(db_url='postgresql://user:pass@localhost:5432/database',
                                     table_name='data')
```

## Setup development environment
This section is only required for development on the objectiv-modelhub package.

```bash
virtualenv venv
source venv/bin/activate
export PYTHONPATH=.

# You probably want to remove objectiv-modelhub if you did not just create a fresh venv
pip uninstall objectiv-modelhub

# This will fail if the postgres lib development headers are not present if so, then on Ubuntu that can
# be fixed with: sudo apt-get install libpq-dev
pip install -r requirements.txt

# in case your notebook can not find all of the packages you just installed
# you may also need to create a kernel config for this venv:

ipython kernel install --user --name=objectiv_venv
# now restart the notebook server, and from the kernel menu select 'objectiv_venv'
```

### PyCharm
* Mark the following directories as "Sources root":
   1. `/bach/`
   2. `/modelhub/`
* Set `modelhub/venv/bin/python` as the default interpreter for the project


## Metabase integration

To enable Objectiv's Metabase integration, there are basically 2 steps:

### 1. Setup connectivity from Metabase to your database
   
Within Metabase, switch to admin mode, and select Databases to add your database (if this has not already been
done). Exit admin. 

Switching to the overview, in the section "our data" a new database, with the name of the database should be
present. If you select the database, a numeric ID will be in the URL, for example: 
"http://localhost:3000/browse/2-objectiv", in this case your database ID is 2.

The collection ID can be obtained in a similar way. From the overview page, select the collection (or create
one first) from "Our analytics". This will result in a URL like "http://localhost:3000/collection/2-objectiv",
in this case 2 is your collection ID.

Finally, if you have set up a dashboard, and want cards to be added to that automatically, open the dashboard;
the URL should be something like "http://localhost:3000/dashboard/1-model-hub", your dashboard ID is 1. This
is optional.

### 2. Configure Objectiv to communicate with Metabase. 

This works through exporting variables to the environment that is running bach. 
```
# This is the URL where the notebook can find Metabase. If the notebook is not running in Docker
# this will be the same as METABASE_WEB_URL
METABASE_URL="http://localhost:3000"

# this is the URL where the browser can find Metabase.
METABASE_WEB_URL="http://localhost:3000"

# username to login to Metabase. This use must have enough privileges to add/create cards
METABASE_USERNAME="demo@objectiv.io"
METABASE_PASSWORD="metabase1"

# id of added Database
METABASE_DATABASE_ID=2 # objectiv database

# id of collection
METABASE_COLLECTION_ID=2 # 2-objectiv

# id of dashboard to add cards to
METABASE_DASHBOARD_ID=1 # 1-model-hub
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/objectiv/objectiv-analytics/",
    "name": "objectiv-modelhub",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Objectiv B.V.",
    "author_email": "hi@objectiv.io",
    "download_url": "https://files.pythonhosted.org/packages/e0/c2/4360781bad1cfc3458f7392df381a45fcc643fadfe2fcf84e0709737af13/objectiv-modelhub-0.0.13.tar.gz",
    "platform": null,
    "description": "# Open model hub\n\nThe open model hub consists of pre-built models and operations that you can combine to build advanced compound models with little effort. The open model hub is powered by [Bach](https://objectiv.io/docs/modeling/bach/), our python-based modeling library.\n\nVisit [Objectiv Docs](https://objectiv.io/docs/modeling/open-model-hub/) to learn more\n\n## Start modeling with Objectiv\nIf you want to use the open model hub, install the package from Pypi as follows:\n```bash\npip install objectiv-modelhub\n```\nYou are now ready to use the model hub. Either through your own notebooks/code or through our examples.\n\n### Examples\nWe have some example notebooks in the \n[/notebooks/](https://github.com/objectiv/objectiv-analytics/tree/main/notebooks) directory of\nthe repository that demonstrate how you can work with the data in Python. These notebooks can run on _your_\ncollected data. The only thing that might need to be adjusted is how the connection to the database is \nmade (see below). All other instructions live in the README.md in the link above.\n\n### Your own code\nTo use the model hub in your own code, you can import the package and use it to get a Bach DataFrame \n([What is Bach?](https://www.objectiv.io/docs/modeling/bach/what-is-bach/)) to \nperform your operations on. The object can be instantiated as follows, where the `db_url` and `table_name`\nshould be adjusted depending on where the data is stored and how to access it.\n```python\nfrom modelhub import ModelHub\n# instantiate the model hub\nmodelhub = ModelHub(time_aggregation='%Y-%m-%d')\n# get the Bach DataFrame to use with model hub models\ndf = modelhub.get_objectiv_dataframe(db_url='postgresql://user:pass@localhost:5432/database',\n                                     table_name='data')\n```\n\n## Setup development environment\nThis section is only required for development on the objectiv-modelhub package.\n\n```bash\nvirtualenv venv\nsource venv/bin/activate\nexport PYTHONPATH=.\n\n# You probably want to remove objectiv-modelhub if you did not just create a fresh venv\npip uninstall objectiv-modelhub\n\n# This will fail if the postgres lib development headers are not present if so, then on Ubuntu that can\n# be fixed with: sudo apt-get install libpq-dev\npip install -r requirements.txt\n\n# in case your notebook can not find all of the packages you just installed\n# you may also need to create a kernel config for this venv:\n\nipython kernel install --user --name=objectiv_venv\n# now restart the notebook server, and from the kernel menu select 'objectiv_venv'\n```\n\n### PyCharm\n* Mark the following directories as \"Sources root\":\n   1. `/bach/`\n   2. `/modelhub/`\n* Set `modelhub/venv/bin/python` as the default interpreter for the project\n\n\n## Metabase integration\n\nTo enable Objectiv's Metabase integration, there are basically 2 steps:\n\n### 1. Setup connectivity from Metabase to your database\n   \nWithin Metabase, switch to admin mode, and select Databases to add your database (if this has not already been\ndone). Exit admin. \n\nSwitching to the overview, in the section \"our data\" a new database, with the name of the database should be\npresent. If you select the database, a numeric ID will be in the URL, for example: \n\"http://localhost:3000/browse/2-objectiv\", in this case your database ID is 2.\n\nThe collection ID can be obtained in a similar way. From the overview page, select the collection (or create\none first) from \"Our analytics\". This will result in a URL like \"http://localhost:3000/collection/2-objectiv\",\nin this case 2 is your collection ID.\n\nFinally, if you have set up a dashboard, and want cards to be added to that automatically, open the dashboard;\nthe URL should be something like \"http://localhost:3000/dashboard/1-model-hub\", your dashboard ID is 1. This\nis optional.\n\n### 2. Configure Objectiv to communicate with Metabase. \n\nThis works through exporting variables to the environment that is running bach. \n```\n# This is the URL where the notebook can find Metabase. If the notebook is not running in Docker\n# this will be the same as METABASE_WEB_URL\nMETABASE_URL=\"http://localhost:3000\"\n\n# this is the URL where the browser can find Metabase.\nMETABASE_WEB_URL=\"http://localhost:3000\"\n\n# username to login to Metabase. This use must have enough privileges to add/create cards\nMETABASE_USERNAME=\"demo@objectiv.io\"\nMETABASE_PASSWORD=\"metabase1\"\n\n# id of added Database\nMETABASE_DATABASE_ID=2 # objectiv database\n\n# id of collection\nMETABASE_COLLECTION_ID=2 # 2-objectiv\n\n# id of dashboard to add cards to\nMETABASE_DASHBOARD_ID=1 # 1-model-hub\n```\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "The open model hub is a growing collection of data models that you can take, combine and run for product analysis and exploration.",
    "version": "0.0.13",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "58d84e127af3a8b9aba08847d4e8061d",
                "sha256": "fd47158e2ee04e63f5d56c236e0cfe13f7f60a324a1487f0c0a06cfbd2b91503"
            },
            "downloads": -1,
            "filename": "objectiv_modelhub-0.0.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "58d84e127af3a8b9aba08847d4e8061d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 33291,
            "upload_time": "2022-06-23T21:17:07",
            "upload_time_iso_8601": "2022-06-23T21:17:07.252616Z",
            "url": "https://files.pythonhosted.org/packages/25/6a/9737cf7e2be8664fc6e1aaaba152a9e4f6768c86cbe605e2e0e1ab4fbaef/objectiv_modelhub-0.0.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "0e8dca02d80c32c74476ea9a088d5c2b",
                "sha256": "e292d092ea30f81cf89c6f62ba7104ea859dc6a0859b49099ac3c1572a4786f8"
            },
            "downloads": -1,
            "filename": "objectiv-modelhub-0.0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "0e8dca02d80c32c74476ea9a088d5c2b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 47419,
            "upload_time": "2022-06-23T21:17:13",
            "upload_time_iso_8601": "2022-06-23T21:17:13.380568Z",
            "url": "https://files.pythonhosted.org/packages/e0/c2/4360781bad1cfc3458f7392df381a45fcc643fadfe2fcf84e0709737af13/objectiv-modelhub-0.0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-23 21:17:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "objectiv",
    "github_project": "objectiv-analytics",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "objectiv-modelhub"
}
        
Elapsed time: 0.54601s