diff --git a/src/App.css b/src/App.css
index a87bfd0..f27d915 100644
--- a/src/App.css
+++ b/src/App.css
@@ -100,7 +100,7 @@ body {
}
.last-update {
- margin-right: 0.3vw;
+ margin-right: 10vw;
}
@media screen and (min-width: 320px) {
diff --git a/src/App.js b/src/App.js
index 67be8cd..93aef7e 100644
--- a/src/App.js
+++ b/src/App.js
@@ -7,7 +7,7 @@ import { getAnalytics } from "firebase/analytics";
import { getFirestore, collection, getDocs, doc, onSnapshot, query } from "firebase/firestore";
import Card from './components/Card';
-// dev and test
+// /* dev and test */
// const firebaseConfig = {
// apiKey: "AIzaSyBFl_YkJ5PMIvMY3G70313SyrqemjFnUv8",
// authDomain: "hpos-af3cc.firebaseapp.com",
@@ -19,7 +19,7 @@ import Card from './components/Card';
// };
-// prod
+/* prod */
const firebaseConfig = {
apiKey: "AIzaSyBF4pLZReAedU4dWX1eRJNFNIaOIz2xk4s",
authDomain: "hpos-prod.firebaseapp.com",
@@ -41,6 +41,7 @@ function App() {
const [totalScreened, setTotalScreened] = useState(0);
const [males, setMales] = useState(0);
const [females, setFemales] = useState(0);
+ const [normal, setNormal] = useState(0);
const [positives, setPositives] = useState(0);
const [traits, setTraits] = useState(0);
const [diseases, setDiseases] = useState(0);
@@ -77,12 +78,16 @@ function App() {
const unsub = onSnapshot(q, (querySnapshot) => {
const hposTests = [];
+ let normalCount = 0;
let traitCount = 0;
let diseaseCount = 0;
querySnapshot.forEach((document) => {
const hposTestData = document.data();
hposTests.push(hposTestData);
const { result } = hposTestData;
+ if (result === "NORMAL") {
+ normalCount++;
+ }
if (result === 'SICKLECELLTRAIT') {
traitCount++;
}
@@ -90,6 +95,7 @@ function App() {
diseaseCount++;
}
});
+ setNormal(normalCount);
setPositives(traitCount + diseaseCount);
setTraits(traitCount);
setDiseases(diseaseCount);
@@ -128,7 +134,7 @@ function App() {
-
+
diff --git a/src/components/DeviceGraph.css b/src/components/DeviceGraph.css
new file mode 100644
index 0000000..f002722
--- /dev/null
+++ b/src/components/DeviceGraph.css
@@ -0,0 +1,14 @@
+.line {
+ fill: none;
+ stroke: #009EDC;
+ stroke-width: 5px;
+ }
+
+ .graph-card {
+ width: 80vw;
+ background-color: white;
+ }
+
+ .graph-title {
+ text-align: center;
+ }
\ No newline at end of file
diff --git a/src/components/DeviceGraph.js b/src/components/DeviceGraph.js
index fffb179..15fa033 100644
--- a/src/components/DeviceGraph.js
+++ b/src/components/DeviceGraph.js
@@ -1,11 +1,130 @@
-import React, { useEffect, useState } from 'react';
+import React, { Component } from 'react';
+import * as d3 from 'd3';
+import './DeviceGraph.css';
-function DeviceGraph() {
- return (
-
- Hi
-
- )
+class DeviceGraph extends Component {
+
+ componentDidMount() {
+ this.drawChart();
+ }
+
+ drawChart() {
+ var margin = { top: 20, right: 20, bottom: 30, left: 50 },
+ width = 960 - margin.left - margin.right,
+ height = 500 - margin.top - margin.bottom;
+
+ // set the ranges
+ var x = d3.scaleTime().range([0, width]);
+ var y = d3.scaleLinear().range([height, 0]);
+
+ // define the line
+ var valueline = d3.line()
+ .x(function (d) { return x(d.wavelength); })
+ .y(function (d) { return y(d.calculation); });
+
+ // append the svg obgect to the body of the page
+ // appends a 'group' element to 'svg'
+ // moves the 'group' element to the top left margin
+ var svg = d3.select("#wavelength-graph").append("svg")
+ .attr("width", width + margin.left + margin.right)
+ .attr("height", height + margin.top + margin.bottom)
+ .append("g").attr("transform",
+ "translate(" + margin.left + "," + margin.top + ")");
+
+ // d3.csv("https://thingproxy.freeboard.io/fetch/https://firebasestorage.googleapis.com/v0/b/hpos-af3cc.appspot.com/o/255668896558B%204DDG%2FHPOSSC_255668896558B%204DDG.csv?alt=media&token=d63d0e5f-0845-4cb6-98c6-cbfb6904cfd7", function (error, data) {
+ // alert(data.length)
+ // // var data = [
+ // // {
+ // // "year": 2006,
+ // // "population": 40
+ // // },
+ // // {
+ // // "year": 2008,
+ // // "population": 45
+ // // },
+ // // {
+ // // "year": 2010,
+ // // "population": 48
+ // // },
+ // // {
+ // // "year": 2012,
+ // // "population": 51
+ // // },
+ // // {
+ // // "year": 2014,
+ // // "population": 53
+ // // },
+ // // {
+ // // "year": 2016,
+ // // "population": 57
+ // // },
+ // // {
+ // // "year": 2017,
+ // // "population": 62
+ // // }
+ // // ];
+ // // console.log(data);
+ // // // if (error) throw error;
+ // // // format the data
+ // // data.forEach(function (d) {
+ // // d.year = d.year;
+ // // d.population = +d.population;
+ // // });
+
+ // // // Scale the range of the data
+ // // x.domain(d3.extent(data, function (d) { return d.year; }));
+ // // y.domain([0, d3.max(data, function (d) { return d.population; })]);
+
+ // // // Add the valueline path.
+ // // svg.append("path")
+ // // .data([data])
+ // // .attr("class", "line")
+ // // .attr("d", valueline);
+
+ // // // Add the X Axis
+ // // svg.append("g")
+ // // .attr("transform", "translate(0," + height + ")")
+ // // .call(d3.axisBottom(x));
+
+ // // // Add the Y Axis
+ // // svg.append("g")
+ // // .call(d3.axisLeft(y));
+ // });
+
+
+
+ /* test graph */
+ const testData = require('./testData.json').filter(x => { if (x.NM > 397 && x.NM < 580) return x; });
+
+ testData.forEach(function (d) {
+ d.wavelength = d.NM;
+ d.calculation = +d.CA;
+ });
+
+ x.domain(d3.extent(testData, function (d) { return d.wavelength; }));
+ y.domain([0, d3.max(testData, function (d) { return d.calculation; })]);
+
+ svg.append("path")
+ .data([testData])
+ .attr("class", "line")
+ .attr("d", valueline);
+
+ svg.append("g")
+ .attr("transform", "translate(0," + height + ")")
+ .call(d3.axisBottom(x));
+
+ svg.append("g")
+ .call(d3.axisLeft(y));
+ }
+
+ render() {
+ return (
+
+
+
+
wavelength vs absorbance
+
+
);
+ }
}
-
export default DeviceGraph;
\ No newline at end of file
diff --git a/src/index.js b/src/index.js
index ed85412..307a55d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -16,7 +16,7 @@ const router = createBrowserRouter([
element: ,
},
{
- path: "/devices",
+ path: "/absorbance",
element: ,
}
]);