Skip to content

Commit

Permalink
facilities fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
saladgg committed Jan 10, 2022
1 parent c4adf48 commit 6a6f864
Show file tree
Hide file tree
Showing 13 changed files with 5,951 additions and 5,499 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[run]
branch=True
source=fahari
omit=fahari/config/*,fahari/**/migrations/*,scripts/*,fahari/**/tests/*
omit=fahari/config/*,fahari/**/migrations/*,scripts/*,fahari/**/tests/*,fahari/sims/*

[report]
exclude_lines =
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
- name: mypy
run: |
sudo apt-get update && sudo apt-get upgrade
mypy .
pytest:
Expand Down Expand Up @@ -105,6 +106,7 @@ jobs:
- name: Set up Django
run: |
sudo apt-get update && sudo apt-get upgrade
python manage.py migrate
python manage.py createcachetable
python manage.py collectstatic --noinput
Expand Down
Binary file modified data/all_mfl_facilities.xlsx
Binary file not shown.
Binary file modified data/updated_fyj_facilities.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions fahari/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Mowlem",
"Umoja I",
"Umoja II",
"Utawala",
),
"Kamukunji": (
"Airbase",
Expand Down
2 changes: 1 addition & 1 deletion fahari/common/tests/test_administrative_unit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_get_wards():
assert ("Ziwani/Kariokor", "Ziwani/Kariokor") in wards
assert ("Landimawe", "Landimawe") in wards
assert ("Nairobi South", "Nairobi South") in wards
assert len(wards) == 109
assert len(wards) == 110


def test_get_wards_for_sub_county_with_missing_sub_county():
Expand Down
2 changes: 1 addition & 1 deletion fahari/common/views/mixins/drf_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_excel_io(self, **kwargs) -> EIO:
excel_io_class = self.get_excel_io_class()
default_kwargs = self.get_excel_io_kwargs()
default_kwargs.update(kwargs)
return excel_io_class(**default_kwargs) # type: ignore
return excel_io_class(**default_kwargs)

def get_excel_io_kwargs(self) -> Dict[str, Any]:
"""Return kwargs to be used when initializing an excel io instance."""
Expand Down
2 changes: 1 addition & 1 deletion fahari/misc/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ class ProcessGoogleSheetRowError(RuntimeError):
def __init__(self, row: Sequence[str], row_index: int, *args, **kwargs):
self.row: Sequence[str] = tuple(row)
self.row_index: int = row_index
super().__init__(*args, **kwargs) # type: ignore
super().__init__(*args, **kwargs)
2 changes: 1 addition & 1 deletion fahari/utils/excel_utils/drf_serializer_excel_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_template(self, *args, **kwargs) -> T:
self.get_fields(), self.get_nested_entries_delimiter()
)

return template_class(*args, **kwargs) # type: ignore
return template_class(*args, **kwargs)

def get_template_class(self) -> Type[T]:
"""Return a class to use for the template. Defaults to using `self.template_class`."""
Expand Down
11,429 changes: 5,939 additions & 5,490 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ watchgod~=0.7 # https://github.com/samuelcolvin/watchgod

# Testing
# ------------------------------------------------------------------------------
mypy~=0.910 # https://github.com/python/mypy
mypy~=0.930 # https://github.com/python/mypy
django-stubs~=1.8.0 # https://github.com/typeddjango/django-stubs
pytest~=6.2.4 # https://github.com/pytest-dev/pytest
pytest-sugar~=0.9.4 # https://github.com/Frozenball/pytest-sugar
Expand Down
2 changes: 1 addition & 1 deletion scripts/load_facilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def load_facilities(source_path):
for pos, r in enumerate(records):
if r["Code"] is not None and r["Code"] != "None":
try:
facility, created = Facility.objects.get_or_create(
facility, created = Facility.objects.update_or_create(
mfl_code=r["Code"],
defaults={
"name": r["Name"],
Expand Down
4 changes: 2 additions & 2 deletions scripts/mark_fahari_facilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.core.exceptions import ValidationError

MFL_CODE_COLNAME = "MFL CODE"
MFL_SHEET_NAME = "fyj_sites"
MFL_SHEET_NAME = "fyj_facilities"


def mark_facilities(source_path):
Expand Down Expand Up @@ -40,5 +40,5 @@ def mark_facilities(source_path):
django.setup()

data_dir = os.path.join(base_path, "data")
source_file = os.path.join(data_dir, "updated_fyj_sites.xlsx")
source_file = os.path.join(data_dir, "updated_fyj_facilities.xlsx")
mark_facilities(source_file)

0 comments on commit 6a6f864

Please sign in to comment.