Skip to content

Commit 548ee3e

Browse files
committed
elig components
1 parent b63a5e4 commit 548ee3e

File tree

2 files changed

+49
-18
lines changed

2 files changed

+49
-18
lines changed

script.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@ function buildHierarchy(data) {
5252
roundSize: data[key].RoundSize, // For displaying size rounded, will make this a function later
5353
roundSpend: data[key].RoundSpend, // For displaying spending rounded, will make this a function later
5454
site: data[key].Site, // URL to Mass.gov site for each service
55-
description: data[key].Description, // Description of service, (Testing, not fully added yet)
56-
income: data[key].Income, // Max Income for eligibility (Testing, not fully added yet)
57-
age: data[key].Age, // Age for eligibility, (Testing, not fully added yet)
58-
other: data[key].Other, // Other factor of eligibility, (Testing, not fully added yet)
55+
description: data[key].Description, // Description of service
56+
eligibility: data[key].Elig, // Eligibility criteria
5957
children: []
6058
});
6159
});
60+
6261
dataMap.forEach((value, key) => { // Second pass to link children to their parents
6362
if (value.parent === "Services") { // Check if the node is a child of the root
6463
root.children.push(value); // Add to root's children
@@ -208,22 +207,26 @@ function handleNodeClick(d) {
208207
*/
209208
function displayNodeInfo(data) {
210209
const statisticsDiv = document.getElementById('statistics');
210+
const isAllResidents = data.eligibility === "All Residents"; // For all services file, some services this is not applicable
211+
const eligibility = data.eligibility && typeof data.eligibility === 'object';
212+
211213
statisticsDiv.innerHTML = `
212214
<h2>${data.name}</h2>
213-
<h3><a href="${data.site}">${data.description}</a></h3>
215+
<h3><a href="${data.site}" target="_blank">${data.description}</a></h3>
214216
215217
<p>People: ${data.roundSize}</p>
216218
<p>Spend: $${data.roundSpend}</p>
217219
<p>Department: ${data.department}</p>
218220
221+
${!isAllResidents && eligibility ? `
219222
<h3>Eligibility Criteria</h3>
220-
<p>Max Income: ${data.income}</p>
221-
<p>Age Requirement: ${data.age}</p>
222-
<p>Other Requirements: ${data.other}</p>
223+
<p>Max Income: ${data.eligibility.Income}</p>
224+
<p>Age: ${data.eligibility.Age}</p>
225+
<p>Other: ${data.eligibility.Other}</p>
226+
` : ''}
223227
`;
224228
}
225229

226-
227230
/**
228231
* clearSidebar()
229232
* Clears the content of the sidebar.

services.json

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,29 @@
77
"Department": 0,
88
"Site": "",
99
"RoundSize": "0",
10-
"RoundSpend": "0"
10+
"RoundSpend": "0",
11+
"Description": " ",
12+
"Elig": {
13+
"Income": "20K",
14+
"Age": "21 - 64",
15+
"Other": "N/A"
16+
}
1117
},
1218
"MassHealth": {
1319
"Parent": "Services",
1420
"Size": 2127026,
1521
"Spending": 19170000000,
16-
"Color ": 10,
22+
"Color": 10,
1723
"Department": "EOHHS",
1824
"Site": "https://www.mass.gov/topics/masshealth",
1925
"RoundSize": "2.13M",
2026
"RoundSpend": "19.2B",
21-
"Income": "20K",
2227
"Description": "Massachusets Medicaid",
23-
"Age": "21 - 64",
24-
"Other": "N/A"
28+
"Elig": {
29+
"Income": "$20K",
30+
"Age": "21 - 64 years",
31+
"Other": "N/A"
32+
}
2533
},
2634
"SNAP": {
2735
"Parent": "Services",
@@ -31,7 +39,13 @@
3139
"Department": "DTA",
3240
"Site": "https://www.mass.gov/snap-benefits-formerly-food-stamps",
3341
"RoundSize": "1.08M",
34-
"RoundSpend": "60M"
42+
"RoundSpend": "60M",
43+
"Description": "Supplemental Nutrition Program",
44+
"Elig": {
45+
"Income": "x",
46+
"Age": "x",
47+
"Other": "N/A"
48+
}
3549
},
3650
"LIHEAP": {
3751
"Parent": "Services",
@@ -41,7 +55,13 @@
4155
"Department": "EOHLC",
4256
"Site": "https://www.mass.gov/info-details/learn-about-home-energy-assistance-heap",
4357
"RoundSize": "320K",
44-
"RoundSpend": "150M"
58+
"RoundSpend": "150M",
59+
"Description": "The Massachusetts Low Income Home Energy Assistance Program",
60+
"Elig": {
61+
"Income": "x",
62+
"Age": "x",
63+
"Other": "N/A"
64+
}
4565
},
4666
"SSI": {
4767
"Parent": "Services",
@@ -51,7 +71,13 @@
5171
"Department": "MRC",
5272
"Site": "https://www.mass.gov/info-details/eligibility-for-ssi-and-ssdi",
5373
"RoundSize": "213K",
54-
"RoundSpend": "200M"
74+
"RoundSpend": "200M",
75+
"Description": "Supplemental Security Income",
76+
"Elig": {
77+
"Income": "x",
78+
"Age": "x",
79+
"Other": "N/A"
80+
}
5581
},
5682
"Education": {
5783
"Parent": "Services",
@@ -61,7 +87,9 @@
6187
"Department": "ESE",
6288
"Site": "https://www.mass.gov/orgs/department-of-elementary-and-secondary-education",
6389
"RoundSize": "896K",
64-
"RoundSpend": "524M"
90+
"RoundSpend": "524M",
91+
"Description": "Massachusetts Elementary and Secondary Education",
92+
"Elig": "All Residents"
6593
},
6694
"Other": {
6795
"Parent": "Services",

0 commit comments

Comments
 (0)