<xs:schema
    attributeFormDefault="unqualified"
    elementFormDefault="unqualified"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="COSD">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Id">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute type="xs:string" name="root"/>
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element name="OrganisationIdentifierCodeOfSubmittingOrganisation">
          <xs:complexType>
            <xs:simpleContent>
			  <xs:extension base="xs:string">
				<xs:attribute type="xs:string" name="extension"/>
			  </xs:extension>
			</xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element name="RecordCount">
          <xs:complexType>
  		    <xs:simpleContent>
			  <xs:extension base="xs:string">
				<xs:attribute type="xs:short" name="value"/>
			  </xs:extension>
			</xs:simpleContent>
		  </xs:complexType>
        </xs:element>
        <xs:element type="xs:date" name="ReportingPeriodStartDate"/>
        <xs:element type="xs:date" name="ReportingPeriodEndDate"/>
        <xs:element type="xs:dateTime" name="FileCreationDateTime"/>
        <xs:element name="COSDRecord" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Id">
                <xs:complexType>
				  <xs:simpleContent>
					<xs:extension base="xs:string">
					  <xs:attribute type="xs:string" name="root"/>
					</xs:extension>
				  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="Haematological">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="HaematologicalCore">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="HaematologicalCoreLinkagePatientId">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:annotation>
                                    <xs:documentation>
                                        can't have type = xs:positiveInteger if minOccurs = 0
                                        using xs:string for NHSNumber
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:element name="NHSNumber" minOccurs="0">
                                  <xs:complexType>
									  <xs:simpleContent>
										<xs:extension base="xs:string">
										  <xs:attribute type="xs:string" name="extension"/>
										</xs:extension>
									  </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element type="xs:string" name="LocalPatientIdExtended"/>
                                <xs:element name="NHSNumberStatusIndicator">
                                  <xs:complexType>
									  <xs:simpleContent>
										<xs:extension base="xs:string">
										  <xs:attribute type="xs:byte" name="code"/>
										</xs:extension>
									  </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element type="xs:date" name="Birthdate"/>
                                <xs:element name="OrganisationIdentifierCodeOfProvider">
                                  <xs:complexType>
									  <xs:simpleContent>
										<xs:extension base="xs:string">
										  <xs:attribute type="xs:string" name="extension"/>
										</xs:extension>
									  </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="HaematologicalCoreDemographics">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="PersonFamilyName">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element type="xs:string" name="family"/>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="PersonGivenName">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element type="xs:string" name="given"/>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="Address" minOccurs="0">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="UnstructuredAddress">
                                        <xs:complexType>
                                          <xs:sequence>
                                            <xs:element type="xs:string" name="streetAddressLine" minOccurs="0"/>
                                          </xs:sequence>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="Postcode" minOccurs="0">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element type="xs:string" name="postalCode" minOccurs="0"/>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
								<xs:element name="Gender">
								  <xs:complexType>
									<xs:simpleContent>
									  <xs:extension base="xs:string">
										<xs:attribute type="xs:byte" name="code"/>
									  </xs:extension>
									</xs:simpleContent>
								  </xs:complexType>
								</xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="HaematologicalCorePathology">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element type="xs:date" name="InvestigationResultDate"/>
								<xs:element name="ServiceReportId">
								  <xs:complexType>
									<xs:simpleContent>
									  <xs:extension base="xs:string">
										<xs:attribute type="xs:string" name="extension"/>
									  </xs:extension>
									</xs:simpleContent>
								  </xs:complexType>
								</xs:element>
								<xs:element name="ServiceReportStatus">
                                  <xs:complexType>
									<xs:simpleContent>
									  <xs:extension base="xs:string">
										<xs:attribute type="xs:byte" name="code"/>
									  </xs:extension>
									</xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="PathTestReqCareProfCode">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="extension"/>
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="OrganisationSiteIdentifierOfPathologyTestRequest">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="extension"/>
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:annotation>
                                    <xs:documentation>
                                        can't have type = xs:date with minOccurs = 0 ??
                                        using xs:string for SampleCollectionDate or SampleReceiptDate
                                    </xs:documentation>
                                </xs:annotation>
                                <xs:element type="xs:string" name="SampleCollectionDate" minOccurs="0"/>
                                <xs:element type="xs:string" name="SampleReceiptDate" minOccurs="0"/>
                                <xs:element name="OrganisationIdentifierOfReportingPathologist">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="extension"/>
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="PathologistConsultantCode">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="extension"/>
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="TopographySNOMEDPathology" minOccurs="0">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="code"/>
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="MorphologySNOMEDPathology" minOccurs="0">
                                  <xs:complexType>
                                    <xs:simpleContent>
                                      <xs:extension base="xs:string">
                                        <xs:attribute type="xs:string" name="code"/>
                                      </xs:extension>
                                    </xs:simpleContent>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element type="xs:string" name="PathologyReportText"/>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
