cognite-neat


Namecognite-neat JSON
Version 0.88.1 PyPI version JSON
download
home_pagehttps://cognite-neat.readthedocs-hosted.com/
SummaryKnowledge graph transformation
upload_time2024-07-24 11:15:00
maintainerNone
docs_urlNone
authorNikola Vasiljevic
requires_python<4.0,>=3.10
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # kNowlEdge grAph Transformer (NEAT)

[![release](https://img.shields.io/github/actions/workflow/status/cognitedata/neat/release_pypi.yaml?style=for-the-badge)](https://github.com/cognitedata/neat/actions/workflows/release_pypi.yaml)
[![Documentation Status](https://readthedocs.com/projects/cognite-neat/badge/?version=latest&style=for-the-badge)](https://cognite-neat.readthedocs-hosted.com/en/latest/?badge=latest)
[![Github](https://shields.io/badge/github-cognite/neat-green?logo=github&style=for-the-badge)](https://github.com/cognitedata/neat)
[![PyPI](https://img.shields.io/pypi/v/cognite-neat?style=for-the-badge)](https://pypi.org/project/cognite-neat/)
[![Downloads](https://img.shields.io/pypi/dm/cognite-neat?style=for-the-badge)](https://pypistats.org/packages/cognite-neat)
[![Docker Pulls](https://img.shields.io/docker/pulls/cognite/neat?style=for-the-badge)](https://hub.docker.com/r/cognite/neat)
[![GitHub](https://img.shields.io/github/license/cognitedata/neat?style=for-the-badge)](https://github.com/cognitedata/neat/blob/master/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/ambv/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=for-the-badge)](https://github.com/astral-sh/ruff)
[![mypy](https://img.shields.io/badge/mypy-checked-000000.svg?style=for-the-badge&color=blue)](http://mypy-lang.org)

This is python package handles transformation of domain knowledge graphs (more detailed, overarching) to app specific knowledge graphs.
Documenation available at [https://thisisneat.io](https://thisisneat.io).

## Quickstart

### Option 1 - Python Package

`neat` can be installed as a Python package, and a docker image for more robust execution and support such
as `graphdb` for caching. This quickstart guide uses the Python package.

### Option 2 - Docker container

Running NEAT as docker container :
`docker run -p 8000:8000 --name neat cognite/neat:latest`

Runnin NEAT as docker container with local data folder mounted :
`docker run -p 8000:8000 --name neat -v $(shell pwd)/docker/vol_data:/app/data  cognite/neat:latest`

### Installation (Development setup)

Prerequisites:

- `poetry` installed on your system, [see installation](https://python-poetry.org/docs/).
- `npm` installed on your system, [see installation](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- `react-scripts` installed on your system, [`npm i react-scripts`](https://www.npmjs.com/package/react-scripts)

1. Clone this repo: `git clone git@github.com:cognitedata/neat.git`
2. Create wheel: `make build-python`. This will create a wheel in the `dist` folder.
3. Install wheel in your preferred environment, `pip install dist/neat-[NEAT_VERSTION]-py3-none-any.whl`

### Run Neat (Python Package)

Once installed you can run neat with the command

```bash
neat
```

This will open your browser and launch the neat application.

Note this will automatically create a `data` folder in your current working directory, which is populated
with default workflows, rule sheets, and source graphs. In addition, there is a `config.yaml` you can add
your CDF credentials to allow `neat` access CDF.

![launch_neat](https://user-images.githubusercontent.com/60234212/228812422-c5e9519f-19e7-4f08-9617-66a790323c7e.gif)

## Documentation

[Documentation](https://cognite-neat.readthedocs-hosted.com/en/latest/)

![](./docs/figs/high-level-io.png)

## Docker container build process

`make build-docker`

## Starting the application locally using GraphDB as external rdf store

Run the command :

` make compose-up`

The command starts NEAT container and GraphDB container and creates _vol_data_ and _vol_shared_ local folders that are mounted as volumes.

_vol_data_ - is mounted only in NEAT container. It contains `config.yaml`, `workflows`, `rules`. You can set `load_examples` to `true` to populate it with examples.

_vol_shared_ - is mounted to both containers and files placed here become automatically visible for GraphDB import process. Main intension is to write files from NEAT container and make them available for GraphDB for import.

## Web UI

`http://localhost:8000`

Open API docs :

`http://localhost:8000/docs`


## Workflows and configurations

All configurations are divided into 2 categories :

- global configurations - global for entire service , loaded at startup (config.yaml)
- workflow configurations - local to workflow , loaded from workflow manifest (.yaml)

## Global configurations

Global configurations loaded by the application during startup process, either from ENV variables or file.

The application tries to load the configuration as follows.

1. Try ENV variables. This is done by checking for the ENV variable `NEAT_CDF_PROJECT`, and if it exists load the rest
   as they are listed below.
2. Try from file. This is done by checking the ENV variable `NEAT_CONFIG_PATH`, which defaults to `$(cwd)/config.yaml`,
   for a path. The config file es expected to have the structure as shown below.
3. Exit. It the ENV variable `NEAT_CDF_PROJECT` and the config file does not exist, the applications exists.

### Env Variables

- NEAT_CDF_PROJECT
- NEAT_CDF_CLIENT_NAME
- NEAT_CDF_CLIENT_ID
- NEAT_CDF_CLIENT_SECRET
- NEAT_CDF_BASE_URL
- NEAT_CDF_TOKEN_URL
- NEAT_CDF_SCOPES
- NEAT_WORKFLOW_DOWNLOADER_FILTER - list of workflows or tags that must be loaded from CDF automatically during startup
- NEAT_DATA_PATH - local directory for workflow and rules storage
- NEAT_CDF_DEFAULT_DATASET_ID - default dataset id that is used for sharing workflows, rules fies and execution traces
- NEAT_LOG_LEVEL - supported logging levels `DEBUG` , `INFO` (default)

### Config file

```yaml
workflows_store_type: file
data_store_path: /app/data

cdf_client:
  project: get-power-grid
  client_id: "623c2450-cfc2-43d6-9036-10e14dad8ccf"
  client_secret: "my-super-secret"
  base_url: https://az-power-no-northeurope.cognitedata.com
  scopes: [https://az-power-no-northeurope.cognitedata.com/.default]
  token_url: https://login.microsoftonline.com/e55e1701-82f8-4c52-af10-28e4d942c589/oauth2/v2.0/token

cdf_default_dataset_id: 2626756768281823
workflow_downloader_filter:
  - tag:grid
log_level: DEBUG
```

## Automatic workflow loading from CDF during application startup

If `workflow_downloader_filter` is set, the app will try to download workflows from CDF based on provided filtering conditions .
Filtering format :

- `name:<workflows_name>=<workflow_version>` - loading workflow by name and version or latest by name if version is not set.
- `tag:<tag_name>`- loading all workflows that tagged with specific tag.


            

Raw data

            {
    "_id": null,
    "home_page": "https://cognite-neat.readthedocs-hosted.com/",
    "name": "cognite-neat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Nikola Vasiljevic",
    "author_email": "nikola.vasiljevic@cognite.com",
    "download_url": "https://files.pythonhosted.org/packages/4a/46/9c2774e1d90cd9395085c6e17936fbd391ccf0a3c4b3e2309a2c4d0dccdf/cognite_neat-0.88.1.tar.gz",
    "platform": null,
    "description": "# kNowlEdge grAph Transformer (NEAT)\n\n[![release](https://img.shields.io/github/actions/workflow/status/cognitedata/neat/release_pypi.yaml?style=for-the-badge)](https://github.com/cognitedata/neat/actions/workflows/release_pypi.yaml)\n[![Documentation Status](https://readthedocs.com/projects/cognite-neat/badge/?version=latest&style=for-the-badge)](https://cognite-neat.readthedocs-hosted.com/en/latest/?badge=latest)\n[![Github](https://shields.io/badge/github-cognite/neat-green?logo=github&style=for-the-badge)](https://github.com/cognitedata/neat)\n[![PyPI](https://img.shields.io/pypi/v/cognite-neat?style=for-the-badge)](https://pypi.org/project/cognite-neat/)\n[![Downloads](https://img.shields.io/pypi/dm/cognite-neat?style=for-the-badge)](https://pypistats.org/packages/cognite-neat)\n[![Docker Pulls](https://img.shields.io/docker/pulls/cognite/neat?style=for-the-badge)](https://hub.docker.com/r/cognite/neat)\n[![GitHub](https://img.shields.io/github/license/cognitedata/neat?style=for-the-badge)](https://github.com/cognitedata/neat/blob/master/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/ambv/black)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=for-the-badge)](https://github.com/astral-sh/ruff)\n[![mypy](https://img.shields.io/badge/mypy-checked-000000.svg?style=for-the-badge&color=blue)](http://mypy-lang.org)\n\nThis is python package handles transformation of domain knowledge graphs (more detailed, overarching) to app specific knowledge graphs.\nDocumenation available at [https://thisisneat.io](https://thisisneat.io).\n\n## Quickstart\n\n### Option 1 - Python Package\n\n`neat` can be installed as a Python package, and a docker image for more robust execution and support such\nas `graphdb` for caching. This quickstart guide uses the Python package.\n\n### Option 2 - Docker container\n\nRunning NEAT as docker container :\n`docker run -p 8000:8000 --name neat cognite/neat:latest`\n\nRunnin NEAT as docker container with local data folder mounted :\n`docker run -p 8000:8000 --name neat -v $(shell pwd)/docker/vol_data:/app/data  cognite/neat:latest`\n\n### Installation (Development setup)\n\nPrerequisites:\n\n- `poetry` installed on your system, [see installation](https://python-poetry.org/docs/).\n- `npm` installed on your system, [see installation](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)\n- `react-scripts` installed on your system, [`npm i react-scripts`](https://www.npmjs.com/package/react-scripts)\n\n1. Clone this repo: `git clone git@github.com:cognitedata/neat.git`\n2. Create wheel: `make build-python`. This will create a wheel in the `dist` folder.\n3. Install wheel in your preferred environment, `pip install dist/neat-[NEAT_VERSTION]-py3-none-any.whl`\n\n### Run Neat (Python Package)\n\nOnce installed you can run neat with the command\n\n```bash\nneat\n```\n\nThis will open your browser and launch the neat application.\n\nNote this will automatically create a `data` folder in your current working directory, which is populated\nwith default workflows, rule sheets, and source graphs. In addition, there is a `config.yaml` you can add\nyour CDF credentials to allow `neat` access CDF.\n\n![launch_neat](https://user-images.githubusercontent.com/60234212/228812422-c5e9519f-19e7-4f08-9617-66a790323c7e.gif)\n\n## Documentation\n\n[Documentation](https://cognite-neat.readthedocs-hosted.com/en/latest/)\n\n![](./docs/figs/high-level-io.png)\n\n## Docker container build process\n\n`make build-docker`\n\n## Starting the application locally using GraphDB as external rdf store\n\nRun the command :\n\n` make compose-up`\n\nThe command starts NEAT container and GraphDB container and creates _vol_data_ and _vol_shared_ local folders that are mounted as volumes.\n\n_vol_data_ - is mounted only in NEAT container. It contains `config.yaml`, `workflows`, `rules`. You can set `load_examples` to `true` to populate it with examples.\n\n_vol_shared_ - is mounted to both containers and files placed here become automatically visible for GraphDB import process. Main intension is to write files from NEAT container and make them available for GraphDB for import.\n\n## Web UI\n\n`http://localhost:8000`\n\nOpen API docs :\n\n`http://localhost:8000/docs`\n\n\n## Workflows and configurations\n\nAll configurations are divided into 2 categories :\n\n- global configurations - global for entire service , loaded at startup (config.yaml)\n- workflow configurations - local to workflow , loaded from workflow manifest (.yaml)\n\n## Global configurations\n\nGlobal configurations loaded by the application during startup process, either from ENV variables or file.\n\nThe application tries to load the configuration as follows.\n\n1. Try ENV variables. This is done by checking for the ENV variable `NEAT_CDF_PROJECT`, and if it exists load the rest\n   as they are listed below.\n2. Try from file. This is done by checking the ENV variable `NEAT_CONFIG_PATH`, which defaults to `$(cwd)/config.yaml`,\n   for a path. The config file es expected to have the structure as shown below.\n3. Exit. It the ENV variable `NEAT_CDF_PROJECT` and the config file does not exist, the applications exists.\n\n### Env Variables\n\n- NEAT_CDF_PROJECT\n- NEAT_CDF_CLIENT_NAME\n- NEAT_CDF_CLIENT_ID\n- NEAT_CDF_CLIENT_SECRET\n- NEAT_CDF_BASE_URL\n- NEAT_CDF_TOKEN_URL\n- NEAT_CDF_SCOPES\n- NEAT_WORKFLOW_DOWNLOADER_FILTER - list of workflows or tags that must be loaded from CDF automatically during startup\n- NEAT_DATA_PATH - local directory for workflow and rules storage\n- NEAT_CDF_DEFAULT_DATASET_ID - default dataset id that is used for sharing workflows, rules fies and execution traces\n- NEAT_LOG_LEVEL - supported logging levels `DEBUG` , `INFO` (default)\n\n### Config file\n\n```yaml\nworkflows_store_type: file\ndata_store_path: /app/data\n\ncdf_client:\n  project: get-power-grid\n  client_id: \"623c2450-cfc2-43d6-9036-10e14dad8ccf\"\n  client_secret: \"my-super-secret\"\n  base_url: https://az-power-no-northeurope.cognitedata.com\n  scopes: [https://az-power-no-northeurope.cognitedata.com/.default]\n  token_url: https://login.microsoftonline.com/e55e1701-82f8-4c52-af10-28e4d942c589/oauth2/v2.0/token\n\ncdf_default_dataset_id: 2626756768281823\nworkflow_downloader_filter:\n  - tag:grid\nlog_level: DEBUG\n```\n\n## Automatic workflow loading from CDF during application startup\n\nIf `workflow_downloader_filter` is set, the app will try to download workflows from CDF based on provided filtering conditions .\nFiltering format :\n\n- `name:<workflows_name>=<workflow_version>` - loading workflow by name and version or latest by name if version is not set.\n- `tag:<tag_name>`- loading all workflows that tagged with specific tag.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Knowledge graph transformation",
    "version": "0.88.1",
    "project_urls": {
        "Documentation": "https://cognite-neat.readthedocs-hosted.com/",
        "Homepage": "https://cognite-neat.readthedocs-hosted.com/",
        "Repository": "https://github.com/cognitedata/neat"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "94b9b268e6732c65c136ecea2289845e53512bfbcb2813ec2670536547207afa",
                "md5": "f0a76e7380c984b136ddc0995ad13b8d",
                "sha256": "b3e5cc1a6e149ae0ed62af3aa1bac51635b8b2a3db350b5be65436cf4029414f"
            },
            "downloads": -1,
            "filename": "cognite_neat-0.88.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f0a76e7380c984b136ddc0995ad13b8d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 2019015,
            "upload_time": "2024-07-24T11:14:56",
            "upload_time_iso_8601": "2024-07-24T11:14:56.737484Z",
            "url": "https://files.pythonhosted.org/packages/94/b9/b268e6732c65c136ecea2289845e53512bfbcb2813ec2670536547207afa/cognite_neat-0.88.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a469c2774e1d90cd9395085c6e17936fbd391ccf0a3c4b3e2309a2c4d0dccdf",
                "md5": "3fb47c8c564acdd3527d89e931f59994",
                "sha256": "f92e14ca3a8cf2482da6b5f30b3a7e7f9cbf972a580d2678fa960b641a732c54"
            },
            "downloads": -1,
            "filename": "cognite_neat-0.88.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3fb47c8c564acdd3527d89e931f59994",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 1925031,
            "upload_time": "2024-07-24T11:15:00",
            "upload_time_iso_8601": "2024-07-24T11:15:00.076278Z",
            "url": "https://files.pythonhosted.org/packages/4a/46/9c2774e1d90cd9395085c6e17936fbd391ccf0a3c4b3e2309a2c4d0dccdf/cognite_neat-0.88.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-24 11:15:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cognitedata",
    "github_project": "neat",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "cognite-neat"
}
        
Elapsed time: 0.28129s