<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ht="HTDataTypes" targetNamespace="HTDataTypes" elementFormDefault="unqualified" attributeFormDefault="unqualified">
	<!-- ================================================== -->
	<!-- =====  Complex Type Definitions  -->
	<!-- ================================================== -->
	<xs:complexType name="HTCensusSegments">
		<xs:sequence>
			<xs:element name="datetime" type="ht:HTProgramDateTime" minOccurs="1" maxOccurs="1"/>
			<xs:element name="current" type="xs:integer"/>
			<xs:element name="last" type="xs:integer"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  ICN type  Chris W. 7/6/2015 coming icn not null -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTICN">
		<xs:annotation>
			<xs:documentation>ICN - 100xxxxxxxVxxxxxx, 101xxxxxxxVxxxxxx</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="()|([\d]{10}[Vv][\d]{6})"/>
			<!--
			<xs:pattern value="()|(100\d{7}[Vv]\d{6})"/>
			<xs:pattern value="()|(10\d{8}[Vv]\d{6})"/>
			-->
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  SSN type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTSSN">
		<xs:annotation>
			<xs:documentation>SSN - 9 digits with optional P (00000xxxx is test patient)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="9"/>
			<xs:maxLength value="10"/>
			<xs:pattern value="([1-9]\d{8})|(0[1-9]\d{7})|(0{2}[1-9]\d{6})|(0{3}[1-9]\d{5})|(0{4}[1-9]\d{4})[Pp]?"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTFirstName">
		<xs:annotation>
			<xs:documentation>patient first name - string, may be null</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTMiddleName">
		<xs:annotation>
			<xs:documentation>patient middle name - string, may be null</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTMiddleInitial">
		<xs:annotation>
			<xs:documentation>patient middle initial - string, may be null or length 1</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="0"/>
			<xs:maxLength value="1"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTLastName">
		<xs:annotation>
			<xs:documentation>patient last name - string, may not be null</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="1"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="HTName">
		<xs:sequence>
			<xs:element name="Given" type="ht:HTFirstName"/>
			<xs:element name="Middle" type="ht:HTMiddleInitial"/>
			<xs:element name="Family" type="ht:HTLastName"/>
		</xs:sequence>
	</xs:complexType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Date Of Birth type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTDOB">
		<xs:restriction base="xs:date">
			<xs:minExclusive value="1900-01-01" fixed="true"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  HT Program Date type  Chris W. coming start date cannot be less than 10/02/2005-->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTProgramDate">
		<xs:restriction base="xs:date">
			<xs:minInclusive value="2000-01-01" fixed="true"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTProgramOptionalDate">
		<xs:annotation>
			<xs:documentation>date (after start of 2004 contract, upper bound is tomorrow, maybe null)</xs:documentation>
		</xs:annotation>
		<xs:union memberTypes="ht:HTNull ht:HTProgramDate"/>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  HT Program Date type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTProgramDateTime">
		<xs:restriction base="xs:dateTime">
			<xs:minInclusive value="2000-01-01T00:00:00" fixed="true"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  HT Null Date type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTNull">
		<xs:annotation>
			<xs:documentation>
			null (null element) 
		</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value=""/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  VistA Facility Number type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTVistAFacilityNumber">
		<xs:annotation>
			<xs:documentation>VistA facility number is three digits</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="\d{3}"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--   VistA Facility Location type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTVistAFacilityLocation">
		<xs:annotation>
			<xs:documentation>VistA facility location is three digits with an optional two character suffix</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:pattern value="\d{3}(\w{2})?"/>
			<!--xs:pattern value="\d{3}|\d{3}\w{2}"/-->
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Vendor Number type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTVendorNumber">
		<xs:restriction base="xs:token">
			<xs:pattern value="200T([1-9]|[1-9][0-9]|X)"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Vendor Name type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTVendorNames">
		<xs:annotation>
			<xs:documentation>Current Vendor Names</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value=""/>
			<xs:pattern value="Telehealth AMD"/>
			<xs:pattern value="Telehealth American TeleCare Inc.(ATI)"/>
			<xs:pattern value="Telehealth Authentidate"/>
			<xs:pattern value="Telehealth Cardiocom"/>
			<xs:pattern value="Telehealth Carematix"/>
			<xs:pattern value="Telehealth Health Hero"/>
			<xs:pattern value="Telehealth ViTel Net"/>
			<xs:pattern value="Telehealth Viterion"/>
			<xs:pattern value="Telehealth Emulator"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DUZ Type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTDUZ">
		<xs:annotation>
			<xs:documentation>DUZ - VistA employee ID</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="1"/>
		</xs:restriction>
		<!--
		<xs:restriction base="xs:token">
			<xs:pattern value="[0-9]{0,10}"/>
		</xs:restriction>
		-->
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Program Names type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTProgramNames">
		<xs:annotation>
			<xs:documentation>Current Medical Program Names</xs:documentation>
		</xs:annotation>
		<xs:union memberTypes="ht:HTNull xs:string"/>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Level Of Care Type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTCensusLevelOfCare">
		<xs:annotation>
			<xs:documentation>level of care - integer (1 - 4)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:token">
			<xs:pattern value="[1-68]"/>
		</xs:restriction>
		<!--
		<xs:restriction base="xs:integer">
			<xs:minInclusive value="1"/>
			<xs:maxInclusive value="4"/>
		</xs:restriction>
		-->
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Patient Compliance Type  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTPercentage">
		<xs:annotation>
			<xs:documentation>patient response complicance - percentage (0.0 - 100.0)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:float">
			<xs:minInclusive value="0.0" fixed="true"/>
			<xs:maxInclusive value="100.0" fixed="true"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTPatientCompliance">
		<xs:annotation>
			<xs:documentation>patient response complicance or null</xs:documentation>
		</xs:annotation>
		<xs:union memberTypes="ht:HTNull ht:HTPercentage"/>
	</xs:simpleType>
	<xs:simpleType name="HTComplianceType">
		<xs:annotation>
			<xs:documentation>patient response complicance - percentage (0.0 - 1.0)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:float">
			<xs:minInclusive value="0.0"/>
			<xs:maxInclusive value="1.0"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Patient Response Types  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTPatientExpectedResponses">
		<xs:annotation>
			<xs:documentation>patient response - integer (1 - 21)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:nonNegativeInteger">
			<xs:totalDigits value="2"/>
			<xs:minInclusive value="1" fixed="true"/>
			<!-- HT team has asked to change this value to 7. Chris Woodyard 9/1/2015
			<xs:maxInclusive value="21" fixed="true"/>-->
			<xs:maxInclusive value="7" fixed="true"/> 
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTPatientActualResponses">
		<xs:annotation>
			<xs:documentation>number of responses from patient - integer (0 - ...)</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:integer">
			<xs:totalDigits value="2"/>
			<xs:minInclusive value="0" fixed="true"/>
			<!-- HT team has asked to change this value to 7. Chris Woodyard 9/1/2015
			<xs:maxInclusive value="21" fixed="true"/>-->
			<xs:maxInclusive value="7" fixed="true"/> 
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  DMP Modality Names -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTModalityNamesDMP">
		<xs:annotation>
			<xs:documentation>Current DMP Names</xs:documentation>
			<xs:documentation>
			anything
			anything+anything
			anything+anything+anything
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="2"/>
			<xs:maxLength value="256"/>
			<xs:pattern value="[A-Za-z][&#32;-&#126;]+"/>
			<!--xs:pattern value="[A-Za-z][A-Za-z0-9 ;:,_.`~!@#$%*(){}|+=/\- &amp;&lt;&apos;&gt;&quot;]+"/-->
		</xs:restriction>
		<!--
		<xs:union memberTypes="ht:HTComorbidDMPnames ht:HTDMPnames ht:HTStandardizedDMPnames ht:HTVAStandardizedDMPs"/>
		-->
	</xs:simpleType>
	<xs:simpleType name="HTComorbidDMPnames">
		<xs:annotation>
			<xs:documentation>
			anything
			anything+anything
			anything+anything+anything
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="[A-Za-z][A-Za-z0-9 _\-]+([+][A-Za-z][A-Za-z0-9 _\-]+)*"/>
			<!--
			<xs:pattern value="[A-Za-z][A-Za-z0-9 _\-]+([+][A-Za-z][A-Za-z0-9 _\-]+)*"/>
			<xs:pattern value="[A-Za-z]+([+][A-Za-z]+)*"/>
			<xs:pattern value=".+\+.+"/>
			<xs:pattern value=".+\+.+\+.*"/>
			-->
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTDMPnames">
		<xs:annotation>
			<xs:documentation>
			current DMP names 
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="No DMP Recorded"/>
			<xs:pattern value="(Other-)(.*)"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTStandardizedDMPnames">
		<xs:annotation>
			<xs:documentation>
			current DMP names 
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="Bipolar"/>
			<xs:pattern value="CAD"/>
			<xs:pattern value="CancerCare"/>
			<xs:pattern value="CHF"/>
			<xs:pattern value="CoagMgmt"/>
			<xs:pattern value="COPD"/>
			<xs:pattern value="Dementia"/>
			<xs:pattern value="Depression"/>
			<xs:pattern value="DM"/>
			<xs:pattern value="HepC"/>
			<xs:pattern value="HIV"/>
			<xs:pattern value="HPL"/>
			<xs:pattern value="HTN"/>
			<xs:pattern value="LowADL"/>
			<xs:pattern value="MI"/>
			<xs:pattern value="MS"/>
			<xs:pattern value="PainMgmt"/>
			<xs:pattern value="Palliative"/>
			<xs:pattern value="Polypharm"/>
			<xs:pattern value="Prediabetes"/>
			<xs:pattern value="PTSD"/>
			<xs:pattern value="Schiz"/>
			<xs:pattern value="SCI"/>
			<xs:pattern value="Smoking"/>
			<xs:pattern value="Stroke"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="HTVAStandardizedDMPs">
		<xs:annotation>
			<xs:documentation>
			current DMP names 
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="VHA-Substance Use Disorder"/>
			<xs:pattern value="VHA-Weight Management"/>
			<xs:pattern value="VHA-Mild TBI"/>
			<xs:pattern value="(VHA )(.*)"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Measurement Modality Names -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTModalityNamesMeasurement">
		<xs:annotation>
			<xs:documentation>Current Measurement Names</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="Blood Glucose"/>
			<xs:pattern value="Blood Pressure"/>
			<xs:pattern value="Pain"/>
			<xs:pattern value="Pulse"/>
			<xs:pattern value="Pulse Oximetry"/>
			<xs:pattern value="Temperature"/>
			<xs:pattern value="Weight"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Video Modality Names -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTModalityNamesVideo">
		<xs:annotation>
			<xs:documentation>Current Video Names</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="Video"/>
			<xs:pattern value="IP Video"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Telecom Modality Names  -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTModalityNamesTelecom">
		<xs:annotation>
			<xs:documentation>Current Telecom Names</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value=""/>
			<xs:pattern value="Phone Line"/>
			<xs:pattern value="Internet"/>
			<xs:pattern value="Cell"/>
			<xs:pattern value="Satellite"/>
			<xs:pattern value="Browser"/>
			<xs:pattern value="Unknown"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--  Image Modality Names -->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xs:simpleType name="HTModalityNamesImage">
		<xs:annotation>
			<xs:documentation>Current Image Names</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="Wound"/>
			<xs:pattern value="Other"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
