Enables apps to display and collect responses from HL7® FHIR® questionnaires.
The Spezi Questionnaire package enables HL7® FHIR® Questionnaires to be displayed in your Spezi application.
Questionnaires are displayed using ResearchKit and the ResearchKitOnFHIR package.
An HL7® FHIR® Questionnaire is rendered using the QuestionnaireView |
You need to add the Spezi Questionnaire Swift package to your app in Xcode or Swift package.
Important
If your application is not yet configured to use Spezi, follow the Spezi setup article and set up the core Spezi infrastructure.
In the following example, we create a SwiftUI view with a button that displays a sample questionnaire from the FHIRQuestionnaires
package using QuestionnaireView
.
import FHIRQuestionnaires
import SpeziQuestionnaire
import SwiftUI
struct ExampleQuestionnaireView: View {
@State var displayQuestionnaire = false
var body: some View {
Button("Display Questionnaire") {
displayQuestionnaire.toggle()
}
.sheet(isPresented: $displayQuestionnaire) {
QuestionnaireView(
questionnaire: Questionnaire.gcs
) { result in
guard case let .completed(response) = result else {
return // user cancelled
}
// ... save the FHIR response to your data store
}
}
}
}
For more information, please refer to the API documentation.
The Spezi Template Application provides a great starting point and example using the Spezi Questionnaire module.
Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.
FHIR is a registered trademark of Health Level Seven International.
This project is licensed under the MIT License. See Licenses for more information.