Skip to content

Documents and manifest

This page explains how documents and metadata are stored inside a .pemr bundle.

Together, the docs/ folder and the manifest.json file allow applications to manage attached files safely and consistently.


Overview

A .pemr bundle contains both structured clinical data and external documents.

The structured medical data is stored in the encrypted database (db.sqlite), while files such as PDFs or images are stored separately in the docs/ folder.

Metadata describing the bundle and its contents is stored in manifest.json.

flowchart TB
  PEMR[.pemr bundle]

  PEMR --> DB[db.sqlite]
  PEMR --> MANIFEST[manifest.json]
  PEMR --> DOCS[docs/]

  DOCS --> FILES[PDF / Images / Documents]

The docs/ folder

The docs/ directory stores documents attached to the patient record.

Typical examples include:

  • laboratory reports
  • vaccination records
  • imaging reports
  • discharge summaries
  • documents provided by the family

Documents are stored as normal files (for example .pdf, .jpg, .png).

Why documents are stored outside the database

Documents are not stored inside db.sqlite for several reasons:

  • large binary files would make the database inefficient
  • files can be opened directly by the operating system
  • documents can be inspected if the bundle is unpacked

If the .pemr bundle is unpacked (for example by unzipping it), the docs/ folder appears as a normal directory containing those files.


The manifest.json file

The manifest.json file provides metadata describing the bundle.

Applications use this file to verify compatibility and understand how to process the bundle.

Typical information stored in the manifest includes:

  • bundle format version
  • schema version
  • creation timestamp
  • application version
  • identifiers for included resources

Example structure

{
  "bundleVersion": "1",
  "schemaVersion": "1",
  "createdAt": "2026-03-04T10:12:00Z",
  "createdBy": "CareFlow Kids",
  "appVersion": "1.2.0"
}

The exact fields may evolve as the bundle format evolves.


How applications use the manifest

When opening or importing a .pemr bundle, an application typically:

  1. reads manifest.json
  2. verifies bundle version compatibility
  3. verifies database integrity
  4. loads the encrypted db.sqlite
  5. indexes documents found in docs/

This process ensures that the bundle can be safely opened even as the software evolves.


Relationship between database and documents

The database (db.sqlite) stores references to documents, not the files themselves.

For example, a visit record in the database may contain a reference to:

docs/lab-report-2026-03-01.pdf

The application then resolves that path to the corresponding file in the docs/ folder.

This design keeps the bundle:

  • efficient
  • easy to inspect
  • robust when files are added or updated

Summary

Inside a .pemr bundle:

  • db.sqlite contains structured clinical data
  • docs/ contains attached documents
  • manifest.json describes the bundle and ensures compatibility

Together these components make the bundle portable, inspectable, and safe to exchange between applications.