AkvoResponseGrouper


NameAkvoResponseGrouper JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/akvo/Akvo-ResponseGrouper
SummaryFast-API Response catalog for pre-computed query
upload_time2023-02-02 09:03:20
maintainer
docs_urlNone
authorAkvo
requires_python>=3.8.5
license
keywords akvo data helper pypi package
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Akvo-ResponseGrouper

![PyPI](https://img.shields.io/pypi/v/AkvoResponseGrouper)
[![Build Status](https://github.com/akvo/Akvo-ResponseGrouper/actions/workflows/test.yml/badge.svg)](https://github.com/akvo/Akvo-ResponseGrouper/actions) [![Repo Size](https://img.shields.io/github/repo-size/akvo/Akvo-ResponseGrouper)](https://img.shields.io/github/repo-size/akvo/Akvo-ResponseGrouper) [![Coverage Status](https://coveralls.io/repos/github/akvo/Akvo-ResponseGrouper/badge.svg?branch=main)](https://coveralls.io/github/akvo/Akvo-ResponseGrouper?branch=main) [![Languages](https://img.shields.io/github/languages/count/akvo/Akvo-ResponseGrouper
)](https://img.shields.io/github/languages/count/akvo/Akvo-ResponseGrouper
) [![Issues](https://img.shields.io/github/issues/akvo/Akvo-ResponseGrouper
)](https://img.shields.io/github/issues/akvo/Akvo-ResponseGrouper
) [![Last Commit](https://img.shields.io/github/last-commit/akvo/Akvo-ResponseGrouper/main
)](https://img.shields.io/github/last-commit/akvo/Akvo-ResponseGrouper/main) [![Documentation Status](https://readthedocs.org/projects/Akvo-ResponseGrouper/badge/?version=latest)](https://Akvo-ResponseGrouper.readthedocs.io/en/latest/?badge=latest) [![GitHub license](https://img.shields.io/github/license/akvo/Akvo-ResponseGrouper.svg)](https://github.com/akvo/Akvo-ResponseGrouper/blob/main/LICENSE)

Fast-API Response catalog for pre-computed query

## Install
```
$ pip install AkvoResponseGrouper
```

## Schema Requirements

Please follow [the required schema](https://github.com/akvo/Akvo-ResponseGrouper/blob/main/docs/database.org) before using AkvoResponseGrouper.

## Usage

1. Database Migration

Database migration is the first required step for AkvoResponseGrouper to work. Use the akvo-responsegrouper CLI to migrate all data sources with JSON configuration files to generate Materialized Views that AkvoResponseGrouper can then use.

```bash
$ akvo-responsegrouper
usage: akvo-responsegrouper [-h] [-c CONFIG] [-d]

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        akvo-responsegrouper -c <json_file_config>
  -d, --drop            Drop the ar_category view table
```

2. Router

To get the new endpoint provided by AkvoResponseGrouper, import the collection route to the App by:

```python
from fastapi import FastAPI
from AkvoResponseGrouper.routes import collection_route

app = FastAPI(
    root_path="/",
    title="Akvo Response Grouper Demo",
)

app.include_router(collection_route)

@app.get("/", tags=["Dev"])
def read_main():
    return "OK"
```

3. Query



## Development

### Run Dev Containers

The dev environment contains two containers: FastAPI backend and PostGres db, to run:

```bash
docker compose up -d
```
Before go to the next step, wait until the service started at [http://localhost:5000](http://localhost:5000).

### Seed Necessary Data

In order to debug the data itself. We need to seed the example form and fake datapoints

###
```bash
docker compose exec backend python -m script.seeder_form
docker compose exec backend python -m script.seeder_datapoint <number_of_datapoint>
```

### Migration

Dev environment uses contents that is available in `Akvo-ResponseGrouper/src/AkvoResponseGrouper`. To create the Category Materialized View via CLI in dev environment:

Upgrade:

```bash
python -m AkvoResponseGrouper.cli.migrate -c './sources/category.json'
```

After upgrade, you can see "AkvoResponseGrouper - Collection" is available in API docs, ussualy [http://locahhost:5000/docs](http://localhost:5000/docs) (Depends on the root path api).

Downgrade:
```
python -m AkvoResponseGrouper.cli.migrate -c './sources/category.json'
```

### Teardown
```
docker compose down -v
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/akvo/Akvo-ResponseGrouper",
    "name": "AkvoResponseGrouper",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.5",
    "maintainer_email": "",
    "keywords": "akvo,data,helper,pypi,package",
    "author": "Akvo",
    "author_email": "tech.consultancy@akvo.org",
    "download_url": "https://files.pythonhosted.org/packages/f9/8c/4c9849746cc51c1cd1cc68ff26205dc6286e88a653785e749c3218e70813/AkvoResponseGrouper-1.2.0.tar.gz",
    "platform": null,
    "description": "# Akvo-ResponseGrouper\n\n![PyPI](https://img.shields.io/pypi/v/AkvoResponseGrouper)\n[![Build Status](https://github.com/akvo/Akvo-ResponseGrouper/actions/workflows/test.yml/badge.svg)](https://github.com/akvo/Akvo-ResponseGrouper/actions) [![Repo Size](https://img.shields.io/github/repo-size/akvo/Akvo-ResponseGrouper)](https://img.shields.io/github/repo-size/akvo/Akvo-ResponseGrouper) [![Coverage Status](https://coveralls.io/repos/github/akvo/Akvo-ResponseGrouper/badge.svg?branch=main)](https://coveralls.io/github/akvo/Akvo-ResponseGrouper?branch=main) [![Languages](https://img.shields.io/github/languages/count/akvo/Akvo-ResponseGrouper\n)](https://img.shields.io/github/languages/count/akvo/Akvo-ResponseGrouper\n) [![Issues](https://img.shields.io/github/issues/akvo/Akvo-ResponseGrouper\n)](https://img.shields.io/github/issues/akvo/Akvo-ResponseGrouper\n) [![Last Commit](https://img.shields.io/github/last-commit/akvo/Akvo-ResponseGrouper/main\n)](https://img.shields.io/github/last-commit/akvo/Akvo-ResponseGrouper/main) [![Documentation Status](https://readthedocs.org/projects/Akvo-ResponseGrouper/badge/?version=latest)](https://Akvo-ResponseGrouper.readthedocs.io/en/latest/?badge=latest) [![GitHub license](https://img.shields.io/github/license/akvo/Akvo-ResponseGrouper.svg)](https://github.com/akvo/Akvo-ResponseGrouper/blob/main/LICENSE)\n\nFast-API Response catalog for pre-computed query\n\n## Install\n```\n$ pip install AkvoResponseGrouper\n```\n\n## Schema Requirements\n\nPlease follow [the required schema](https://github.com/akvo/Akvo-ResponseGrouper/blob/main/docs/database.org) before using AkvoResponseGrouper.\n\n## Usage\n\n1. Database Migration\n\nDatabase migration is the first required step for AkvoResponseGrouper to work. Use the akvo-responsegrouper CLI to migrate all data sources with JSON configuration files to generate Materialized Views that AkvoResponseGrouper can then use.\n\n```bash\n$ akvo-responsegrouper\nusage: akvo-responsegrouper [-h] [-c CONFIG] [-d]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c CONFIG, --config CONFIG\n                        akvo-responsegrouper -c <json_file_config>\n  -d, --drop            Drop the ar_category view table\n```\n\n2. Router\n\nTo get the new endpoint provided by AkvoResponseGrouper, import the collection route to the App by:\n\n```python\nfrom fastapi import FastAPI\nfrom AkvoResponseGrouper.routes import collection_route\n\napp = FastAPI(\n    root_path=\"/\",\n    title=\"Akvo Response Grouper Demo\",\n)\n\napp.include_router(collection_route)\n\n@app.get(\"/\", tags=[\"Dev\"])\ndef read_main():\n    return \"OK\"\n```\n\n3. Query\n\n\n\n## Development\n\n### Run Dev Containers\n\nThe dev environment contains two containers: FastAPI backend and PostGres db, to run:\n\n```bash\ndocker compose up -d\n```\nBefore go to the next step, wait until the service started at [http://localhost:5000](http://localhost:5000).\n\n### Seed Necessary Data\n\nIn order to debug the data itself. We need to seed the example form and fake datapoints\n\n###\n```bash\ndocker compose exec backend python -m script.seeder_form\ndocker compose exec backend python -m script.seeder_datapoint <number_of_datapoint>\n```\n\n### Migration\n\nDev environment uses contents that is available in `Akvo-ResponseGrouper/src/AkvoResponseGrouper`. To create the Category Materialized View via CLI in dev environment:\n\nUpgrade:\n\n```bash\npython -m AkvoResponseGrouper.cli.migrate -c './sources/category.json'\n```\n\nAfter upgrade, you can see \"AkvoResponseGrouper - Collection\" is available in API docs, ussualy [http://locahhost:5000/docs](http://localhost:5000/docs) (Depends on the root path api).\n\nDowngrade:\n```\npython -m AkvoResponseGrouper.cli.migrate -c './sources/category.json'\n```\n\n### Teardown\n```\ndocker compose down -v\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Fast-API Response catalog for pre-computed query",
    "version": "1.2.0",
    "project_urls": {
        "Bug Reports": "https://github.com/akvo/Akvo-ResponseGrouper/issues",
        "Documentation": "https://github.com/akvo/Akvo-ResponseGrouper",
        "Homepage": "https://github.com/akvo/Akvo-ResponseGrouper",
        "Source Code": "https://github.com/akvo/Akvo-ResponseGrouper"
    },
    "split_keywords": [
        "akvo",
        "data",
        "helper",
        "pypi",
        "package"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8e99f10364e8b22f2e9f5b2e9ca72c750b7809e1294944c7bf35bd01f41aa3d",
                "md5": "3b9e67abfd93543cb59a4aab22cba1bf",
                "sha256": "45fc7459a604653ad2efa659a4e23fa41817bb270b3157535cae2b92119c51d9"
            },
            "downloads": -1,
            "filename": "AkvoResponseGrouper-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b9e67abfd93543cb59a4aab22cba1bf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.5",
            "size": 25982,
            "upload_time": "2023-02-02T09:03:19",
            "upload_time_iso_8601": "2023-02-02T09:03:19.685132Z",
            "url": "https://files.pythonhosted.org/packages/c8/e9/9f10364e8b22f2e9f5b2e9ca72c750b7809e1294944c7bf35bd01f41aa3d/AkvoResponseGrouper-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f98c4c9849746cc51c1cd1cc68ff26205dc6286e88a653785e749c3218e70813",
                "md5": "a42834d1d2f1987568d787896eb27da5",
                "sha256": "4614032372d5e23dc7c8ebab5697ab42aa6f92c7bd743e7454350e5a5ff15747"
            },
            "downloads": -1,
            "filename": "AkvoResponseGrouper-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a42834d1d2f1987568d787896eb27da5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.5",
            "size": 25199,
            "upload_time": "2023-02-02T09:03:20",
            "upload_time_iso_8601": "2023-02-02T09:03:20.907919Z",
            "url": "https://files.pythonhosted.org/packages/f9/8c/4c9849746cc51c1cd1cc68ff26205dc6286e88a653785e749c3218e70813/AkvoResponseGrouper-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-02 09:03:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "akvo",
    "github_project": "Akvo-ResponseGrouper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "akvoresponsegrouper"
}
        
Elapsed time: 0.09771s