<?xml version="1.0" standalone="yes"?>
<xs:schema xmlns:surveys="Surveys" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:basedatatypes="Basedatatypes" xmlns:common="Common" xmlns:sc="SurveysCommon" targetNamespace="Surveys" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="4.00">
	<xs:import namespace="Basedatatypes" schemaLocation="Basedatatypes.xsd"/>
	<xs:import namespace="Common" schemaLocation="Common.xsd"/>
	<xs:import namespace="SurveysCommon" schemaLocation="SurveysCommon.xsd"/>
	<!-- ================================================== -->
	<!-- =====  Complex Type Definitions  -->
	<!-- ================================================== -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyResponse type -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPSurveyResponse">
		<xs:complexContent>
			<xs:restriction base="sc:SurveyResponse">
				<xs:sequence>
					<xs:element name="xmlVersion" type="xs:string"/>
					<xs:element name="survey" type="surveys:DMPSurvey"/>
					<xs:element name="surveyPatient" type="surveys:DMPSurveyPatient"/>
					<xs:element name="vendorMRN" type="xs:string"/>
					<xs:element name="facility" type="sc:Facility"/>
					<xs:element name="vendor" type="sc:Vendor"/>
					<xs:element name="scheduledDate" type="xs:date" nillable="true" minOccurs="0"/>
					<xs:element name="completedDate" type="xs:dateTime"/>
					<xs:element name="programName" type="xs:string" minOccurs="0"/>
					<xs:element name="deviceName" type="xs:string" minOccurs="0"/>
					<xs:element name="responseStatus" type="surveys:DMPResponseStatus"/>
					<xs:element name="recordSource" type="basedatatypes:HL72FacilityIdentifier"/>
					<xs:element name="recordUpdateTime" type="basedatatypes:PointInTime"/>
					<xs:choice>
						<xs:element name="surveyQuestionsAndAnswers" type="surveys:DMPQuestionsAndAnswers" minOccurs="0"/>
						<xs:element name="surveyQuestionsAndAnswersWithScores" type="surveys:DMPQuestionsAndAnswersWithScores" minOccurs="0"/>
					</xs:choice>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurvey type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPSurvey">
		<xs:complexContent>
			<xs:restriction base="sc:Survey">
				<xs:sequence>
					<xs:element name="surveyTitle" type="surveys:DMPSurveyTitle"/>
					<xs:element name="surveyVersion" type="xs:string"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyTitle type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="DMPSurveyTitle">
		<xs:restriction base="xs:token">
			<xs:pattern value="VHA.+"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyPatient  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPSurveyPatient">
		<xs:complexContent>
			<xs:restriction base="sc:SurveyPatient">
				<xs:sequence>
					<xs:element name="patient" type="common:PatientLite"/>
					<xs:element name="icn" type="sc:ICNType"/>
					<xs:element name="ssn" type="xs:string" minOccurs="0"/>
					<xs:element name="name" type="sc:SurveyPersonName" minOccurs="0"/>
					<xs:element name="birthdate" type="xs:date" minOccurs="0"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Vendor Facility type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTVendorNumber">
		<xs:restriction base="xs:string">
			<xs:enumeration value="200TX"/>
			<xs:enumeration value="200T1"/>
			<xs:enumeration value="200T2"/>
			<xs:enumeration value="200T3"/>
			<xs:enumeration value="200T4"/>
			<xs:enumeration value="200T5"/>
			<xs:enumeration value="200T6"/>
			<xs:enumeration value="200T7"/>
			<xs:enumeration value="200T8"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Response Status type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="DMPResponseStatus">
		<xs:restriction base="xs:string">
			<xs:enumeration value="ACCEPTED"/>
			<xs:enumeration value="REFUSED"/>
			<xs:enumeration value="DELAYED"/>
			<xs:enumeration value="DISENROLLED"/>
			<xs:enumeration value="REFUSED-TIME-OUT"/>
			<xs:enumeration value="COMPLETE"/>
			<xs:enumeration value="INCOMPLETE"/>
			<xs:enumeration value="NOT SUBMITTED"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionsAndAnswers type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionsAndAnswers">
		<xs:complexContent>
			<xs:restriction base="sc:SurveyQuestionsAndAnswers">
				<xs:sequence>
					<xs:element name="surveyQuestionAndAnswer" type="surveys:DMPQuestionAndAnswer" minOccurs="1" maxOccurs="100"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionAndAnswer type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionAndAnswer">
		<xs:complexContent>
			<xs:restriction base="sc:SurveyQuestionAndAnswer">
				<xs:sequence>
					<xs:element name="questionNumber" type="sc:Question"/>
					<xs:element name="answer" type="surveys:DMPAnswer" minOccurs="0"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionsAndAnswers type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionsAndAnswersWithScores">
		<xs:complexContent>
			<xs:restriction base="sc:SurveyQuestionsAndAnswersWithScores">
				<xs:sequence>
					<xs:element name="surveyQuestionAndAnswerWithScore" type="surveys:DMPQuestionAndAnswerWithScore" minOccurs="1" maxOccurs="100"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionAndAnswer type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionAndAnswerWithScore">
		<xs:complexContent>
			<xs:restriction base="sc:SurveyQuestionAndAnswerWithScore">
				<xs:sequence>
					<xs:element name="questionNumber" type="sc:Question"/>
					<xs:element name="answer" type="surveys:DMPAnswer" minOccurs="0"/>
					<xs:element name="score" type="surveys:DMPScore" minOccurs="0"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Answer type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="DMPAnswer">
		<xs:restriction base="sc:Answer">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="7"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Score type   -->
	<!--  	  0 indicates that the question was not answered   -->
	<!--    1 - 3 are the three possible scores (low/medium/high)  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="DMPScore">
		<xs:restriction base="sc:Score">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="3"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
