Skip to main content

Akvo-ResponseGrouper

PyPI Build Status Repo Size Coverage Status Languages Issues Last Commit Documentation Status GitHub license

Fast-API Response catalog for pre-computed query

Install

$ pip install AkvoResponseGrouper

Schema Requirements

Please follow the required schema 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.

$ 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
  1. Router

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

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"
  1. Query

Development

Run Dev Containers

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

docker compose up -d

Before go to the next step, wait until the service started at http://localhost:5000.

Seed Necessary Data

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

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:

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 (Depends on the root path api).

Downgrade:

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

Teardown

docker compose down -v

Release files for AkvoResponseGrouper 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AkvoResponseGrouper 1.2.0
File Size Uploaded
AkvoResponseGrouper-1.2.0.tar.gz 25.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for AkvoResponseGrouper 1.2.0
File Interpreter ABI Platform
AkvoResponseGrouper-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.2 kB

Release files / AkvoResponseGrouper-1.2.0.tar.gz

Download URL AkvoResponseGrouper-1.2.0.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4614032372d5e23dc7c8ebab5697ab42aa6f92c7bd743e7454350e5a5ff15747
BLAKE2b-256 checksum
How to use checksums
f98c4c9849746cc51c1cd1cc68ff26205dc6286e88a653785e749c3218e70813
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / AkvoResponseGrouper-1.2.0-py3-none-any.whl

Download URL AkvoResponseGrouper-1.2.0-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45fc7459a604653ad2efa659a4e23fa41817bb270b3157535cae2b92119c51d9
BLAKE2b-256 checksum
How to use checksums
c8e99f10364e8b22f2e9f5b2e9ca72c750b7809e1294944c7bf35bd01f41aa3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page