omhmodels

Swift data models for IEEE 1752 Open mHealth schemas

https://github.com/stanfordbdhg/omhmodels

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
Last synced: 6 months ago · JSON representation ·

Repository

Swift data models for IEEE 1752 Open mHealth schemas

Basic Info
Statistics
  • Stars: 6
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 3
Created over 2 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

OMHModels

Build and Test codecov DOI

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

Open mHealth (OMH)

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.

Stanford Byers Center for Biodesign Logo Stanford Byers Center for Biodesign Logo

Owner

  • Name: Stanford Biodesign Digital Health
  • Login: StanfordBDHG
  • Kind: organization
  • Location: United States of America

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
enhancement (3)
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

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 16.6%
Dependent repos count: 33.7%
Average: 47.6%
Forks count: 62.1%
Stargazers count: 78.2%
Last synced: 6 months ago

Dependencies

.github/workflows/build-and-test.yml actions
.github/workflows/pull_request.yml actions
Package.swift swiftpm