<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:clinicaldata="Clinicaldata" xmlns:common="Common" targetNamespace="Clinicaldata" elementFormDefault="unqualified" attributeFormDefault="unqualified">
	<xsd:import namespace="Common" schemaLocation="../Common.xsd"/>
	<!-- ================================================== -->
	<!-- =====  Element Declarations  -->
	<!-- ================================================== -->
	<xsd:element name="ClinicalData" type="clinicaldata:ClinicalData"/>
	<!-- ================================================== -->
	<!-- =====  Complex Type Definitions  -->
	<!-- ================================================== -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  ClinicalData  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xsd:complexType name="ClinicalData">
		<xsd:sequence>
			<xsd:annotation>
				<xsd:documentation>Write Request</xsd:documentation>
			</xsd:annotation>
			<xsd:element name="templateId" type="xsd:string" fixed="DMPSurveyCreate40020"/>
			<xsd:element name="patient" type="common:ClinicalDataPatient">
				<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
				<!--  Add a unique constraint for DMPsurveyQuestionAndAnswer and surveyQuestionAndAnswerWithScore,    -->
				<!--  there cannot be duplicate questions     -->
				<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
				<xsd:unique name="dmpQuestionsKey">
					<xsd:selector xpath="dmpSurveyResponse/surveyQuestionsAndAnswers/surveyQuestionAndAnswer"/>
					<xsd:field xpath="questionNumber"/>
				</xsd:unique>
				<xsd:unique name="dmpQuestionsWithScoreKey">
					<xsd:selector xpath="dmpSurveyResponseWithScore/surveyQuestionsAndAnswers/surveyQuestionAndAnswerWithScore"/>
					<xsd:field xpath="questionNumber"/>
				</xsd:unique>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>
