michaellupo74 commited on
Commit
370fc0f
Β·
1 Parent(s): 7ac6e43

Merge changes from grants_rag_app: UI, config, and state JSONs

Browse files
app/ui_streamlit.py CHANGED
@@ -284,13 +284,13 @@ default_q = {
284
  q = st.text_input("Search query", value=default_q)
285
 
286
  # No defaults -> no filtering unless the user selects something
287
- geo = st.multiselect("Geo filter (optional)", options=["US", "MD", "MA"], default=[])
288
  categories = st.multiselect(
289
  "Category filter (optional)",
290
  options=[
291
  "capacity_building","elderly","prison_ministry","evangelism",
292
  "transportation","vehicle",
293
- "justice","reentry","victim_services","youth","women","workforce"
294
  ],
295
  default=[]
296
  )
@@ -303,6 +303,8 @@ sort_by = st.selectbox(
303
  index=0,
304
  )
305
  only_open = st.checkbox("Only show opportunities with a future deadline", value=True)
 
 
306
 
307
  # Build filters only when selected
308
  filters = {}
@@ -398,8 +400,71 @@ if sort_by.startswith("Deadline") and results:
398
  _to_date(r.get("deadline")) or date.max,
399
  )
400
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
 
402
  # ---- Render results ----
 
 
 
 
 
 
403
  if results:
404
  st.caption(f"Results: {len(results)}")
405
  for r in results:
 
284
  q = st.text_input("Search query", value=default_q)
285
 
286
  # No defaults -> no filtering unless the user selects something
287
+ geo = st.multiselect("Geo filter (optional)", options=["US", "MD", "PA"], default=[])
288
  categories = st.multiselect(
289
  "Category filter (optional)",
290
  options=[
291
  "capacity_building","elderly","prison_ministry","evangelism",
292
  "transportation","vehicle",
293
+ "justice","reentry","victim_services","youth","women","food","workforce"
294
  ],
295
  default=[]
296
  )
 
303
  index=0,
304
  )
305
  only_open = st.checkbox("Only show opportunities with a future deadline", value=True)
306
+ ministry_focus = st.checkbox("Ministry Focus (hide research/defense/academic BAAs)", value=True)
307
+
308
 
309
  # Build filters only when selected
310
  filters = {}
 
400
  _to_date(r.get("deadline")) or date.max,
401
  )
402
  )
403
+ def _ministry_filter(rows):
404
+ if not rows:
405
+ return rows
406
+
407
+ # Terms that usually mean R&D, military, or academic-only
408
+ banned_terms = [
409
+ "broad agency announcement", "baa",
410
+ "research", "r&d", "prototype", "laboratory", "university",
411
+ "sbir", "sttr",
412
+ "darpa", "office of naval research", "onr", "naval", "air force", "army",
413
+ "w911", "n00014", "fa-", "afrl", "arpa"
414
+ ]
415
+
416
+ # Agencies we’re usually OK highlighting for ministry use
417
+ # (still allow others if content looks practical)
418
+ preferred_agencies = {
419
+ "FTA", "HHS", "ACL", "USDA", "USDA-FNS", "USDA-RD", "DOL", "DOJ", "OJP", "OVW",
420
+ "EDA", "HRSA", "SAMHSA", "CFPB", "HUD"
421
+ }
422
+
423
+ # Positive β€œcommunity-service” cues. If present, we lean to keep even if agency isn’t in the preferred list.
424
+ required_any_terms = [
425
+ "vehicle", "van", "bus", "paratransit", "mobility",
426
+ "congregate meals", "home-delivered meals", "senior nutrition",
427
+ "food pantry", "food bank", "hunger relief", "refrigeration", "freezer",
428
+ "community", "faith", "church", "ministry", "nonprofit",
429
+ "reentry", "workforce", "case management", "technical assistance"
430
+ ]
431
+
432
+ def txt(r):
433
+ return " ".join([
434
+ str(r.get("title","")),
435
+ str(r.get("synopsis") or r.get("summary") or ""),
436
+ str(r.get("agency") or ""),
437
+ ]).lower()
438
+
439
+ kept = []
440
+ for r in rows:
441
+ t = txt(r)
442
+
443
+ # ban obvious R&D/defense/academic
444
+ if any(b in t for b in banned_terms):
445
+ continue
446
+
447
+ # prefer common ministry-friendly agencies or the record’s own tags
448
+ agency = (r.get("agency") or "").upper()
449
+ cats = [c.lower() for c in (r.get("categories") or [])]
450
+ is_preferred_agency = any(agency.startswith(a) for a in preferred_agencies)
451
+ has_ministry_cue = any(term in t for term in required_any_terms) or any(
452
+ c in {"transportation","vehicle","elderly","disabled","food","community","justice","reentry","workforce"} for c in cats
453
+ )
454
+
455
+ if is_preferred_agency or has_ministry_cue:
456
+ kept.append(r)
457
+
458
+ return kept
459
+
460
 
461
  # ---- Render results ----
462
+
463
+ results = st.session_state.get("results", [])
464
+
465
+ if ministry_focus and results:
466
+ results = _ministry_filter(results)
467
+
468
  if results:
469
  st.caption(f"Results: {len(results)}")
470
  for r in results:
config/v6.yaml CHANGED
@@ -1,91 +1,157 @@
1
- # Minimal, valid config β€” v6.2
2
  sources:
3
  - name: "Grants.gov (API: capacity building - general)"
4
  type: grantsgov_api
5
  enabled: true
6
- url: "https://apply07.grants.gov/grantsws/rest/opportunities/search/"
7
  fallback_json: data/grants_fallback_sample.json
8
  geo: "US"
9
- categories:
10
- - capacity_building
11
  api:
12
  page_size: 25
13
  max_pages: 1
14
  payload:
15
  keyword: "capacity building"
16
- oppStatuses: "posted"
17
-
18
- - name: "DOL β€” Reentry & Workforce Capacity"
19
- type: grantsgov_api
20
- enabled: true
21
- url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
22
- geo: "US"
23
- categories: ["justice","reentry","workforce"] # simple, uncluttered tags
24
- api:
25
- page_size: 100
26
- max_pages: 5
27
- payload:
28
- keyword: "reentry workforce employment training apprenticeships transitional jobs capacity building technical assistance"
29
- oppStatuses: ["posted"]
30
- agencies: ["DOL"] # broad DOL umbrella
31
 
32
  - name: "Grants.gov (API: capacity building - vehicles/transportation)"
33
  type: grantsgov_api
34
  enabled: true
35
- url: "https://apply07.grants.gov/grantsws/rest/opportunities/search/"
36
  fallback_json: data/grants_fallback_sample.json
37
  geo: "US"
38
- categories:
39
- - capacity_building
40
- - transportation
41
- - vehicle
42
  api:
43
  page_size: 25
44
  max_pages: 1
45
  payload:
46
  keyword: "capacity building transportation vehicle bus van transit mobility"
47
- oppStatuses: "posted"
48
 
49
  - name: "Grants.gov (API: FTA Section 5310 - Enhanced Mobility)"
50
  type: grantsgov_api
51
  enabled: true
52
- url: "https://apply07.grants.gov/grantsws/rest/opportunities/search/"
53
  fallback_json: data/grants_fallback_sample.json
54
  geo: "US"
55
- categories:
56
- - capacity_building
57
- - elderly
58
- - transportation
59
- - vehicle
60
  api:
61
  page_size: 25
62
  max_pages: 1
63
  payload:
64
- keyword: "5310 Enhanced Mobility Seniors Individuals with Disabilities"
65
- oppStatuses: "posted"
66
- agencyCodes: ["FTA"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
- # --- DOJ / OJP family via Grants.gov ---
69
  - name: "DOJ (All) β€” Capacity/Reentry"
70
  type: grantsgov_api
71
  enabled: true
72
  url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
73
  geo: "US"
74
- categories: ["justice", "reentry"]
75
  api:
76
  page_size: 100
77
  max_pages: 5
78
  payload:
79
  keyword: "capacity building reentry community outreach victim services youth violence prevention"
80
  oppStatuses: ["posted"]
81
- agencies: ["DOJ"] # parent Dept. of Justice
82
 
83
  - name: "OJP (BJA/OJJDP/OVC/BJS) β€” Capacity"
84
  type: grantsgov_api
85
  enabled: true
86
  url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
87
  geo: "US"
88
- categories: ["justice", "victim_services", "youth", "reentry"]
89
  api:
90
  page_size: 100
91
  max_pages: 5
@@ -99,7 +165,7 @@ sources:
99
  enabled: true
100
  url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
101
  geo: "US"
102
- categories: ["justice", "victim_services", "women"]
103
  api:
104
  page_size: 100
105
  max_pages: 5
 
1
+ # Minimal, valid config β€” v6.3
2
  sources:
3
  - name: "Grants.gov (API: capacity building - general)"
4
  type: grantsgov_api
5
  enabled: true
6
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
7
  fallback_json: data/grants_fallback_sample.json
8
  geo: "US"
9
+ categories: ["capacity_building"]
 
10
  api:
11
  page_size: 25
12
  max_pages: 1
13
  payload:
14
  keyword: "capacity building"
15
+ oppStatuses: ["posted"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  - name: "Grants.gov (API: capacity building - vehicles/transportation)"
18
  type: grantsgov_api
19
  enabled: true
20
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
21
  fallback_json: data/grants_fallback_sample.json
22
  geo: "US"
23
+ categories: ["capacity_building","transportation","vehicle"]
 
 
 
24
  api:
25
  page_size: 25
26
  max_pages: 1
27
  payload:
28
  keyword: "capacity building transportation vehicle bus van transit mobility"
29
+ oppStatuses: ["posted"]
30
 
31
  - name: "Grants.gov (API: FTA Section 5310 - Enhanced Mobility)"
32
  type: grantsgov_api
33
  enabled: true
34
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
35
  fallback_json: data/grants_fallback_sample.json
36
  geo: "US"
37
+ categories: ["capacity_building","elderly","transportation","vehicle"]
 
 
 
 
38
  api:
39
  page_size: 25
40
  max_pages: 1
41
  payload:
42
+ keyword: "5310 Enhanced Mobility Seniors Individuals with Disabilities paratransit"
43
+ oppStatuses: ["posted"]
44
+ agencies: ["FTA"] # <-- use 'agencies', not 'agencyCodes'
45
+
46
+ # --- State DOT 5310 (local feeds) ---
47
+ - name: "Maryland β€” 5310 Sub-Recipient Program"
48
+ type: local_sample
49
+ enabled: true
50
+ geo: "MD"
51
+ categories: ["transportation","vehicle","elderly","disabled"]
52
+ path: "data/state_md_5310.json"
53
+
54
+ - name: "Pennsylvania β€” 5310 Sub-Recipient Program"
55
+ type: local_sample
56
+ enabled: true
57
+ geo: "PA"
58
+ categories: ["transportation","vehicle","elderly","disabled"]
59
+ path: "data/state_pa_5310.json"
60
+
61
+ # --- FOOD PROGRAMS / COMMUNITY NUTRITION (ministry-friendly) ---
62
+ - name: "USDA β€” Community Nutrition & Hunger Relief"
63
+ type: grantsgov_api
64
+ enabled: true
65
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
66
+ geo: "US"
67
+ categories: ["food","community","capacity_building"]
68
+ api:
69
+ page_size: 100
70
+ max_pages: 5
71
+ payload:
72
+ keyword: "food bank food pantry emergency food hunger relief community nutrition meal delivery mobile pantry refrigeration freezer cold storage congregate meals SNAP-Ed"
73
+ oppStatuses: ["posted"]
74
+ # agencies: ["USDA","USDA-FNS"] # (optional) uncomment to narrow later
75
+
76
+ - name: "HHS/ACL β€” Senior Nutrition (Older Americans Act)"
77
+ type: grantsgov_api
78
+ enabled: true
79
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
80
+ geo: "US"
81
+ categories: ["food","elderly","community"]
82
+ api:
83
+ page_size: 100
84
+ max_pages: 5
85
+ payload:
86
+ keyword: "senior nutrition Older Americans Act OAA congregate meals home-delivered meals aging services meal program"
87
+ oppStatuses: ["posted"]
88
+ # agencies: ["HHS-ACL"] # (optional) restrict to ACL
89
+
90
+ - name: "USDA Rural β€” Community Facilities (Food Assets)"
91
+ type: grantsgov_api
92
+ enabled: true
93
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
94
+ geo: "US"
95
+ categories: ["food","community","capacity_building","vehicle"]
96
+ api:
97
+ page_size: 100
98
+ max_pages: 5
99
+ payload:
100
+ keyword: "community facilities kitchen renovation commercial kitchen refrigeration freezer delivery van box truck food distribution"
101
+ oppStatuses: ["posted"]
102
+ # agencies: ["USDA-RD"] # (optional) restrict to Rural Development
103
+
104
+ # ---- NEW: FTA Buses/Facilities (5339 etc.) ----
105
+ - name: "FTA β€” Buses/Bus Facilities (5339) & Paratransit"
106
+ type: grantsgov_api
107
+ enabled: true
108
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
109
+ geo: "US"
110
+ categories: ["transportation","vehicle","elderly"]
111
+ api:
112
+ page_size: 100
113
+ max_pages: 5
114
+ payload:
115
+ keyword: "buses bus facility replacement purchase van paratransit mobility 5339"
116
+ oppStatuses: ["posted"]
117
+ agencies: ["FTA"]
118
+
119
+ # ---- DOL ----
120
+ - name: "DOL β€” Reentry & Workforce Capacity"
121
+ type: grantsgov_api
122
+ enabled: true
123
+ url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
124
+ geo: "US"
125
+ categories: ["justice","reentry","workforce"]
126
+ api:
127
+ page_size: 100
128
+ max_pages: 5
129
+ payload:
130
+ keyword: "reentry workforce employment training apprenticeships transitional jobs capacity building technical assistance"
131
+ oppStatuses: ["posted"]
132
+ agencies: ["DOL"]
133
 
134
+ # ---- DOJ / OJP family ----
135
  - name: "DOJ (All) β€” Capacity/Reentry"
136
  type: grantsgov_api
137
  enabled: true
138
  url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
139
  geo: "US"
140
+ categories: ["justice","reentry"]
141
  api:
142
  page_size: 100
143
  max_pages: 5
144
  payload:
145
  keyword: "capacity building reentry community outreach victim services youth violence prevention"
146
  oppStatuses: ["posted"]
147
+ agencies: ["DOJ"]
148
 
149
  - name: "OJP (BJA/OJJDP/OVC/BJS) β€” Capacity"
150
  type: grantsgov_api
151
  enabled: true
152
  url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
153
  geo: "US"
154
+ categories: ["justice","victim_services","youth","reentry"]
155
  api:
156
  page_size: 100
157
  max_pages: 5
 
165
  enabled: true
166
  url: "https://www.grants.gov/grantsws/rest/opportunities/search/"
167
  geo: "US"
168
+ categories: ["justice","victim_services","women"]
169
  api:
170
  page_size: 100
171
  max_pages: 5
data/state_md_5310.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "opportunities": [
3
+ {
4
+ "opportunityNumber": "MD-5310-2025",
5
+ "opportunityTitle": "Maryland DOT / MTA β€” Section 5310: Enhanced Mobility for Seniors and Individuals with Disabilities",
6
+ "synopsis": "Capital and operating assistance for nonprofit and public agencies providing transportation to older adults and individuals with disabilities. Typical costs include accessible vans, mobility management, driver training, insurance, and maintenance.",
7
+ "agency": "Maryland Department of Transportation (MDOT) / Maryland Transit Administration (MTA)",
8
+ "postedDate": "2025-08-01",
9
+ "closeDate": "2025-10-15",
10
+ "url": "https://<INSERT-OFFICIAL-MD-5310-PAGE>",
11
+ "geo": "MD",
12
+ "categories": ["transportation","vehicle","elderly","disabled"]
13
+ }
14
+ ]
15
+ }
data/state_pa_5310.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "opportunities": [
3
+ {
4
+ "opportunityNumber": "PA-5310-2025",
5
+ "opportunityTitle": "PennDOT β€” Section 5310: Enhanced Mobility for Seniors and Individuals with Disabilities",
6
+ "synopsis": "Funding for accessible vehicles and mobility services for seniors and persons with disabilities. Eligible applicants typically include private nonprofits and public bodies coordinating human service transportation.",
7
+ "agency": "Pennsylvania Department of Transportation (PennDOT)",
8
+ "postedDate": "2025-08-10",
9
+ "closeDate": "2025-10-20",
10
+ "url": "https://<INSERT-OFFICIAL-PA-5310-PAGE>",
11
+ "geo": "PA",
12
+ "categories": ["transportation","vehicle","elderly","disabled"]
13
+ }
14
+ ]
15
+ }