omhmodels
Swift data models for IEEE 1752 Open mHealth schemas
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: ieee.org, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.3%) to scientific vocabulary
Repository
Swift data models for IEEE 1752 Open mHealth schemas
Basic Info
- Host: GitHub
- Owner: StanfordBDHG
- License: mit
- Language: Swift
- Default Branch: main
- Homepage: https://swiftpackageindex.com/StanfordBDHG/OMHModels
- Size: 79.1 KB
Statistics
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
- Releases: 3
Metadata Files
README.md
OMHModels
OMHModels is a Swift library for using Open mHealth and IEEE 1752 schemas to represent mobile health data in iOS projects.
Installation
The project can be added to your Xcode project or Swift Package using the Swift Package Manager.
Xcode: For an Xcode project, follow the instructions on adding package dependencies to your app.
Swift Package: You can follow the Swift Package Manager documentation about defining dependencies to add this project as a dependency to your Swift Package.
Schemas
The following schemas are currently supported by this package:
IEEE 1752
- body-posture
- data-point
- date-time
- descriptive-statistic
- descriptive-statistic-denominator
- duration-unit-value
- duration-unit-value-range
- frequency-unit-value
- schema-id
- header
- physical-activity
- time-frame
- time-interval
- total-sleep-time
- unit-value
- unit-value-range
Open mHealth (OMH)
- blood-glucose
- blood-pressure
- body-fat-percentage -body-height
- body-location
- body-mass-index
- body-temperature
- body-weight
- heart-rate
- oxygen-saturation
- part-of-day
- respiratory-rate
- specimen-source
- step-count
- temporal-relationship-to-meal
- temporal-relationship-to-physical-activity
- temporal-relationship-to-sleep
Usage Example
The OMHModels package can be used to represent mobile health data in accordance with the above schemas within your iOS application.
Below is an example using TotalSleepTime, although the same instructions apply to any schema in the package.
Initialization
To create an instance of the TotalSleepTime struct:
swift
let sleepTime = TotalSleepTime(
totalSleepTime: DurationUnitValue(value: 8, unit: .hour),
effectiveTimeFrame: TimeFrame(timeInterval:
TimeInterval(
startDateTime: // Date,
endDateTime: // Date
),
isMainSleep: true,
descriptiveStatistic: .average,
descriptiveStatisticDenominator: .week
)
Encoding to JSON
To encode the TotalSleepTime instance to JSON:
```swift let json: String do { let encoder = JSONEncoder() encoder.outputFormatting = [.prettyPrinted, .withoutEscapingSlashes, .sortedKeys]
// Note that both IEEE 1752 and Open mHealth use snake case for its properties when represneted in JSON
encoder.keyCodingStrategy = .convertToSnakeCase
let data = try encoder.encode(sleepTime)
json = String(data: jsonData, encoding: .utf8)
} catch { print("Error encoding to JSON: (error)") } ```
Decoding from JSON
To decode a JSON string back to a TotalSleepTime instance:
swift
let jsonString = /* your JSON string here */
if let jsonData = jsonString.data(using: .utf8) {
do {
let decoder = JSONDecoder()
let decodedSleepTime = try decoder.decode(TotalSleepTime.self, from: jsonData)
print(decodedSleepTime)
} catch {
print("Error decoding from JSON: \(error)")
}
}
License
This project is licensed under the MIT License. See Licenses for more information.
Notice
This project is not officially endorsed by Open mHealth or IEEE.
Contributors
This project is developed as part of the Stanford Byers Center for Biodesign at Stanford University. See CONTRIBUTORS.md for a full list of all OMHModels contributors.

Owner
- Name: Stanford Biodesign Digital Health
- Login: StanfordBDHG
- Kind: organization
- Location: United States of America
- Twitter: StanfordBDHG
- Repositories: 18
- Profile: https://github.com/StanfordBDHG
Citation (CITATION.cff)
# # This source file is part of the OMHModels open source project # # SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) # # SPDX-License-Identifier: MIT # cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Ravi" given-names: "Vishnu" orcid: "https://orcid.org/0000-0003-0359-1275" - family-names: "Schmiedmayer" given-names: "Paul" orcid: "https://orcid.org/0000-0002-8607-9148" title: "OMHModels" url: "https://github.com/StanfordBDHG/OMHModels"
GitHub Events
Total
- Create event: 6
- Release event: 1
- Issues event: 6
- Delete event: 4
- Issue comment event: 7
- Push event: 13
- Pull request review event: 2
- Pull request review comment event: 1
- Pull request event: 6
Last Year
- Create event: 6
- Release event: 1
- Issues event: 6
- Delete event: 4
- Issue comment event: 7
- Push event: 13
- Pull request review event: 2
- Pull request review comment event: 1
- Pull request event: 6
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 4
- Total pull requests: 7
- Average time to close issues: 5 months
- Average time to close pull requests: 8 days
- Total issue authors: 2
- Total pull request authors: 1
- Average comments per issue: 0.25
- Average comments per pull request: 0.71
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 5
- Average time to close issues: 5 months
- Average time to close pull requests: 13 days
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 0.25
- Average comments per pull request: 0.6
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- vishnuravi (3)
- philippzagar (1)
Pull Request Authors
- vishnuravi (7)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
swiftpackageindex.com: github.com/StanfordBDHG/OMHModels
Swift data models for IEEE 1752 Open mHealth schemas
- Homepage: https://swiftpackageindex.com/StanfordBDHG/OMHModels
- Documentation: https://swiftpackageindex.com/StanfordBDHG/OMHModels/documentation
- License: mit
-
Latest release: 0.2.0
published 7 months ago