A collection of files to help study and improve sleep
entities.json is a JSON file containing information about sleep-related entities.  This document explains the format of that file.
The project itself builds entities.json from files hosted in the same directory as this specification.  Their format is typically similar enough that an interested developer can learn a lot from the specification, but no guarantees are made about them - even that they will continue to exist in future.  Production systems should avoid them in favour of entities.json itself.
All versions of entities.json contain a single root object with a format key that uniquely identifies the file format.  The associated value MUST begin with https://sleepdiary.github.io/resources/entities#, followed by an arbitrary string.  All versions of the format so far use semantic versioning, but implementations should not depend on this behaviour.  Instead, implementations that handle more than one version should check the format string against a list of known values.
Format string: https://sleepdiary.github.io/resources/entities#version-002
Contains the following top-level sections:
valid_values - lists of values that are allowed for certain keysspecialist - doctors and researchers that examine sleepsoftware - programs to process sleep datavalid_valuesThis object contains a set of key/value pairs, where each key indicates the name of a key that can exist elsewhere in the document, and each value is an object describing valid values for that key. Depending on the key, valid values might be either a single string or an array of strings from the list.
The following example says that all specialist_type keys outside of valid_values must have a string value matching either physician or researcher.  It further includes a non-normative English description for what those keys mean.
{
 ...
 "specialist_type": {
   "physician": "a medical doctor who treats sleep disorders",
   "researcher": "an academic who studies sleep disorders"
 }
 ...
}
specialistThis object contains a single records key, the value of which is a list of known specialists.  Each entry in the list is an object with the following keys:
id - string unique identifier for this specialistname - (object) name of the specialist
    description - (markdown string) short description of the specialistadmin_contact - (plain-text string) how to contact the specialist about changes to their informationspecialist_type - (plain-text string) see specialist_type in valid_valueslast_updated - (plain-text string) date of last update, in the form YYYY-MM-DDprocedure_type - (plain-text string) see procedure_type in valid_valuesurl - (plain-text string) URL of the specialist’s front pagereferral_types - (array of plain-text strings) see referral_types in valid_valuesregistration_required - (boolean value) whether the specialist requires individuals to registerregistration_tel - (optional plain-text string) telephone number for individuals to registerregistration_fax - (optional plain-text string) fax number for individuals to registerregistration_url - (optional plain-text string) URL for individuals to registerregistration_other - (optional plain-text string) other information about the registration processbooking_required - (boolean value) whether the specialist requires individuals to book appointmentsbooking_tel - (optional plain-text string) telephone number for individuals to book appointmentsbooking_fax - (optional plain-text string) fax number for individuals to book appointmentsbooking_url - (optional plain-text string) URL for individuals to book appointmentsbooking_other - (optional plain-text string) other information about the booking processappointment_types - (array of plain-text strings) see appointment_types in valid_valuesappointment_type_other - (optional markdown string) information about the other appointment typebefore_first (markdown string) - actions individuals should take before attending their first appointmentbetween_appointments (markdown string) - actions individuals should take between appointmentsoutcomes - (array of plain-text strings) see outcomes in valid_valuesoutcome_other - (optional markdown string) information about the other outcome typelocations (array of objects) - information about locations where the specialist operates
    locations, belowforms - (array of objects) information about forms that individuals may need to fill out
    forms and reports, belowreports (array of objects) - information about reports that individuals may be shown
    forms and reports, belowsoftwareid - (string) unique identifier for this softwarename - (object) name of the software
    description - (markdown string) short description of the softwareadmin_contact - (plain-text string) how to contact the software about changes to their informationlast_updated - (plain-text string) date of last update, in the form YYYY-MM-DDurl - (plain-text string) URL of the software’s front pagedev_url - (plain-text string) URL of the software’s developer siteplatforms - (array of strings) platforms for which this software is availableprocedure_type - (markdown string) instructions to access this softwarethumb - (plain-text string) URL of a thumbnail for this software
    entities.json is hosted onforms - (array of objects) information about forms that individuals may need to fill out
    forms and reports, belowreports (array of objects) - information about reports that individuals may be shown
    forms and reports, belowlocationsEach entry in the locations array contains the following values:
display_name - (plain-text string) Full name of the location
    short_name - (plain-text string) Short name of the location
    has_name - (boolean value) whether display_name and short_name include the location nameaddress - (plain-text string) street address of the locationgps - (pair of plain-text strings) latitude and longitude of the locationtel - (optional plain-text string) telephone number of the locationfax - (optional plain-text string) fax number of the locationurl - (optional plain-text string) URL of the locationreferral_types - (array of plain-text strings) see referral_types in valid_valuesforms and reportsEach entry in the forms and reports arrays contain the following values:
display_name - (plain-text string) Full name of the document
    short_name - (plain-text string) Short name of the document
    has_name - (boolean value) whether display_name and short_name include the document namedoc_type - (plain-text string) either form or report
    forms and reportsurl - (plain-text string) URL of the documentinstructions_to_find - (markdown string) How to find this form organicallylayout - (plain-text string) type of form or reportsharing_status - (plain-text string) see sharing_status in valid_valuesstart_page - (integer) one-based index of the first page in the PDF containing this document
    total_pages - (integer) number of pages in the PDF dedicated to this documentthumb - (plain-text string) URL of a thumbnail for this document
    entities.json is hosted ongallery - (array of objects) images of this document
    gallery, belowmodifiers - (array of objects) ways that components can be modified
    modifiers, belowThe following entries are only relevant for entries in specialist:
use_before_first - (plain-text string) see use_before_first in valid_valuesuse_between_appointments - (plain-text string) see use_between_appointments in valid_valuesThe following entries are only relevant for entries with a layout of calendar:
inbed_marker - (markdown string) how the calendar marks getting into bedoutofbed_marker - (markdown string) how the calendar marks getting out of bedsleep_marker - (markdown string) how the calendar marks periods of sleeppage_duration - (object) how much time is represented by a single page
    start_time - (object) left-most time in the calendar (e.g. midnight or 6pm)
    events - (array of objects) specific events marked in this calendar
    events, belowgalleryEach entry in the gallery array contains an image of the document, contaning the following values:
display_name - (plain-text string) Full name of the image
    short_name - (plain-text string) Short name of the image
    has_name - (boolean value) whether display_name and short_name include the image namethumb - (plain-text string) URL of a thumbnail for this image
    entities.json is hosted onurl - (plain-text string) URL of the image
    entities.json is hosted oneventsEach entry in the events array contains an event that should be marked in a calendar.  For example, marking caffeine consumption.  Each entry is an object containing the following values:
key - (markdown string) how the calendar marks this eventvalue - (plain-text string) meaning of this eventmodifiersEach entry in the modifiers array contains a way that a component can be modified.  Each entry is an object containing the following values:
component - (plain-text string) component to modify
    bar is supported, indicating the bars in a calendarcolour - (plain-text string) colour of the modified componentdescription (plain-text string) meaning of this modificationSome values are hard to sort correctly.  For example, most algorithms will not sort the list [ "6am", "noon", "10pm" ] in a useful order.  Sort keys are objects that resemble the following:
{
  "key": "012345",
  "value": "hard-to-sort-string"
}
key is a string to sort on.  Some sort keys only contains digits, but should not be converted to integers because the leading 0s are significant.
value is a value to display.
This version is the same as 0.0.2, except for the following:
https://sleepdiary.github.io/resources/entities#version-001software section had not been documented yet, and had some minor differencesforms and reports sections did not support modifiers