<?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" targetNamespace="Surveys" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="4.00">
	<xs:import namespace="Basedatatypes" schemaLocation="Basedatatypes.xsd"/>
	<xs:import namespace="Common" schemaLocation="Common.xsd"/>
	<!-- ================================================== -->
	<!-- =====  Complex Type Definitions  -->
	<!-- ================================================== -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyResponse type -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPSurveyResponseHeader">
		<xs:sequence>
			<xs:element name="xmlVersion" type="xs:string"/>
			<xs:element name="patient" type="common:PatientLite"/>
			<xs:element name="icn" type="surveys:ICNType"/>
			<xs:element name="vendorMRN" type="xs:string"/>
			<xs:element name="facility" type="surveys:Facility"/>
			<xs:element name="vendor" type="surveys:Vendor"/>
			<xs:element name="survey" type="surveys:Survey"/>
			<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:sequence>
	</xs:complexType>
	<xs:complexType name="DMPSurveyResponse">
		<xs:complexContent>
			<xs:extension base="surveys:DMPSurveyResponseHeader">
				<xs:sequence>
					<xs:element name="surveyQuestionsAndAnswers" type="surveys:DMPQuestionsAndAnswers" minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="DMPSurveyResponseWithScore">
		<xs:complexContent>
			<xs:extension base="surveys:DMPSurveyResponseHeader">
				<xs:sequence>
					<xs:element name="surveyQuestionsAndAnswers" type="surveys:DMPQuestionsAndAnswersWithScore" minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Facility type -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="Facility">
		<xs:sequence>
			<xs:element name="facilityNumber" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Vendor type -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="Vendor">
		<xs:sequence>
			<xs:element name="vendorNumber" type="xs:string" minOccurs="0"/>
			<xs:element name="vendorName" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Survey  type -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="Survey">
		<xs:sequence>
			<xs:element name="title" type="surveys:HTTitle"/>
			<xs:element name="version" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionsAndAnswers type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionsAndAnswers">
		<xs:sequence>
			<xs:element name="surveyQuestionAndAnswer" type="surveys:DMPQuestionAndAnswer" minOccurs="1" maxOccurs="9999"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionAndAnswer type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionAndAnswer">
		<xs:sequence>
			<xs:element name="questionNumber" type="surveys:Question"/>
			<xs:element name="answer" type="surveys:DMPAnswer" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionsAndAnswers type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionsAndAnswersWithScore">
		<xs:sequence>
			<xs:element name="surveyQuestionAndAnswerWithScore" type="surveys:DMPQuestionAndAnswerWithScore" minOccurs="1" maxOccurs="9999"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMPSurveyQuestionAndAnswer type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="DMPQuestionAndAnswerWithScore">
		<xs:sequence>
			<xs:element name="questionNumber" type="surveys:Question"/>
			<xs:element name="answer" type="surveys:DMPAnswer" minOccurs="0"/>
			<xs:element name="score" type="surveys:DMPScore" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Survey Title type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="ICNType">
		<xs:restriction base="xs:token">
			<xs:pattern value="[0-9]{10}[V][0-9]{6}"/>
			<!--xs:pattern value="[a-zA-Z0-9]{10}[vV][a-zA-Z0-9]{6}"/-->
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Survey Title type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTTitle">
		<xs:restriction base="xs:token">
			<xs:pattern value="VHA.+"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  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>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SSN  type -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="SSN">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{9}[Pp]?"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!-- Question type -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="Question">
		<xs:restriction base="xs:integer">
			<xs:minInclusive value="1"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Answer type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="DMPAnswer">
		<xs:restriction base="xs:integer">
			<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="xs:integer">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="3"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
