<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://def.savviuk.org/logical#"
            xmlns="http://def.savviuk.org/logical#"
            xmlns:savviD="http://def.savviuk.org/dictionary#"
            elementFormDefault="qualified">

  <xsd:import namespace="http://def.savviuk.org/dictionary#" schemaLocation="SAVVI_Dictionary.xsd" />

  <xsd:complexType name="Action">
    <xsd:sequence>
      <xsd:element name="Type" type="savviD:Type" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The type of action - e.g.

* food parcel
* debt advice</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Date" type="xsd:date" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date of the Action.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Description" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A description of the Action.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Action" type="Action" />

  <xsd:complexType name="Assessment">
    <xsd:sequence>
      <xsd:element name="Situation" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A record of the situation to be assessed.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Findings" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A judgement of the Needs arising from the Situation.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date of the Assessment</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Assessment" type="Assessment" />

  <xsd:complexType name="Attribute">
    <xsd:sequence>
      <xsd:element name="Type" type="savviD:Type" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>To describe the Attribute. e.g. In receipt of Universal Credit, Living Alone.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Set" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>To indicate if the presence of the Attribute is true or false. </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Value" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>An optional value associated with an Attribute, e.g. if the Type is &apos;%
attendance&apos;, the Value may be 60.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="DateFrom" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date from which the Attribute is true.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="DateTo" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date from which the Attribute may no longer be true, or is expected to end.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Attribute" type="Attribute" />

  <xsd:complexType name="Case">
    <xsd:sequence>
      <xsd:element name="Reference" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The Case Reference.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Status" type="xsd:string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="Date_Raised" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the Case was started.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Date_Closed" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the Case was closed.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Case_Outcome" type="savviD:Case_Outcome" minOccurs="0" maxOccurs="1" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Case" type="Case" />

  <xsd:complexType name="Contact_Event">
    <xsd:sequence>
      <xsd:element name="Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date of the contact.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Person" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The name of the contacted person</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Role" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The role of the contacted person e.g.

* Vulnerable Person
* Friend
* Relative
* Public
* Professional
* Community Group
* Elected Representative</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Method" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The method used to make the contact e.g.

* phone
* home visit
* digital</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Contact_Direction" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>To indicate who initiated the contact.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Notes" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>Notes of the Contact Event</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Contact_Event" type="Contact_Event" />

  <xsd:complexType name="Household">
    <xsd:sequence>
      <xsd:element name="Identifier" type="savviD:Identifier" minOccurs="0" maxOccurs="unbounded" />
      <xsd:element name="FromDate" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A date from which the Household is known to be formed.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="ToDate" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A date after which the Household may not be formed.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Household" type="Household" />

  <xsd:complexType name="Need">
    <xsd:sequence>
      <xsd:element name="Type" type="savviD:Type" minOccurs="1" maxOccurs="1" />
      <xsd:element name="Rationale" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The reasoning for the Need.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the Need is established.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="End_Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the Need was resolved.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Target_Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the Need should be resolved by, for it to be effective.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Need" type="Need" />

  <xsd:complexType name="Organisation">
    <xsd:sequence>
      <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1" />
      <xsd:element name="Department" type="xsd:string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="Contact_Person" type="xsd:string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="Contact_Point" type="savviD:Contact_Point" minOccurs="0" maxOccurs="unbounded" />
      <xsd:element name="Identifier" type="savviD:Identifier" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>Reference by which the organisation is known, e.g.

* GDS Register of Local Authorities
* Companies House Number
* Charity Number</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Organisation" type="Organisation" />

  <xsd:complexType name="Outcome">
    <xsd:sequence>
      <xsd:element name="Type" type="savviD:Type" minOccurs="1" maxOccurs="1" />
      <xsd:element name="Description" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A description of the Outcome.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the Outcome was achieved.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Outcome" type="Outcome" />

  <xsd:complexType name="Person">
    <xsd:sequence>
      <xsd:element name="Name" type="savviD:Person_Name" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The official name of a person.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="BirthDate" type="savviD:Birth_Date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that a person was born.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="RegisteredSex" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The sex recorded for a person in an official civil registration or legal record, such as the sex recorded at birth.

Use an agreed code list such as [Codesystem-administrative-gender - FHIR v5.0.0](http://hl7.org/fhir/codesystem-administrative-gender.html)</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Gender" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A social category for the sex that a person self-presents as.

Use an agreed code list such as [Codesystem-administrative-gender - FHIR v5.0.0](http://hl7.org/fhir/codesystem-administrative-gender.html)</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Identifier" type="savviD:Identifier" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>References by which a person is known, in various schemes. e.g. NiNo, Health
Number, a local reference.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="PreviousName" type="savviD:Person_Name" minOccurs="1" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>Names that a person has previously been known as.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Alias" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>An assumed or additional name that a Person sometimes uses, or a shortened diminutive version of a name, e.g. Betty, Smithy, by which a Person is generally known by family and friends, or to a Service.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Person" type="Person" />

  <xsd:complexType name="Place">
    <xsd:annotation>
      <xsd:documentation>Can mean

* a one-of polygon
* a street
* a neighbourhood
* an existing statistical or administrative geography</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The name of the Place</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Extent" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A geographic shape expressed using an established data standard such as

* the OGC Well-Known Text (WKT) geometry format (`POLYGON`).
* GeoJSON</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Identifier" type="savviD:Identifier" minOccurs="1" maxOccurs="1" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Place" type="Place" />

  <xsd:complexType name="Plan">
    <xsd:sequence>
      <xsd:element name="Start_Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the plan starts from.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="End_Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date when the plan has ended, or is expected to end.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Description" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A description of the plan.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Activity_Type" type="savviD:Type" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>The Activities that the Plan includes. </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Plan" type="Plan" />

  <xsd:complexType name="Referral">
    <xsd:sequence>
      <xsd:element name="Date" type="xsd:date" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that a decision was made to make the referral.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="End_Date" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The date that the referral ended.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Type" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>* direct
* recommended
* signposted</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Service_Reference" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The reference assigned by the Service</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Referral" type="Referral" />

  <xsd:complexType name="Residence">
    <xsd:sequence>
      <xsd:element name="Address" type="savviD:Property_Address" minOccurs="0" maxOccurs="1" />
      <xsd:element name="Characteristic" type="savviD:Characteristic" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>Information about the residence such as the number or bedrooms, condition.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Identifier" type="savviD:Identifier" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>Properties are known by Identifiers such as the UPRN from GeoPlace.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Map_Pin" type="savviD:Coordinate" minOccurs="0" maxOccurs="1" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Residence" type="Residence" />

  <xsd:complexType name="Service">
    <xsd:sequence>
      <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>The name of the Service.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Identifier" type="savviD:Identifier" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>An Identifier that can be looked up, to provide more information about the Service, such as contact information, eligibility, opening times and so on.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Type" type="savviD:Type" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>A categorisation of the type of Service</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="URL" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>A URL to a web page to give more information about a Service</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Service" type="Service" />

  <xsd:complexType name="Vulnerability">
    <xsd:sequence>
      <xsd:element name="Type" type="savviD:Type" minOccurs="1" maxOccurs="1" />
      <xsd:element name="Risk_Category" type="savviD:Type" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Vulnerability" type="Vulnerability" />

</xsd:schema>