Skip to content

Document Template Reference

v1
OpenAPI 3.1.0

Nightingale document template data

What a document template receives as data, per document kind.

In a template

Before compiling, the worker prepends #let data = json.decode("…"), so a template reads data.patient.full_name, data.visit.status.label and so on.

Fields

Every declared field is always present; a field with no value is none.

Sections

Some fields are sections, gated by a permission of the person asking for the document (and, for what is reached through a visit, access to its location). A section they may not see is none; a section with nothing recorded is an empty list. Leave a none section out entirely: printing it as empty would tell the reader that nothing is recorded when the requester simply cannot see it. Every section says so in its description.

Values

Coded values carry a stable code to compare against and a label in the template's locale. Dates and times carry an iso value and a display string already formatted for the template's locale, in the issuing location's time zone. Nothing describes the request: there is no requester and no generation time. The data holds only what the person who asked for the file may see.

Versioning

data.document.data_version is the version. Fields and enum values may be added within a version; removing or renaming a field, or changing its type, is a new version.

Client Libraries

Webhooks

​
Webhook

Laboratory report

​

The data a LABORATORY_REPORT template receives. Not an HTTP call: the worker prepends #let data = json.decode("…") to the template before compiling it, and this is the shape of that value.

Body·

required
application/json

Data for a LABORATORY_REPORT template: one order and its results.

  • Clinician who placed the order.

    Properties: 6
  • About the document.

    Properties: 3
  • The order and its results.

    Properties: 21
  • Where the sample was collected, or else where the visit took place.

    Properties: 8
  • Issuing organization.

    Properties: 1
  • The patient.

    Properties: 8
  • The visit the order was placed in. Null when the requester may not see that visit.

    Properties: 1

Responses

  • A compiled document. Nothing is returned to the template.

Request Example for postlaboratory_report
{
  "clinician": {
    "email": "",
    "first_name": "",
    "full_name": "",
    "last_name": "",
    "medical_id": null,
    "phone": null
  },
  "document": {
    "data_version": 0,
    "locale": "",
    "timezone": ""
  },
  "laboratory": {
    "clinician_comment": null,
    "collected_at": {
      "display": "",
      "iso": ""
    },
    "collection_notes": null,
    "complete_by": {
      "display": "",
      "iso": ""
    },
    "completed_at": {
      "display": "",
      "iso": ""
    },
    "description": null,
    "external_lab_name": null,
    "external_order_identifier": null,
    "external_report_identifier": null,
    "findings": null,
    "interpretation": null,
    "is_external": true,
    "laboratory_id": "",
    "meal": {
      "code": "",
      "label": ""
    },
    "panel": {
      "code": "",
      "name": ""
    },
    "patient_comment": null,
    "results": [
      {
        "fulfilled_at": {
          "display": "",
          "iso": ""
        },
        "parameter": {
          "code": "",
          "name": ""
        },
        "status": {
          "code": "",
          "label": ""
        },
        "unit": "",
        "value": null,
        "waive_reason": null
      }
    ],
    "sample_location": {
      "code": "",
      "label": ""
    },
    "status": {
      "code": "",
      "label": ""
    },
    "timing": {
      "code": "",
      "label": ""
    },
    "title": ""
  },
  "location": {
    "address": "",
    "address_line_1": "",
    "address_line_2": null,
    "city": "",
    "country_code": "",
    "name": "",
    "postal_code": "",
    "subdivision_code": ""
  },
  "organization": {
    "name": ""
  },
  "patient": {
    "age_years": null,
    "birthdate": {
      "display": "",
      "iso": ""
    },
    "first_name": "",
    "full_name": "",
    "gender": {
      "code": "",
      "label": ""
    },
    "internal_id": null,
    "last_name": "",
    "patient_id": ""
  },
  "visit": {
    "visit_id": null
  }
}
No Body
Webhook

Visit prescription

​

The data a VISIT_PRESCRIPTION template receives. Not an HTTP call: the worker prepends #let data = json.decode("…") to the template before compiling it, and this is the shape of that value.

Body·

required
application/json

Data for a VISIT_PRESCRIPTION template: what the patient leaves with.

  • Aftercare instructions; null when none were given.

    Properties: 6
  • Clinician who started the visit.

    Properties: 6
  • About the document.

    Properties: 3
  • Laboratory orders placed, for the patient to take to the laboratory. Null when the requester may not see laboratory orders.

    Properties: 21
  • Where the visit took place.

    Properties: 8
  • Issuing organization.

    Properties: 1
  • The patient.

    Properties: 8
  • Prescriptions issued. Null when the requester may not see prescriptions.

    Properties: 3
  • The visit.

    Properties: 9

Responses

  • A compiled document. Nothing is returned to the template.

Request Example for postvisit_prescription
{
  "aftercare": {
    "activity_restrictions": null,
    "diet_instructions": null,
    "follow_up_instructions": null,
    "instructions": "",
    "medications_changed": null,
    "return_if_symptoms": null
  },
  "clinician": {
    "email": "",
    "first_name": "",
    "full_name": "",
    "last_name": "",
    "medical_id": null,
    "phone": null
  },
  "document": {
    "data_version": 0,
    "locale": "",
    "timezone": ""
  },
  "laboratories": [
    {
      "clinician_comment": null,
      "collected_at": {
        "display": "",
        "iso": ""
      },
      "collection_notes": null,
      "complete_by": {
        "display": "",
        "iso": ""
      },
      "completed_at": {
        "display": "",
        "iso": ""
      },
      "description": null,
      "external_lab_name": null,
      "external_order_identifier": null,
      "external_report_identifier": null,
      "findings": null,
      "interpretation": null,
      "is_external": true,
      "laboratory_id": "",
      "meal": {
        "code": "",
        "label": ""
      },
      "panel": {
        "code": "",
        "name": ""
      },
      "patient_comment": null,
      "results": [
        {
          "fulfilled_at": {
            "display": "",
            "iso": ""
          },
          "parameter": {
            "code": "",
            "name": ""
          },
          "status": {
            "code": "",
            "label": ""
          },
          "unit": "",
          "value": null,
          "waive_reason": null
        }
      ],
      "sample_location": {
        "code": "",
        "label": ""
      },
      "status": {
        "code": "",
        "label": ""
      },
      "timing": {
        "code": "",
        "label": ""
      },
      "title": ""
    }
  ],
  "location": {
    "address": "",
    "address_line_1": "",
    "address_line_2": null,
    "city": "",
    "country_code": "",
    "name": "",
    "postal_code": "",
    "subdivision_code": ""
  },
  "organization": {
    "name": ""
  },
  "patient": {
    "age_years": null,
    "birthdate": {
      "display": "",
      "iso": ""
    },
    "first_name": "",
    "full_name": "",
    "gender": {
      "code": "",
      "label": ""
    },
    "internal_id": null,
    "last_name": "",
    "patient_id": ""
  },
  "prescriptions": [
    {
      "clinician_comment": null,
      "items": [
        {
          "drug": {
            "administration": {
              "code": "",
              "label": ""
            },
            "drug": {
              "code": "",
              "name": ""
            },
            "presentation": null
          },
          "duration_days": 1,
          "end_date": {
            "display": "",
            "iso": ""
          },
          "indications": "",
          "interval_hours": 1,
          "quantity": 1,
          "start_date": {
            "display": "",
            "iso": ""
          }
        }
      ],
      "prescription_id": ""
    }
  ],
  "visit": {
    "chief_complaint": null,
    "date": {
      "display": "",
      "iso": ""
    },
    "ended_at": {
      "display": "",
      "iso": ""
    },
    "reason_for_visit": null,
    "scheduled_for": {
      "display": "",
      "iso": ""
    },
    "started_at": {
      "display": "",
      "iso": ""
    },
    "status": {
      "code": "",
      "label": ""
    },
    "visit_id": "",
    "visit_type": {
      "code": "",
      "label": ""
    }
  }
}
No Body
Webhook

Visit report

​

The data a VISIT_REPORT template receives. Not an HTTP call: the worker prepends #let data = json.decode("…") to the template before compiling it, and this is the shape of that value.

Body·

required
application/json

Data for a VISIT_REPORT template: everything recorded on one visit.

  • Aftercare instructions; null when none were given.

    Properties: 6
  • Allergies recorded. Null when the requester may not see allergies.

    Properties: 5
  • Chronic conditions recorded. Null when the requester may not see diagnoses.

    Properties: 4
  • Clinician who started the visit.

    Properties: 6
  • Diagnoses made. Null when the requester may not see diagnoses.

    Properties: 4
  • About the document.

    Properties: 3
  • Medication doses recorded. Null when the requester may not see medication intake.

    Properties: 3
  • The patient's family history, whenever it was recorded: it belongs to the patient, not the visit. Ordered by relative, then ICD-10 code. Null when the requester may not see family history.

    Properties: 3
  • Laboratory orders and their results. Null when the requester may not see laboratory orders.

    Properties: 21
  • Where the visit took place.

    Properties: 8
  • Latest reading per measurement type, ordered by type code. Null when the requester may not see observations.

    Properties: 4
  • Issuing organization.

    Properties: 1

Responses

  • A compiled document. Nothing is returned to the template.

Request Example for postvisit_report
{
  "aftercare": {
    "activity_restrictions": null,
    "diet_instructions": null,
    "follow_up_instructions": null,
    "instructions": "",
    "medications_changed": null,
    "return_if_symptoms": null
  },
  "allergies": [
    {
      "allergen_name": "",
      "allergy_type": {
        "code": "",
        "label": ""
      },
      "onset_at": {
        "display": "",
        "iso": ""
      },
      "reaction": null,
      "severity": {
        "code": "",
        "label": ""
      }
    }
  ],
  "chronic_diagnoses": [
    {
      "clinician_comment": null,
      "diagnosis_date": {
        "display": "",
        "iso": ""
      },
      "disease": {
        "code": "",
        "name": ""
      },
      "patient_comment": null
    }
  ],
  "clinician": {
    "email": "",
    "first_name": "",
    "full_name": "",
    "last_name": "",
    "medical_id": null,
    "phone": null
  },
  "diagnoses": [
    {
      "clinician_comment": null,
      "diagnosed_at": {
        "display": "",
        "iso": ""
      },
      "disease": {
        "code": "",
        "name": ""
      },
      "resolved": true
    }
  ],
  "document": {
    "data_version": 0,
    "locale": "",
    "timezone": ""
  },
  "drug_intakes": [
    {
      "drug": {
        "administration": {
          "code": "",
          "label": ""
        },
        "drug": {
          "code": "",
          "name": ""
        },
        "presentation": null
      },
      "quantity": 1,
      "taken_at": {
        "display": "",
        "iso": ""
      }
    }
  ],
  "family_history": [
    {
      "diagnosis_age": null,
      "disease": {
        "code": "",
        "name": ""
      },
      "relative": {
        "code": "",
        "label": ""
      }
    }
  ],
  "laboratories": [
    {
      "clinician_comment": null,
      "collected_at": {
        "display": "",
        "iso": ""
      },
      "collection_notes": null,
      "complete_by": {
        "display": "",
        "iso": ""
      },
      "completed_at": {
        "display": "",
        "iso": ""
      },
      "description": null,
      "external_lab_name": null,
      "external_order_identifier": null,
      "external_report_identifier": null,
      "findings": null,
      "interpretation": null,
      "is_external": true,
      "laboratory_id": "",
      "meal": {
        "code": "",
        "label": ""
      },
      "panel": {
        "code": "",
        "name": ""
      },
      "patient_comment": null,
      "results": [
        {
          "fulfilled_at": {
            "display": "",
            "iso": ""
          },
          "parameter": {
            "code": "",
            "name": ""
          },
          "status": {
            "code": "",
            "label": ""
          },
          "unit": "",
          "value": null,
          "waive_reason": null
        }
      ],
      "sample_location": {
        "code": "",
        "label": ""
      },
      "status": {
        "code": "",
        "label": ""
      },
      "timing": {
        "code": "",
        "label": ""
      },
      "title": ""
    }
  ],
  "location": {
    "address": "",
    "address_line_1": "",
    "address_line_2": null,
    "city": "",
    "country_code": "",
    "name": "",
    "postal_code": "",
    "subdivision_code": ""
  },
  "observations": [
    {
      "measured_at": {
        "display": "",
        "iso": ""
      },
      "observation_type": {
        "code": "",
        "name": ""
      },
      "unit": null,
      "value": ""
    }
  ],
  "organization": {
    "name": ""
  },
  "patient": {
    "age_years": null,
    "birthdate": {
      "display": "",
      "iso": ""
    },
    "first_name": "",
    "full_name": "",
    "gender": {
      "code": "",
      "label": ""
    },
    "internal_id": null,
    "last_name": "",
    "patient_id": ""
  },
  "prescriptions": [
    {
      "clinician_comment": null,
      "items": [
        {
          "drug": {
            "administration": {
              "code": "",
              "label": ""
            },
            "drug": {
              "code": "",
              "name": ""
            },
            "presentation": null
          },
          "duration_days": 1,
          "end_date": {
            "display": "",
            "iso": ""
          },
          "indications": "",
          "interval_hours": 1,
          "quantity": 1,
          "start_date": {
            "display": "",
            "iso": ""
          }
        }
      ],
      "prescription_id": ""
    }
  ],
  "symptoms": [
    {
      "body_side": null,
      "duration_minutes": null,
      "is_present": true,
      "recorded_at": {
        "display": "",
        "iso": ""
      },
      "severity": null,
      "symptom": {
        "code": "",
        "name": ""
      }
    }
  ],
  "visit": {
    "chief_complaint": null,
    "date": {
      "display": "",
      "iso": ""
    },
    "ended_at": {
      "display": "",
      "iso": ""
    },
    "reason_for_visit": null,
    "scheduled_for": {
      "display": "",
      "iso": ""
    },
    "started_at": {
      "display": "",
      "iso": ""
    },
    "status": {
      "code": "",
      "label": ""
    },
    "visit_id": "",
    "visit_type": {
      "code": "",
      "label": ""
    }
  }
}
No Body

Models