File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed
databank/management/commands/sources Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
66
77## Unreleased
8+ - Skip FTS_HPC processing when no data
89 - Fix TypeError of /api/v1/search/
910 - Update Molnix alert status even when no event
1011 - NSIA, ESF, CBF changes in ingest_ns_initiatives
Original file line number Diff line number Diff line change @@ -27,15 +27,25 @@ def prefetch():
2727
2828 g_sheet_data = list (csv .DictReader (io .StringIO (g_sheet_data .text )))
2929
30- gho_data = {
31- f"{ d ['Country #country+code' ].upper ()} -{ d ['Year #date+year' ]} " : {
32- "people_in_need" : d ["PIN #inneed" ],
33- "people_targeted" : d ["PT #targeted" ],
34- "funding_total_usd" : d ["Funding #value+required+total+usd" ],
35- "funding_required_usd" : d ["Requirements #value+funding+required+usd" ],
36- }
37- for d in g_sheet_data
38- }
30+ gho_data = {}
31+ for d in g_sheet_data :
32+ if (
33+ "Country #country+code" in d
34+ and "Year #date+year" in d
35+ and "PIN #inneed" in d
36+ and "PT #targeted" in d
37+ and "Funding #value+required+total+usd" in d
38+ and "Requirements #value+funding+required+usd" in d
39+ ):
40+ key = f"{ d ['Country #country+code' ].upper ()} -{ d ['Year #date+year' ]} "
41+ gho_data [key ] = {
42+ "people_in_need" : d ["PIN #inneed" ],
43+ "people_targeted" : d ["PT #targeted" ],
44+ "funding_total_usd" : d ["Funding #value+required+total+usd" ],
45+ "funding_required_usd" : d ["Requirements #value+funding+required+usd" ],
46+ }
47+ else :
48+ print (f"Warning: Skipping FTS_HPC data due to missing keys: { d } " )
3949
4050 return gho_data , len (gho_data ), GOOGLE_SHEET_URL
4151
You can’t perform that action at this time.
0 commit comments