Skip to content

Instantly share code, notes, and snippets.

@alexbaramilis
Last active April 16, 2019 16:38
Show Gist options
  • Save alexbaramilis/dad17eb177336843e7b9583e54f88101 to your computer and use it in GitHub Desktop.
Save alexbaramilis/dad17eb177336843e7b9583e54f88101 to your computer and use it in GitHub Desktop.
Breather models.
struct CityConditions {
let city: String
let weather: Weather
let pollution: Pollution
let asthma: Asthma
}
struct Weather {
let timestamp: String // timestamp: ex. "2018-12-04T18:00:00.000Z" (ISO 8601) (Z stands for UTC)
let iconCode: String // weather icon code: ex. "10n"
let temperature: Int // temperature: ex. 6 (Celsius)
let humidity: Int // humidity: 93 (%)
let pressure: Int // atmospheric pressure: ex. 1022 (hPa)
let windSpeed: Float // wind speed: ex. 2.26 (m/s)
let windDirection: Int // wind direction as an angle of 360° (N=0, E=90, S=180, W=270): ex. 145
}
struct Pollution {
let timestamp: String // timestamp: ex. "2018-12-04T18:00:00.000Z" (ISO 8601) (Z stands for UTC)
let aqiUS: Int // AQI value based on US EPA standard: ex. 4
let mainPollutantUS: String // main pollutant for US AQI: ex. "o3"
let aqiChina: Int // AQI value based on China MEP standard: ex. 3
let mainPollutantChina: String // main pollutant for Chinese AQI: ex. "o3"
}
struct Asthma {
let risk: String // risk of adverse respiratory conditions: "high", "medium" or "low"
let probability: Int // probability of adverse respiratory conditions: ex. 64 (%)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment