# Exercise
In this exercise you will create a Questionnaire instance and a QuestionnaireResponse profile. Start by reading the case description.
Here below are a couple of links that you may find useful during this exercise:
* [Download Forge](https://simplifier.net/forge/download "Download Forge") (if you did not already do so)
* [Questionnaire resource](https://www.hl7.org/fhir/questionnaire.html)
* [QuestionnaireResponse resource](https://www.hl7.org/fhir/questionnaireresponse.html)
Case description
Hospital X wants to build a simple questionnaire that patients can upload and complete in their personal health environment. The questionnaire should contain the following questions:
- What general score would you give the hospital on a scale from 1 to 10?
- How likely is it that you recommend others to go to this hospital? (scale: not likely, maybe, not likely and not unlikely, likely, very likely)
In addition, they want to include some metadata from the Patient: birthdate and postal code.
# Steps to follow
## 1. Create questionnaire
1. Create a XML file to define your Questionnaire.
2. Add (at least) the following elements: `name`, `title`, `status`, `date` and `subjectType`.
3. Add each question using the `item` element. Include a unique `linkId`, `text` and `type` for each question.
4. Add the answer options for the second question (either by using a ValueSet or listing all options).
## 2. Enable when
1. Add a sub item ‘Please explain why you chose this score’ which allows free text and appears when the first question is answered.
2. Add a sub item ‘What could we improve?’ which allows free text and appears when the answer to the second question is not ‘very likely’.
3. Add a sub item ‘What should we keep doing?’ which allows free text and appears when the answer to the second question is not likely and not unlikely, likely or very likely.
## 3. Repeating and initial answers
Suppose you want to be able to repeat the whole set of questions for multiple hospital visits.
1. Add an item ‘Date of hospital visit’.
2. Make the other items nested items of this item.
3. Enable repeating of this item.
4. As the initial value of this item set the date of today.
## 4. Pre-population
1. Add the metadata items to the questionnaire. Include at least a unique `linkId` and a `type` for each item.
2. Use the `definition` element to reference to the correct data fields.
## 5. Profile QuestionnaireResponse
Although it is not best-practice, you want to create a profile to validate the responses to your questionnaire.
1. Open Forge and create a new profile.
2. Add a reference to your questionnaire as a fixed value.
3. Only allow resources of type Patient to be subject of the questionnaire response.
4. Restrict the data type of Author to Patient.
5. Add all items according to the structure of your questionnaire. Add fixed values for `linkId`, `definition` and `text` where you need them.
6. Constrain the data type of the `answer.value[x]` element of each item.
7. What happens if you want to make changes to your questionnaire? Why do you want to avoid having to change your items in two places?