Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sadeelmu committed May 28, 2024
1 parent 3ff3318 commit 13769a8
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "6B84A23A-1389-48D1-9A35-1E641A7234CA"
type = "0"
version = "2.0">
</Bucket>
6 changes: 2 additions & 4 deletions Asthmaguard/Business/Usecases/AsthmaThreatCalculator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public class AsthmaThreatCalculatorUseCase {
}
}

// MARK: - Data Fetching

// MARK: - Fetch Asthma and Calculate

func fetchDataAndCalculateAsthmaSeverity() {
guard let patientToken = getPatientToken() else {
Expand Down Expand Up @@ -78,7 +79,6 @@ public class AsthmaThreatCalculatorUseCase {
}
}
}

func fetchData() {
guard let patientToken = getPatientToken() else {
print("Current username not available.")
Expand All @@ -102,7 +102,6 @@ public class AsthmaThreatCalculatorUseCase {
}

// MARK: - Biosignal Data

private func fetchBiosignalData(completion: @escaping ([HKQuantitySample]?) -> Void) {
BioSignalData.requestHealthDataAccessIfNeeded { success in
guard success else {
Expand All @@ -123,7 +122,6 @@ public class AsthmaThreatCalculatorUseCase {
}

// MARK: - Environmental Data

private func fetchEnvironmentalData(completion: @escaping (EnviromentalData.AirQualityData?, EnviromentalData.PollenForecastData?) -> Void) {
guard let userLocation = LocationManager.shared.getCurrentLocation() else {
print("User location not available")
Expand Down
1 change: 0 additions & 1 deletion Asthmaguard/Business/Usecases/BioSignalData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class BioSignalData {
}
dispatchGroup.leave()
}

dispatchGroup.enter()
fetchOxygenSaturationSamples { oxygenSaturationSamples, error in
if let oxygenSaturationSamples = oxygenSaturationSamples {
Expand Down
1 change: 1 addition & 0 deletions Asthmaguard/Business/Usecases/WeatherKitData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ class WeatherKitData {
return humiditySeverity + cloudCoverSeverity + temperatureSeverity
}
}

2 changes: 1 addition & 1 deletion Asthmaguard/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
@available(iOS 17.0, *)
struct ContentView: View {
var body: some View {
DashboardView()
RegisterScreen()

}
}
Expand Down
14 changes: 7 additions & 7 deletions Asthmaguard/Presentation/View/AsthmaThreatChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ struct AsthmaThreatChart: View {
asthmaThreatCalculatorUseCase.fetchDataAndCalculateAsthmaSeverity()
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
// Use a delay to allow for data fetching; adjust timing as necessary
self.biosignalRisk = 0.3
self.environmentalRisk = 0.1
self.totalWeightedSeverity = 0.4
self.biosignalRisk = asthmaThreatCalculatorUseCase.weightedBioSignalRisk
self.biosignalRisk = asthmaThreatCalculatorUseCase.weightedBioSignalRisk
self.totalWeightedSeverity = asthmaThreatCalculatorUseCase.totalWeightedSeverity

if totalWeightedSeverity > 0.75 {
showVeryHighThreatActionSheet = true
Expand All @@ -44,7 +44,7 @@ struct AsthmaThreatChart: View {
var body: some View {
NavigationView {
ScrollView(showsIndicators: false) {
VStack(spacing: 20) {
VStack(spacing: 5) {
Text("Dashboard")
.font(Font.custom("Poppins-Bold", size: 18))
.padding(.all)
Expand Down Expand Up @@ -73,13 +73,13 @@ struct AsthmaThreatChart: View {
Spacer()
VStack(spacing: 10) {
NavigationLink(destination: HistoricalDataView(bioSignal: "Respiratory Rate")) {
CustomBioData(bioSignal: "Respiratory Rate", time: "11:55 AM", data: "19 breaths/min")
CustomBioData(bioSignal: "🫁 Respiratory Rate", time: "7:23 PM", data: "20 breaths/min")
}
NavigationLink(destination: HistoricalDataView(bioSignal: "Heart Rate")) {
CustomBioData(bioSignal: "Heart Rate", time: "12:01 PM", data: "96 BPM")
CustomBioData(bioSignal: "🫀 Heart Rate", time: "7:25 PM", data: "90 BPM")
}
NavigationLink(destination: HistoricalDataView(bioSignal: "Blood Oxygen")) {
CustomBioData(bioSignal: "Blood Oxygen", time: "12:03 PM", data: "98.5%")
CustomBioData(bioSignal: "🩸 Blood Oxygen", time: "7:30 PM", data: "97.5%")
}
}
Spacer()
Expand Down
10 changes: 5 additions & 5 deletions Asthmaguard/Presentation/View/HistoricalDataView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ struct HistoricalDataView: View {

var body: some View {
VStack {
Text("\(bioSignal) Historical Data")
.font(Font.custom("Poppins-Bold", size: 22))
Text("🫀 \(bioSignal) Historical Data")
.font(Font.custom("Poppins-Bold", size: 18))
.padding()

List(samples, id: \.uuid) { sample in
VStack(alignment: .leading) {
Text("\(sample.quantity.doubleValue(for: HKUnit.count().unitDivided(by: HKUnit.minute())))")
Text("\(sample.startDate)")
Text(String(format: "%.1f", sample.quantity.doubleValue(for: HKUnit.count().unitDivided(by: HKUnit.minute()))))
Text("\(sample.startDate.formatted(.dateTime.year().month().day().hour().minute().second()))")
.font(.subheadline)
.foregroundColor(.gray)
}
Expand Down Expand Up @@ -75,7 +75,7 @@ struct HealthDataListView: View {
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text(title)
.font(.headline)
.font(Font.custom("Poppins-Regular", size: 18))
.padding(.bottom, 4)

ForEach(samples, id: \.uuid) { sample in
Expand Down

0 comments on commit 13769a8

Please sign in to comment.