cognite-neat


Namecognite-neat JSON
Version 0.100.1 PyPI version JSON
download
home_pagehttps://cognite-neat.readthedocs-hosted.com/
SummaryKnowledge graph transformation
upload_time2024-12-05 06:10:16
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.yaml?style=for-the-badge)](https://github.com/cognitedata/neat/actions/workflows/release.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/b4/8e/8f5a3bcbdf85760e642f3469aff6dbe73f43532dcd4a2325609aa84f60ff/cognite_neat-0.100.1.tar.gz",
    "platform": null,
    "description": "# kNowlEdge grAph Transformer (NEAT)\n\n[![release](https://img.shields.io/github/actions/workflow/status/cognitedata/neat/release.yaml?style=for-the-badge)](https://github.com/cognitedata/neat/actions/workflows/release.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.100.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": "50e40119d9b3f82cf36a30575a0ff5ca80167b1d9f5335dd89c8344830063efd",
                "md5": "5e421b3814e83d5cefdbbdd97c3a322f",
                "sha256": "37f6ab8e2c75c8430958a126d8ee52cc3fb5fb4d00eb02b84987190be4724c75"
            },
            "downloads": -1,
            "filename": "cognite_neat-0.100.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e421b3814e83d5cefdbbdd97c3a322f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 2750660,
            "upload_time": "2024-12-05T06:10:12",
            "upload_time_iso_8601": "2024-12-05T06:10:12.885858Z",
            "url": "https://files.pythonhosted.org/packages/50/e4/0119d9b3f82cf36a30575a0ff5ca80167b1d9f5335dd89c8344830063efd/cognite_neat-0.100.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b48e8f5a3bcbdf85760e642f3469aff6dbe73f43532dcd4a2325609aa84f60ff",
                "md5": "00dacb1eb5709b3ba7d19e932f5cf9b4",
                "sha256": "31aec2278a7c5b608e3d1c8b009ed25ae21a1d0e2579d38d924c9a6c2e6b194d"
            },
            "downloads": -1,
            "filename": "cognite_neat-0.100.1.tar.gz",
            "has_sig": false,
            "md5_digest": "00dacb1eb5709b3ba7d19e932f5cf9b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 2636975,
            "upload_time": "2024-12-05T06:10:16",
            "upload_time_iso_8601": "2024-12-05T06:10:16.715899Z",
            "url": "https://files.pythonhosted.org/packages/b4/8e/8f5a3bcbdf85760e642f3469aff6dbe73f43532dcd4a2325609aa84f60ff/cognite_neat-0.100.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-05 06:10:16",
    "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.44991s