diff --git a/src/App.js b/src/App.js index a2ad37f..06dc12d 100644 --- a/src/App.js +++ b/src/App.js @@ -36,32 +36,10 @@ function App() { const [diseases, setDiseases] = useState(0); useEffect(() => { - if (!mtests.length) { - console.log('mtests', mtests); - const tests = getTests(); - // setMales(tests.length); - } - }, [mtests]); - useEffect(() => { - // db.collection("patientData").onSnapshot((snapshot) => { - // setCustomersData( - // snapshot.docs.map((doc) => ({ - // id: doc.id, - // data: doc.data(), - // })) - // ); - // console.log(snapshot.docs); - // }); - - // h9JzA73TcJgS3CHmCvT5 const q = query(collection(db, "patientData")); const unsub = onSnapshot(q, (querySnapshot) => { - // const source = doc.metadata.hasPendingWrites ? "Local" : "Server"; - // console.log(source, " data: ", doc.data()); - console.log("snapshot", querySnapshot); - const patients = []; let maleCount = 0; let femaleCount = 0; @@ -69,7 +47,7 @@ function App() { const patient = document.data(); patients.push(patient); console.log("patient", patient); - const {gender} = patient; + const { gender } = patient; if (gender === 'Male') { maleCount++; } @@ -87,22 +65,17 @@ function App() { const q = query(collection(db, "testData")); const unsub = onSnapshot(q, (querySnapshot) => { - // const source = doc.metadata.hasPendingWrites ? "Local" : "Server"; - // console.log(source, " data: ", doc.data()); - console.log("snapshot", querySnapshot); - const hposTests = []; let traitCount = 0; let diseaseCount = 0; querySnapshot.forEach((document) => { const hposTestData = document.data(); hposTests.push(hposTestData); - console.log("hposTestData", hposTestData); - const {result} = hposTestData; - if (result === 'Trait') { + const { result } = hposTestData; + if (result === 'SICKLECELLTRAIT') { traitCount++; } - if (result === 'Disease') { + if (result === 'SICKLECELLDISEASE') { diseaseCount++; } });