Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condom management features #380

Merged
merged 15 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.project
.spyproject
.pydevproject
.idea
.settings
Expand All @@ -14,3 +15,5 @@ logistics_project/localsettings.py
logistics_project/logistics.log*
logistics_project/apps/malawi/tests/testscripts/*
logistics_project/apps/tanzania/tests/testscripts/*
.spyproject/*
.spyproject/config
8 changes: 8 additions & 0 deletions .spyproject/config/codestyle.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[codestyle]
czue marked this conversation as resolved.
Show resolved Hide resolved
indentation = True
edge_line = True
edge_line_columns = 79

[main]
version = 0.2.0

5 changes: 5 additions & 0 deletions .spyproject/config/defaults/defaults-codestyle-0.2.0.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codestyle]
indentation = True
edge_line = True
edge_line_columns = 79

3 changes: 3 additions & 0 deletions .spyproject/config/defaults/defaults-encoding-0.2.0.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[encoding]
text_encoding = utf-8

4 changes: 4 additions & 0 deletions .spyproject/config/defaults/defaults-vcs-0.2.0.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[vcs]
use_version_control = False
version_control_system =

6 changes: 6 additions & 0 deletions .spyproject/config/defaults/defaults-workspace-0.2.0.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
restore_data_on_startup = True
save_data_on_exit = True
save_history = True
save_non_project_files = False

6 changes: 6 additions & 0 deletions .spyproject/config/encoding.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[encoding]
text_encoding = utf-8

[main]
version = 0.2.0

7 changes: 7 additions & 0 deletions .spyproject/config/vcs.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[vcs]
use_version_control = False
version_control_system =

[main]
version = 0.2.0

12 changes: 12 additions & 0 deletions .spyproject/config/workspace.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[workspace]
restore_data_on_startup = True
save_data_on_exit = True
save_history = True
save_non_project_files = False
project_type = 'empty-project-type'
recent_files = []

[main]
version = 0.2.0
recent_files = []

45 changes: 43 additions & 2 deletions data/cstock-logistics.json
Original file line number Diff line number Diff line change
Expand Up @@ -10216,5 +10216,46 @@
"type": "hf",
"supplied_by": 4473
}
}
]
},
{
"pk": 1,
"model": "logistics.productreporttype",
"fields": {
"id" : 1,
"name" : "stock on hand",
"code" : "soh"
}
},
{
"pk": 2,
"model": "logistics.productreporttype",
"fields": {
"name" : "stock received",
"code" : "rec"
}
},
{
"pk": 3,
"model": "logistics.productreporttype",
"fields": {
"name" : "stock given",
"code" : "give"
}
},
{
"pk": 4,
"model": "logistics.productreporttype",
"fields": {
"name" : "emergency stock on hand",
"code" : "eo"
}
},
{
"pk": 5,
"model": "logistics.productreporttype",
"fields": {
"name" : "loss or adjustment",
"code" : "la"
}
}
]
30 changes: 30 additions & 0 deletions data/districts_points.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
dname,code,longitude,latitude
Balaka,36,35.05315978998695,-15.04847375
Blantyre,29,35.0035694,-15.7862543
Chikwawa,33,34.72283932431507,-16.21538195
Chiladzulu,28,35.20553617052023,-15.754719999999999
Chitipa,01,33.41202427956999,-9.9728541
Dedza,17,34.31965143966403,-14.2374479
Dowa,13,33.7781079828639,-13.53875785
Karonga,02,33.86619181196623,-10.08474695
Kasungu,10,33.472356695915096,-12.992487650000001
Likoma,06,34.734435755418986,-12.066386300000001
Lilongwe,15,33.768144,-13.9875107
Machinga,26,35.60258156267952,-14.902749700000001
Mangochi,25,35.32636243192955,-14.1406247
Mchinji,16,33.020473863724945,-13.782889749999999
Mulanje,32,35.54125499990176,-15.91088
Mwanza,30,34.51465953401936,-15.61360315
Mzimba North,07,33.5843626,-11.8989048
Mzimba South,05,33.5843626,-11.8989048
Neno,37,34.68322049013118,-15.51371825
Nkhatabay,03,34.68322049013118,-15.51371825
Nkhotakota,11,34.032917703204646,-12.8321965
Nsanje,34,35.101108793623865,-16.7199917
Ntcheu,18,34.765831629561944,-14.83041285
Ntchisi,12,33.854627197691315,-13.27698805
Phalombe,35,35.66505231082681,-15.69220705
Rumphi,04,33.85071177603609,-10.790932649999998
Salima,14,34.452369976445496,-13.762898400000001
Thyolo,31,35.14491322382413,-16.128774749999998
Zomba,27,35.3268273,-15.3863208
27 changes: 27 additions & 0 deletions data/facilities_points.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
facility_id,latitude,longitude
2439,-14.98498,34.94959
2440,-14.990816,34.960833
2441,-14.84268,35.17081
2442,-15.05425,34.92264
2443,-14.91088,35.05326
7617,-15.77128,34.98156
7618,-15.77733,34.88548
7621,-15.52963,35.02973
10253,-15.7781,35.03946
10255,-15.80214,35.021
7629,-15.80918,35.01977
10259,-15.817047,35.014587
1910,-13.94454,33.77083
1912,-13.99164, 33.77561
1954,-13.98131,33.82105
1930,-13.77074,33.80477
1947,-14.04389,34.1036
7350,-14.6996,34.9732
7352,-14.36298,35.44253
7365,-14.48191,35.26527
7368,-16.033665667119127,34.98522945745857
7371,-14.3637,35.50221
6519,-13.88028,34.36721
6501,-13.66454,34.38503
6502,-13.98973,34.51545
6512,-13.76214,34.42199
150 changes: 150 additions & 0 deletions data/malawian_names.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
fname,lname
Grace,Banda
Chimwemwe,Phiri
Gift,Nyirenda
Blessings,Chirwa
Mercy,Mwale
Chisomo,Nkhoma
Emmanuel,Mkandawire
Martha,Gondwe
Memory,Kamanga
Mary,Mhango
Alinafe,Munthali
Mphatso,Moyo
Joseph,Mbewe
Esther,Tembo
James,Jere
Peter,Kumwenda
John,Manda
Innocent,Msiska
Chikondi,Ngwira
Patrick,Kaunda
Madalitso,Nyirongo
Ruth,Nkhata
Charles,Mvula
Patricia,Nyasulu
Chifundo,Chisale
Catherine,Gama
Andrew,Mhone
Charity,Kamwendo
Thokozani,Zimba
Kondwani,Soko
Precious,Mtambo
Isaac,Chavula
Steven,Magombo
Agness,Msukwa
Francis,Mphande
Yamikani,Kazembe
Moses,Lungu
Daniel,Chunga
Frank,Shaba
Maria,Mussa
Paul,Kondowe
Annie,Chipeta
George,Longwe
Alice,Nyondo
Christopher,Ngoma
Samuel,Saidi
Elizabeth,Chirambo
Linda,Kachingwe
Beatrice,Msowoya
Richard,Chiwaya
Bertha,Bwanali
Vincent,Luhanga
Stella,Kayira
Lucy,Mtonga
Christina,Samson
Emily,Kayange
Joyce,Harawa
Rose,Malunga
Davie,Hara
Brenda,Mponda
Florence,Kalua
Robert,Chiumia
Gloria,Juma
Loveness,Ngulube
Ellen,Dickson
Ethel,Mwafulirwa
Bridget,Moses
Judith,Zulu
Henry,Chisi
Rabecca,Mumba
Doreen,Ndhlovu
Faith,Chawinga
Felix,Mbale
Getrude,Kaonga
Ireen,Maluwa
Victor,Mwanza
Eunice,Chibwana
William,Maseko
Angella,Mwandira
Victoria,Yohane
Veronica,Mwase
Monica,Mandala
Mirriam,Samuel
Jane,Mughogho
Pilirani,Zgambo
Violet,Saka
Prisca,Tambala
Michael,Botha
Alex,Majawa
Eliza,Masamba
Cecilia,Sichali
Dorothy,Frank
Yohane,Ng'ambi
Mathews,Jumbe
Alfred,Khonje
Magret,Kawonga
Sarah,Maganga
Martin,Makina
Edward,Nkosi
Clement,Singini
Chikumbutso,Gomani
Samson,Mlenga
Esnart,Chimwaza
Mike,Mangani
Kelvin,Mfune
Aubrey,Chilongo
Thomas,Milanzi
Tadala,Kalonga
Bright,Sakala
Tiyamike,Makawa
Evelyn,Thom
Rhoda,Master
Tiwonge,Makwinja
Happy,Chimaliro
Janet,Patrick
Naomi,Kanyenda
Caroline,Kamoto
Dalitso,Chikopa
Chrissy,Chabwera
Gladys,Josephy
Zione,Maulidi
Maxwell,Kambalame
Noel,Ngambi
Vitumbiko,Chinyama
Jonathan,Kaliati
Enock,Matola
Regina,Robert
Austin,Simwaka
Wezzie,Chimwala
David,Matemba
Tionge,Ndalama
Chifuniro,Nkhonjera
Brian,Kaira
Susan,Kanyika
Aaron,Sibale
Maggie,Chima
Patience,Chiona
Amos,Kapalamula
Flora,Bandawe
Shadreck,Kalima
Phillip,Mzumara
Prince,Selemani
Alick,Moffat
Owen,Ng'oma
Nelson,Chimombo
Maureen,Julius
Chipiliro,Kayuni
Fanny,Zuze
Wongani,Simbeye
2 changes: 1 addition & 1 deletion ex-submodules/rapidsms-logistics/logistics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ def get_product(self, product_code):
if the product can't be found.
"""
try:
return Product.objects.get(sms_code__icontains=product_code)
return Product.objects.get(sms_code__iexact=product_code)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like a good change. out of curiosity, do you remember which product / scenario specifically tripped the error that this fixed?

Copy link
Contributor Author

@kmkamoto-ad kmkamoto-ad Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scenario that produced this issue is one where we were reporting stock on hand for the products below. The use of "contains" using either product code "cm" or "cf" would result in more than one record being returned which would then generate an error identifying either of the product codes as not existing

  • Condom-Male with product code cm
  • Condom-Female with product code cf
  • Socially Marketed Condom-Male with product code mcm
  • Socially Marked Condom-Female with product code mcf

except (Product.DoesNotExist, Product.MultipleObjectsReturned):
raise UnknownCommodityCodeError(product_code)

Expand Down
Loading
Loading