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

Bos branch #464

Open
wants to merge 116 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
a53105a
Update README.md
bw1umd Oct 19, 2022
deca243
commit1
bw1umd Oct 19, 2022
ea645c5
commit1
bw1umd Oct 19, 2022
26fe07d
By John
Jzheng-prog Nov 9, 2022
315b191
Update index.html
Jzheng-prog Nov 9, 2022
c74cb30
commit1
bw1umd Nov 10, 2022
0cfb3a2
commit1
bw1umd Nov 10, 2022
c792511
Merge pull request #1 from bw1umd:Bo's-branch
bw1umd Nov 10, 2022
15f8b62
commit1
bw1umd Nov 10, 2022
9ac1273
commit 1
bw1umd Nov 10, 2022
fbcdcfc
Merge pull request #2 from bw1umd:Bo's-branch
bw1umd Nov 10, 2022
7d69e30
minor chnages
Jzheng-prog Nov 23, 2022
779296d
json data button
Jzheng-prog Nov 23, 2022
c30e5cb
page html
Jzheng-prog Nov 27, 2022
c00eeb8
test
bw1umd Nov 29, 2022
d28db38
test
bw1umd Nov 29, 2022
0b07c0b
json data button
bw1umd Nov 30, 2022
95da3eb
test
bw1umd Nov 30, 2022
8c75cc7
minor chnages
Jzheng-prog Nov 23, 2022
d6df120
json data button
Jzheng-prog Nov 23, 2022
0bf674e
page html
Jzheng-prog Nov 27, 2022
065f3bd
test
bw1umd Nov 29, 2022
4058a9c
json data button
bw1umd Nov 30, 2022
a52163e
test
bw1umd Nov 30, 2022
47642f9
commit 1
bw1umd Nov 30, 2022
ade909e
commit 1
bw1umd Nov 30, 2022
436b4ee
Merge pull request #4 from bw1umd/main
bw1umd Nov 30, 2022
36930ae
Merge pull request #5 from bw1umd/bo's-branch
bw1umd Nov 30, 2022
5be0fe7
Merge pull request #6 from bw1umd:Bos
bw1umd Nov 30, 2022
61fef34
commit 1
bw1umd Nov 30, 2022
d66e024
commit 1
bw1umd Nov 30, 2022
631d47f
commit 1
bw1umd Nov 30, 2022
d8ae546
test
Jzheng-prog Nov 30, 2022
f491455
Update apiRoutes.js
Jzheng-prog Nov 30, 2022
782082d
Merge branch 'main' of https://github.com/bw1umd/Project-pgcounty-spe…
Jzheng-prog Nov 30, 2022
82d873d
Update styles.css
Jzheng-prog Nov 30, 2022
5666d43
commit 2
bw1umd Nov 30, 2022
23879cd
data
Jzheng-prog Nov 30, 2022
7455433
chart to viz.
Jzheng-prog Nov 30, 2022
3ec9b8e
commit 1
bw1umd Nov 30, 2022
645c430
commit 1
bw1umd Nov 30, 2022
bb96102
commit 2
bw1umd Nov 30, 2022
b62b59f
c
bw1umd Nov 30, 2022
386b558
not functional
Jzheng-prog Nov 30, 2022
b705b3c
Merge branch 'main' of https://github.com/bw1umd/Project-pgcounty-spe…
Jzheng-prog Nov 30, 2022
94ee3d1
data
Jzheng-prog Dec 1, 2022
2561c8a
number in table
Jzheng-prog Dec 1, 2022
1061c2d
Update script.js
Jzheng-prog Dec 1, 2022
e6ffaa9
test
Jzheng-prog Nov 30, 2022
1217dcc
Update apiRoutes.js
Jzheng-prog Nov 30, 2022
b582a7a
Update styles.css
Jzheng-prog Nov 30, 2022
f890492
data
Jzheng-prog Nov 30, 2022
af77c63
chart to viz.
Jzheng-prog Nov 30, 2022
5ea569d
commit 1
bw1umd Nov 30, 2022
34af169
c
bw1umd Nov 30, 2022
f26329d
co
bw1umd Dec 1, 2022
94dee27
commit 3
bw1umd Dec 1, 2022
27d1d25
center data
Jzheng-prog Dec 1, 2022
e28659e
css
Jzheng-prog Dec 1, 2022
abf400a
minor changes
Jzheng-prog Dec 1, 2022
67e7071
commit 4
bw1umd Dec 1, 2022
0eabc73
commit 5
bw1umd Dec 2, 2022
6d6dfe9
commit 5
bw1umd Dec 2, 2022
7941155
commit 6
bw1umd Dec 2, 2022
142eb5c
commit 5
bw1umd Dec 2, 2022
98be318
commit1
bw1umd Dec 2, 2022
081ff6e
Merge branch 'main' into Bos-Branch
bw1umd Dec 2, 2022
51d46cb
Merge pull request #7 from bw1umd/Bos-Branch
bw1umd Dec 2, 2022
ad0e0be
testing
Jzheng-prog Dec 2, 2022
a7f7765
Merge branch 'main' of https://github.com/bw1umd/Project-pgcounty-spe…
Jzheng-prog Dec 2, 2022
57f6a73
Revert "Merge branch 'main' of https://github.com/bw1umd/Project-pgco…
Jzheng-prog Dec 2, 2022
1e9fc87
commit 5
bw1umd Dec 3, 2022
af098d3
Merge branch 'John'sBranch' into main
bw1umd Dec 3, 2022
45f95c7
commit 5
bw1umd Dec 3, 2022
ba1ffdf
commit 5
bw1umd Dec 3, 2022
fc6437b
working on viz html
Jzheng-prog Dec 3, 2022
f2ef8a6
Merge branch 'main' of https://github.com/bw1umd/Project-pgcounty-spe…
Jzheng-prog Dec 3, 2022
9cac4f1
viz
Jzheng-prog Dec 3, 2022
ae3f252
Update viz.html
Jzheng-prog Dec 4, 2022
3f3c156
minor changes
Jzheng-prog Dec 5, 2022
a37e4a1
commit 5
bw1umd Dec 5, 2022
db5cbaf
commit 5
bw1umd Dec 6, 2022
f6be840
filtering and return the data is hard
Jzheng-prog Dec 7, 2022
721bd92
Update script.js
Jzheng-prog Dec 7, 2022
3193222
commit 6
bw1umd Dec 9, 2022
524e5ce
commit 6
bw1umd Dec 9, 2022
ed43d41
commit 6
bw1umd Dec 9, 2022
ea3b91e
Update data.html
Jzheng-prog Dec 10, 2022
e9a468b
Update script.js
Jzheng-prog Dec 10, 2022
dd0898d
commit 7
bw1umd Dec 10, 2022
e2b5f0f
Update script.js
Jzheng-prog Dec 10, 2022
ed79f5f
commit 7
bw1umd Dec 10, 2022
1e071c2
Create JohnScript.js
Jzheng-prog Dec 10, 2022
43c7e07
commit 8
bw1umd Dec 11, 2022
d8ce579
final sub req
bw1umd Dec 11, 2022
deee3f3
final sub req
bw1umd Dec 11, 2022
1c79253
final sub req
bw1umd Dec 11, 2022
f905e0b
Readme
Jzheng-prog Dec 12, 2022
f5cb75c
Update README.md
Jzheng-prog Dec 12, 2022
153eb60
commit 9
bw1umd Dec 13, 2022
00d8df8
commit 9
bw1umd Dec 13, 2022
c1d7f90
commit 10
bw1umd Dec 15, 2022
06811d6
Delete .vscode directory
bw1umd Dec 15, 2022
f706492
Update data.html
bw1umd Dec 15, 2022
04d9750
Update index.html
bw1umd Dec 15, 2022
41e699e
Update script.js
bw1umd Dec 15, 2022
8f50d7c
Update styles.css
bw1umd Dec 15, 2022
0d4f16a
Update viz.html
bw1umd Dec 15, 2022
b983bbc
Delete server/middleware directory
bw1umd Dec 15, 2022
0cb8bb5
Delete PgSpendingRoutes.js
bw1umd Dec 15, 2022
e506957
Update apiRoutes.js
bw1umd Dec 15, 2022
b47173a
Update finService.js
bw1umd Dec 15, 2022
93fcd42
Update styles.css
bw1umd Dec 16, 2022
9f8cc08
Create viz.js
bw1umd Dec 16, 2022
af38c46
Merge branch 'main' into Bos-Branch
bw1umd Dec 16, 2022
d0f06e7
commit 100
bw1umd Dec 19, 2022
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
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# This is your readme
You are required to fill it in with documentation similar to that found in the Sequelize example for the course as part of your final project.
# Project-pgcounty-spending
# README
- Link to the Github Pages site where things are running
- [Prince George's County Finance](https://main.d3a5z6zabynccq.amplifyapp.com/index.html)
- Title of your project
- Prince George County Finance
- Description of target browsers (iOS? Android? Which ones? Which versions?)
- Our targeted browder is a computer web page. Our app should be inclusive to all browser types.

- Description of your project:
- Data analysis web application of Prince George’s county finance management based on the county’s spending
- Compare data year by year, find trends to see resource allocation, what the sector county focuses on the most, where and what they spend most of their money on, and potentially forecasting future budgets.
- What API did you use, link to the API
- https://data.princegeorgescountymd.gov/Finance-and-Budget/Spending-Information-for-FY-2022/jh2p-ym6a
- https://data.princegeorgescountymd.gov/resource/jh2p-ym6a.json "REST API for 2022"
- What visualisations does your project drive? What visualisation or other JS libraries does your project use?
- Our project uses Chart.js to create visualizations of our data. It can change graph the data into a doughnut chart or bar chart depending on which the user prefer to see.
The visualization can be filtered to see different variables of the data we created, such as filter for payee, agency, zip code, and amoutns specifically.
- What CSS frameworks did you use? What version of them?
- We started out CSS framework from scratch, taking some ideas from past assignments and online searches.
- What is your actual project trying to display and solve?
- Our project aim to visualize the Spendings of Prince Georges County throughout the years. Our request from the API pull data from various years and graph them on a chart. This allow us to see what the budget is going to throughout the years and what we are spending the most on, who we spending it on, and how much we spenidng on them. This could help direct future spendings in the county. It could provide us what needs to be improved or is lacking in development in the county.

### How to use Markdown
Markdown is a text notation system used in Discord, Whatsapp and similar to structure pages without writing HTML at all. You'll be using it for your documentation.
* [Markdown guide](https://www.markdownguide.org/cheat-sheet/)
62 changes: 62 additions & 0 deletions client/data.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<html lang="en-US">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>project-pgcounty-spending</title>
<link rel="stylesheet" href="styles.css">
</head>

<body>
<div class="wrapper">
<header class="header">
<h2 class="header">
Prince George County Finance
<nav class="navbar">
<a href='index.html'>Home</a>
<a href=''>Data</a>
<a href='viz.html'>Visualization</a>
</nav>
</h2>
</header>

<div class="form container">
<div class="left box">
<div class="innr">
<form action="/api" class="sr_form" style="width: 110px">
<div>
<label for="resto">Search</label>
<input type="text" name="resto" id="resto">
</div>
<button type="submit" id="get">Submit & filter</button>
</form>
<h5>Select Year:</h5>
<form action="/api" class="yr_form">
<div class="small" id="butts">
<script>
window.addEventListener('load', (event) => {
addButt('#butts');
});
</script>
</div>
</form>
</div>
</div>
<div class="inner"></div>
<div class="right box">
<div id="yrtitle"></div>
<div class="table" id="rlist">
Loading data from an API...
</div>
</div>
</div>

<div class="footer">
<a href="https://github.com/bw1umd/Project-pgcounty-spending.git">Github</a>
</div>
<script src="./script.js"></script>
</div>
</body>

</html>
62 changes: 58 additions & 4 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,66 @@
<html lang="en">
<html lang="en-US">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Group Project Base</title>
<title>project-pgcounty-spending</title>
<link rel="stylesheet" href="styles.css">
</head>

<body>
<script src="./script.js"></script>
<div class="wrapper">
<div class="header">
<h2 class="header">
Prince George County Finance
<nav class="navbar">
<a href=''>Home</a>
<a href='data.html'>Data</a>
<a href='viz.html'>Visualization</a>
</nav>
</h2>
</div>

<div class="container">
<div class="slides">
<div class="mySlides fade">
<img src="./media/orchard-terrace.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<img src="./media/imrs.php.webp" style="width:100%">
</div>
<script>
let slideIndex = 0;
function showSlides() {
let i;
let slides = document.getElementsByClassName("mySlides");
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slideIndex++;
if (slideIndex > slides.length) { slideIndex = 1 }
slides[slideIndex - 1].style.display = "block";
setTimeout(showSlides, 7000); // Change image every 2 seconds
}
showSlides();
</script>
</div>
<div class="text box">
<h3 15px style="padding-left: 15px;">
Welcome to Prince George county's financial data visualizer!
</h3>
<a>
Click Data button to see the tables
</a>
<a>
Click Visualization button to see the charts
</a>
</div>
</div>

<div class="footer">
<a href="https://github.com/bw1umd/Project-pgcounty-spending.git">Github</a>
</div>
</body>
</html>

</html>
Binary file added client/media/imrs.php.webp
Binary file not shown.
Binary file added client/media/orchard-terrace.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions client/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
function injectHTML(list, htmlelm) {
let target = document.querySelector(htmlelm);
target.innerHTML = '';

// populate table head
const head = document.createElement('tr');
for (const key of Object.keys(list[0])) {
const th = document.createElement('th');
th.innerText = cap(key.replaceAll('_', ' '));
head.appendChild(th);
}
target.appendChild(head);

// populate table content
for (const value of Object.values(list)) {
const tr = document.createElement('tr');
const row = Object.values(value);
row.forEach(element => {
const td = document.createElement('td');
td.innerText = element;
tr.appendChild(td);
});
target.appendChild(tr);
}
console.log('injected');
}

function cap(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}


function getRandInt(min, max) {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min + 1) + min)
}

function filterlist(list, filterInputvalue) {
return list.filter((i) => {
if (!i) { return; }
const lowerCaseName = JSON.stringify(i).toLowerCase();
const lowerCaseQuery = filterInputvalue.toLowerCase();
return lowerCaseName.includes(lowerCaseQuery);
});
}

function addButt(htmlelm) {
const form = document.querySelector(htmlelm);
for (var i = 0; i < 11; i++) {
var div = document.createElement('div');
var btn = document.createElement('input');
var labl = document.createElement('label');
div.className = 'combo';
btn.className = 'radiobutt';
btn.type = 'radio';
btn.name = 'butt';
const year = 2022 - i;
btn.id = year;
btn.value = year;
labl.htmlFor = year;
labl.innerText = year;
if (year === 2022) {
btn.checked = true;
}
div.appendChild(btn);
div.appendChild(labl);
form.appendChild(div);
}
}

async function fetchJson(yr) {
const main = await fetch(`api/finServices/${yr}`);
return await main.json();
}

async function mainEvent() {

// hide button
const submit = document.querySelector('#get');
submit.style.display = 'none';

// show the table
let yrtitle = '2022';
let yr = document.querySelector('.yr_form');
let data = await fetchJson(2022);
injectHTML(data.data, '#rlist');
let table = document.querySelector('#yrtitle');
let title = document.createElement('h2');
title.innerText = 'Data from ' + yrtitle;
table.appendChild(title);

// click button to change the year
yr.addEventListener('input', async (event) => {
event.preventDefault();
data = await fetchJson(event.target.value);
console.log(data.data.length);
if (data.data.length > 0) {
document.querySelector('#rlist')
.addEventListener('load', injectHTML(data.data, '#rlist'));
yrtitle = await event.target.value;
// add table title
title.innerText = 'Data from ' + yrtitle;
table.replaceChild(title);
}
});

// search box
if (data.data.length > 0) {
let search = document.querySelector('.sr_form');
search.addEventListener('input', async (event) => {
console.log(event.target.value)
const flist = await filterlist(data.data, event.target.value);
injectHTML(flist, '#rlist');
});
submit.style.display = 'block';
search.addEventListener('submit', async (event) => {
event.preventDefault();
});
}
}

// run main
document.addEventListener('DOMContentLoaded', async () => mainEvent());

Loading