forked from project-thea/thea-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pyscopg to package list See merge request project-thea/project-thea-api!4
- Loading branch information
Showing
41 changed files
with
1,450 additions
and
20 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
POSTGRES_DATABASE: thea | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.env | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
image: python:3.11.9 | ||
|
||
stages: | ||
- build | ||
- test | ||
|
||
build: | ||
stage: build | ||
script: | ||
- echo "build" | ||
|
||
test: | ||
stage: test | ||
before_script: | ||
- python --version ; pip --version # For debugging | ||
- pip install virtualenv | ||
- virtualenv venv | ||
- source venv/bin/activate | ||
- pip install tox | ||
- pip install -r requirements.txt | ||
variables: | ||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" | ||
script: | ||
- tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM python:3.11.9 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY requirements.txt /app/ | ||
RUN pip3 install -r requirements.txt | ||
COPY . /app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# project-thea-api | ||
|
||
Welcome to the the project-thea-api! | ||
|
||
## Development | ||
|
||
Start the containers in dev | ||
```bash | ||
docker compose -f docker-compose-dev.yml up -d | ||
``` | ||
|
||
You can use the following commands to view the logs | ||
```bash | ||
docker-composer -f docker-compose-[dev,prod].yml logs --follow --tail 10 project-thea-api | ||
``` | ||
|
||
Add the fixture data to your database | ||
```bash | ||
python manage.py load_all_fixtures | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ApiConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'api' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"model": "api.Disease", | ||
"pk": "167722a9-aa55-4399-8351-61d69f358e23", | ||
"fields": { | ||
"name": "COVID-19", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Disease", | ||
"pk": "167722a9-aa55-4300-8351-61d69f358e23", | ||
"fields": { | ||
"name": "Mumps", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Disease", | ||
"pk": "167722a9-aa55-4399-8353-61d69f358e24", | ||
"fields": { | ||
"name": "Measles", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Disease", | ||
"pk": "167722a9-aa55-4399-8351-61d68d358e23", | ||
"fields": { | ||
"name": "Rubella", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[ | ||
{ | ||
"model": "api.Hotspot", | ||
"pk": "33f982b-64f2-43b3-8aef-6348e8df40b53", | ||
"fields": { | ||
"latitude": 123.6, | ||
"longitude": 87.9, | ||
"datetime": "2024-09-04", | ||
"strength": 20, | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Hotspot", | ||
"pk": "e47fa4cc-5c0e-4211-8ddb-b995edf6e014", | ||
"fields": { | ||
"latitude": 132.6, | ||
"longitude": 27.9, | ||
"datetime": "2024-09-04", | ||
"strength": 20, | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"model": "api.HotspotUserMap", | ||
"pk": "22f982b-64f2-43b3-8aef-6348e8df40b53", | ||
"fields": { | ||
"hotspot":"33f982b-64f2-43b3-8aef-6348e8df40b53", | ||
"user": "809e4ea8-4eae-48f1-acf6-c3c1e3a648c2", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.HotspotUserMap", | ||
"pk": "e47fa4cc-5c0e-8811-8ddb-b995edf6e014", | ||
"fields": { | ||
"hotspot":"e47fa4cc-5c0e-4211-8ddb-b995edf6e014", | ||
"user": "809e4ea8-4eae-48f1-acf6-c3c1e3a648c2", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[ | ||
{ | ||
"model": "api.InfectionRate", | ||
"pk": "33f982b-64f2-43b3-8aef-6348e8df40b53", | ||
"fields": { | ||
"hotspot":"e47fa4cc-5c0e-4211-8ddb-b995edf6e014", | ||
"date": "2024-09-04", | ||
"num_of_drivers_exposed": 20, | ||
"num_of_drivers_infected": 12, | ||
"transmission_rate": 0.6, | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.InfectionRate", | ||
"pk": "48a49255-ee82-4c9c-ae6e-a86f069e9f62", | ||
"fields": { | ||
"hotspot":"e47fa4cc-5c0e-4211-8ddb-b995edf6e014", | ||
"date": "2024-09-04", | ||
"num_of_drivers_exposed": 20, | ||
"num_of_drivers_infected": 12, | ||
"transmission_rate": 0.6, | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"model": "api.Location", | ||
"pk": "33f982b-64f2-43b3-8aef-6348e8df40b53", | ||
"fields": { | ||
"latitude": 123.6, | ||
"longitude": 87.9, | ||
"user": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Location", | ||
"pk": "e47fa4cc-5c0e-4211-8ddb-b995edf6e014", | ||
"fields": { | ||
"latitude": 132.6, | ||
"longitude": 27.9, | ||
"user": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"model": "api.Result", | ||
"pk": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"fields": { | ||
"user": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"result_status": "Negative", | ||
"test_id": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"test_center": "Kampala Hospital", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Result", | ||
"pk": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"fields": { | ||
"user": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"result_status": "Positive", | ||
"test_id": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"test_center": "Kirombe Health Center IV", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Result", | ||
"pk": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"fields": { | ||
"user": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"result_status": "Negative", | ||
"test_id": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"test_center": "Busia POE Clinic", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"model": "api.Test", | ||
"pk": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"fields": { | ||
"user": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"disease_id": "167722a9-aa55-4399-8351-61d69f358e23", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Test", | ||
"pk": "8b0a407b-f659-4f29-9cd1-5949b46392c9", | ||
"fields": { | ||
"user": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"disease_id": "167722a9-aa55-4399-8351-61d69f358e23", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.Test", | ||
"pk": "809e4ea8-4eae-48f1-acf6-c3c1e3a648c2", | ||
"fields": { | ||
"user": "809e4ea8-4eae-48f1-acf6-c3c1e3a648c2", | ||
"disease_id": "167722a9-aa55-4399-8351-61d69f358e23", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[ | ||
{ | ||
"model": "api.User", | ||
"pk": "167733a9-aa55-4399-8351-61d69f358e23", | ||
"fields": { | ||
"name": "Okello Gabriel", | ||
"email": "[email protected]", | ||
"password": "pbkdf2_sha256$870000$ar4a27h4fUytXHQatOijs5$Thm9y0bzdlELav7gvJJxIHECvtClP/vP1igHK1yNp9s=", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.User", | ||
"pk": "8b0a407b-f659-4f29-9cd1-5949b46392c9", | ||
"fields": { | ||
"name": "Ashaba Christine", | ||
"email": "[email protected]", | ||
"password": "pbkdf2_sha256$870000$6GRxv3WkioZZ3NUHgngmtq$kgxA8i3C7U+UteyeaLsq8jvAOjxz4hJ1aCCSpV5DdEU=", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
}, | ||
{ | ||
"model": "api.User", | ||
"pk": "809e4ea8-4eae-48f1-acf6-c3c1e3a648c2", | ||
"fields": { | ||
"name": "Kimuli Ivan", | ||
"email": "[email protected]", | ||
"password": "pbkdf2_sha256$870000$72XEj1Zx0dyiT5nlsQiWm0$Lsk6yYWXqCelV5UojvHa0atBLpN1j+HJVWndLjPbjoY=", | ||
"created_at": "2024-09-04 12:16:10.443782+00", | ||
"modified_at": "2024-09-04 12:16:10.443782+00" | ||
} | ||
} | ||
] |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.core.management import call_command | ||
|
||
class Command(BaseCommand): | ||
help = 'Load all fixtures' | ||
|
||
def handle(self, *args, **kwargs): | ||
fixtures = [ | ||
'users.json', | ||
'locations.json', | ||
'diseases.json', | ||
'tests.json', | ||
'results.json', | ||
'hotspots.json', | ||
'hotspotusermaps.json', | ||
# 'infectionrates.json' | ||
] | ||
for fixture in fixtures: | ||
call_command('loaddata', fixture) | ||
self.stdout.write(self.style.SUCCESS(f'Loaded fixture: {fixture}')) |
Oops, something went wrong.