Django query layer that constructs Django ORM aggregation, filteration and sorting queries based on API queryparams. This exposes dataset via REST API for demonstration.
Made using Django, Postgresql
What things you need to install the software and how to install them
Pipenv (Optional https://docs.pipenv.org/en/latest/)
Django==2.2.3
psycopg2==2.8.3
A step by step series of examples that tell you how to get a development env running
Say what the step will be
$ pip install --user pipenv (optional, pip only would work just fine)
$ pipenv install
Set up data and migrations
$ pipenv shell (virtualenv)
$ cd adjust/adjust
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py shell
>>> from adjust_api.utils import insert_data
>>> insert_data()
End with an example of getting some data out of the system or using it for a little demo
- Show the number of impressions and clicks that occurred before the 1st of June 2017, broken down by channel and country, sorted by clicks in descending order.
v1/analytics?date_to=2017-06-01&values=channel,country&sum=impressions,clicks&sortby=clicks
- Show the number of installs that occurred in May of 2017 on iOS, broken down by date, sorted by date in ascending order.
v1/analytics?date_from=2017-05-01&os=ios&values=date&sum=installs&sortby=date
- Show revenue, earned on June 1, 2017 in US, broken down by operating system and sorted by revenue in descending order.
v1/analytics?date=2017-06-01&country=us&values=os&sum=revenue&sortby=revenue
- Show CPI and spend for Canada (CA) broken down by channel ordered by CPI in descending order.
v1/analytics?country=ca&values=channel&sum=cpi&sortby=cpi
Get queries have a certain structure associated which is associated with Django ORM.
os=ios
country=CA
date_to=2017-06-01
values=channel,country
sum = impressions,clicks
count = impressions
avg = revenue
sortby = revenue
order = - (for ascending)
python manage.py tests
Anshul