<?xml version="1.0" standalone="yes"?>
<xs:schema xmlns:sc="SurveysCommon" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:basedatatypes="Basedatatypes" xmlns:common="Common" targetNamespace="SurveysCommon" elementFormDefault="unqualified" attributeFormDefault="unqualified">
	<xs:import namespace="Basedatatypes" schemaLocation="Basedatatypes.xsd"/>
	<xs:import namespace="Common" schemaLocation="Common.xsd"/>
	<!-- ================================================== -->
	<!-- =====  Complex Type Definitions  -->
	<!-- ================================================== -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyResponse  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="SurveyResponse">
		<xs:sequence>
			<xs:element name="xmlVersion" type="xs:string" minOccurs="0"/>
			<xs:element name="survey" type="sc:Survey"/>
			<xs:element name="surveyPatient" type="sc:SurveyPatient"/>
			<xs:element name="enrollmentDate" type="xs:date" minOccurs="0"/>
			<xs:element name="disenrollmentDate" type="xs:date" nillable="true" minOccurs="0"/>
			<xs:element name="activationDate" type="xs:date" nillable="true" minOccurs="0"/>
			<xs:element name="inactivationDate" type="xs:date" nillable="true" minOccurs="0"/>
			<xs:element name="vendorMRN" type="xs:string"/>
			<xs:element name="facility" type="sc:Facility"/>
			<xs:element name="vendor" type="sc:Vendor"/>
			<xs:element name="careCoordinator" type="sc:CareCoordinator" minOccurs="0"/>
			<xs:element name="scheduledDate" type="xs:date" nillable="true" minOccurs="0"/>
			<xs:element name="completedDate" type="xs:dateTime"/>
			<xs:element name="currentDialogueName" type="xs:string" minOccurs="0"/>
			<xs:element name="programName" type="xs:string" minOccurs="0"/>
			<xs:element name="deviceName" type="xs:string" minOccurs="0"/>
			<xs:element name="responseStatus" type="xs:string"/>
			<xs:element name="recordSource" type="basedatatypes:HL72FacilityIdentifier"/>
			<xs:element name="recordUpdateTime" type="basedatatypes:PointInTime"/>
			<xs:choice>
				<xs:element name="surveyQuestionsAndAnswers" type="sc:SurveyQuestionsAndAnswers" minOccurs="0"/>
				<xs:element name="surveyQuestionsAndAnswersWithScores" type="sc:SurveyQuestionsAndAnswersWithScores" minOccurs="0"/>
			</xs:choice>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyType  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="Survey">
		<xs:sequence>
			<xs:element name="surveyTitle" type="xs:string"/>
			<xs:element name="surveyVersion" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyPersonName  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="SurveyPersonName">
		<xs:complexContent>
			<xs:restriction base="basedatatypes:HL72PersonName">
				<xs:sequence>
					<xs:element name="given" type="xs:string" minOccurs="0"/>
					<xs:element name="middle" type="xs:string" minOccurs="0"/>
					<xs:element name="family" type="xs:string" minOccurs="0"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyPatient  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="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:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  ICN type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="ICNType">
		<xs:restriction base="xs:token">
			<xs:pattern value="[0-9]{10}[V][0-9]{6}"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Facility  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="Facility">
		<xs:sequence>
			<xs:element name="facilityNumber" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Vendor  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="Vendor">
		<xs:sequence>
			<xs:element name="vendorNumber" type="sc:HTVendorNumber"/>
			<xs:element name="vendorName" type="xs:string"/>
		</xs:sequence>
	</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>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  CareCoordinator  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="CareCoordinator">
		<xs:sequence>
			<xs:element name="id" type="xs:string" minOccurs="0"/>
			<xs:element name="name" type="sc:SurveyPersonName" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyQuestionsAndAnswers  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="SurveyQuestionsAndAnswers">
		<xs:sequence>
			<xs:element name="surveyQuestionAndAnswer" type="sc:SurveyQuestionAndAnswer" minOccurs="1" maxOccurs="100"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyQuestionAndAnswer  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="SurveyQuestionAndAnswer">
		<xs:sequence>
			<xs:element name="questionNumber" type="sc:Question"/>
			<xs:element name="answer" type="sc:Answer" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyQuestionsAndAnswers  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="SurveyQuestionsAndAnswersWithScores">
		<xs:sequence>
			<xs:element name="surveyQuestionAndAnswerWithScore" type="sc:SurveyQuestionAndAnswerWithScore" minOccurs="1" maxOccurs="100"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SurveyQuestionsAndAnswersWithScore  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:complexType name="SurveyQuestionAndAnswerWithScore">
		<xs:complexContent>
			<xs:extension base="sc:SurveyQuestionAndAnswer">
				<xs:sequence>
					<xs:element name="score" type="sc:Score" minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Question type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="Question">
		<xs:restriction base="xs:integer">
			<xs:minInclusive value="1"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Answer type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="Answer">
		<xs:restriction base="xs:integer">
			<xs:minInclusive value="0"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Score type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="Score">
		<xs:restriction base="xs:integer">
			<xs:minInclusive value="0"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
