researchkitonfhir
HL7 FHIR Structured Data Capture with ResearchKit on iOS
Science Score: 64.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
-
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
1 of 6 committers (16.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.7%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
HL7 FHIR Structured Data Capture with ResearchKit on iOS
Basic Info
- Host: GitHub
- Owner: StanfordBDHG
- License: mit
- Language: Swift
- Default Branch: main
- Homepage: https://swiftpackageindex.com/StanfordBDHG/ResearchKitOnFHIR/documentation
- Size: 278 KB
Statistics
- Stars: 17
- Watchers: 17
- Forks: 2
- Open Issues: 4
- Releases: 0
Topics
Metadata Files
README.md
ResearchKitOnFHIR
ResearchKitOnFHIR is a framework that allows you to use FHIR Questionnaires with ResearchKit to create healthcare surveys on iOS based on the HL7 Structured Data Capture Implementation Guide
For more information, please refer to the API documentation.
Features
- Converts FHIR Questionnaires into ResearchKit tasks
- Serializes results into FHIR QuestionnaireResponses
- Supports survey skip-logic by converting FHIR
enableWhenconditions into ResearchKit navigation rules - Supports answer validation during entry
- Supports contained FHIR ValueSets as answer options
FHIR <-> ResearchKit Conversion
| FHIR R4 QuestionnaireItemType | ResearchKit Type | FHIR Response Type
|------------------------------|-----------------------------|--------------------------|
| attachment | ORKImageCaptureStep | valueAttachment
| boolean | ORKBooleanAnswerFormat | valueBoolean
| choice | ORKTextChoice | valueCoding
| date | ORKDateAnswerFormat(style: ORKDateAnswerStyle.date) | valueDate
| dateTime | ORKDateAnswerFormat(style: ORKDateAnswerStyle.dateAndTime) | valueDateTime
| decimal | ORKNumericAnswerFormat.decimalAnswerFormat | valueDecimal
| display | ORKInstructionStep | none
| group | ORKFormStep | none
| integer | ORKNumericAnswerFormat.integerAnswerFormat | valueInteger
| quantity | ORKNumericAnswerFormat.decimalAnswerFormat(withUnit: quantityUnit) | valueQuantity
| string | ORKTextAnswerFormat | valueString
| text | ORKTextAnswerFormat | valueString
| time | ORKTimeOfDayAnswerFormat | valueTime
Navigation Rules
The following table describes how the FHIR enableWhen is converted to a ResearchKit ORKSkipStepNavigationRule for each supported type and operator. (The conversion is performed by constructing an ORKResultPredicate from the enableWhen expression and negating it.)
Multiple enableWhen expressions are supported, using the enableBehavior element to determine if any or all of the expressions should be applied. If enableBehavior is not defined, all expressions will be applied.
| FHIR R4 QuestionnaireItemType | Supported QuestionnaireItemOperators | ResearchKit ORKResultPredicate | | ---------------------------- | ------------------- | ------------------------------ | | boolean | =, != | .predicateForBooleanQuestionResult | integer | =, !=, <=, >= | .predicateForNumericQuestionResult | decimal | =, !=, <=, >= | .predicateForNumericQuestionResult | date | >, < | .predicateForDateQuestionResult | coding | =, != | .predicateForChoiceQuestionResult
Installation
ResearchKitOnFHIR can be installed into your Xcode project using Swift Package Manager.
- In Xcode 14 and newer (requires Swift 5.7), go to “File” » “Add Packages...”
- Enter the URL to this GitHub repository, then select the
ResearchKitOnFhirpackage to install.
Usage
The Example directory contains an Xcode project that demonstrates how to create a ResearchKit task from an FHIR Questionnaire and extract the results in the form of an FHIR QuestionnaireResponse.
Converting from FHIR to ResearchKit
1. Instantiate an FHIR Questionnaire from JSON
swift
let data = <FHIR JSON data>
var questionnaire: Questionnaire?
do {
questionnaire = try JSONDecoder().decode(Questionnaire.self, from: data)
} catch {
print("Could not decode the FHIR questionnaire": \(error)")
}
2. Create a ResearchKit Navigable Task from the FHIR Questionnaire
swift
var task: ORKNavigableOrderedTask?
do {
task = try ORKNavigableOrderedTask(questionnaire: questionnaire)
} catch {
print("Error creating task: \(error)")
}
Now you can present the task as described in the ResearchKit documentation.
Converting ResearchKit Task Results to FHIR QuestionnaireResponse
In your class that implements the ORKTaskViewControllerDelegateProtocol, you can extract an FHIR QuestionnaireResponse from the task's results as shown below.
swift
func taskViewController(
_ taskViewController: ORKTaskViewController,
didFinishWith reason: ORKTaskViewControllerFinishReason,
error: Error?
) {
switch reason {
case .completed:
let fhirResponse = taskViewController.result.fhirResponse
// ...
}
}
License
This project is licensed under the MIT License. See Licenses for more information.
Contributors
This project is developed as part of the Stanford University projects at Stanford. See CONTRIBUTORS.md for a full list of all ResearchKitOnFHIR contributors.
Notices
ResearchKit is a registered trademark of Apple, Inc. FHIR is a registered trademark of Health Level Seven International.

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 ResearchKitOnFHIR open source project # # SPDX-FileCopyrightText: 2022 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" - family-names: "Aalami" given-names: "Oliver" orcid: "https://orcid.org/0000-0002-7799-2429" - family-names: "Bauer" given-names: "Andreas" orcid: "https://orcid.org/0000-0002-1680-237X" title: "ResearchKitOnFHIR" doi: 10.5281/zenodo.7538169 url: "https://github.com/StanfordBDHG/ResearchKitOnFHIR"
GitHub Events
Total
- Create event: 9
- Issues event: 6
- Release event: 5
- Watch event: 5
- Delete event: 5
- Member event: 2
- Issue comment event: 18
- Push event: 22
- Pull request review comment event: 2
- Pull request event: 13
- Pull request review event: 13
Last Year
- Create event: 9
- Issues event: 6
- Release event: 5
- Watch event: 5
- Delete event: 5
- Member event: 2
- Issue comment event: 18
- Push event: 22
- Pull request review comment event: 2
- Pull request event: 13
- Pull request review event: 13
Committers
Last synced: 6 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Vishnu Ravi | v****i@g****m | 42 |
| Paul Schmiedmayer | P****r | 24 |
| Andreas Bauer | a****r@s****u | 7 |
| luppoalberto111 | 3****1 | 3 |
| Paul | p****t | 2 |
| Lukas Kollmer | h****y@l****e | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 10
- Total pull requests: 79
- Average time to close issues: about 2 months
- Average time to close pull requests: 1 day
- Total issue authors: 6
- Total pull request authors: 6
- Average comments per issue: 0.9
- Average comments per pull request: 1.09
- Merged pull requests: 75
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 7
- Average time to close issues: 6 months
- Average time to close pull requests: 9 days
- Issue authors: 2
- Pull request authors: 4
- Average comments per issue: 0.25
- Average comments per pull request: 1.43
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- vishnuravi (3)
- luppoalberto111 (2)
- iadereggalternova (2)
- mjoerke (1)
- PSchmiedmayer (1)
- philippzagar (1)
- Supereg (1)
Pull Request Authors
- vishnuravi (44)
- PSchmiedmayer (21)
- Supereg (14)
- luppoalberto111 (7)
- lukaskollmer (3)
- pauljohanneskraft (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 6
- Total dependent repositories: 1
- Total versions: 26
swiftpackageindex.com: github.com/StanfordBDHG/ResearchKitOnFHIR
HL7 FHIR Structured Data Capture with ResearchKit on iOS
- Homepage: https://swiftpackageindex.com/StanfordBDHG/ResearchKitOnFHIR/documentation
- Documentation: https://swiftpackageindex.com/StanfordBDHG/ResearchKitOnFHIR/documentation
- License: mit
-
Latest release: 2.0.6
published 7 months ago