--- type: "sdc-page" title: "SDC: OperationDefinition-Questionnaire-assemble-notes" source: "sdc/input/pagecontent/OperationDefinition-Questionnaire-assemble-notes.xml" --- # SDC: OperationDefinition-Questionnaire-assemble-notes ### Algorithm The assembly process for a modular questionnaire proceeds as follows: 1. Resolve all [subQuestionnaire](/sdc-structuredefinition-sdc-questionnaire-subquestionnaire-intro) extensions as described in the [Modular Forms](/sdc-modular#modular) page. If there is an issue resolving any of the subQuestionnaires or applying the reolution process results in any errors, the operation `SHOULD` fail. 2. Propagate all relevant information from any declared `item.definition` elements on all resulting items, as described on the [Modular Forms](/sdc-modular#element) page. 3. Adjust or remove the [assemble-expectation](http://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-assemble-expectation.html) extension from the Questionnaire - because it no longer requires assembly! 4. Add the [assembledFrom](http://build.fhir.org/ig/HL7/sdc/SearchParameter-questionnaire-assembled-from.html) extension, pointing to the canonical URL and version of the Questionnaire that was assembled. 5. Modify the Questionnaire.version to either be a UUID or append "-assembled". 6. Optionally, check the resulting Questionnaire to ensure that it is valid according to the base Questionnaire and possibly any declared profiles. If the resulting Questionnaire is not valid, return a warning. The result of the operation will be one of three things: - If there are any errors, there will be a 4xx or 5xx error code and, ideally an [OperationOutcome]({{site.data.fhir.path}}operationoutcome) as the body of the response. - If there are no errors, warnings or information messages that result from the assembly process, the body can just be the bare Questionnaire resource that resulted from the operation. - If there are any warnings or information messages, then the body will be a [Parameters]({{site.data.fhir.path}}parameters) instance with two parameters - 'response' containing the reulting Questionnaire and 'outcome' containing an OperationOutcome with the warning and/or information messages. ### Examples An example of a modular Questionnaire (as a sample input to the operation) can be found [here](http://build.fhir.org/ig/HL7/sdc/Questionnaire-sdc-modular-root.html). An example of the result of invoking a modular Questionnaire (as a sample output from the operation) can be found [here](http://build.fhir.org/ig/HL7/sdc/Parameters-sdc-modular-root-assembled.html).