{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "entry": {
      "description": "One medication taken.",
      "properties": {
        "codes": {
          "description": "List of the codes for the medication in standard classifications (for example RxNorm or ATC).",
          "items": {
            "description": "One item of the list of the codes for the medication in standard classifications (for example RxNorm or ATC).",
            "ref": "ai.newnal.mydata.defs#coding",
            "type": "ref"
          },
          "maxLength": 20,
          "type": "array"
        },
        "dosage": {
          "description": "The dosage of the medication.",
          "maxGraphemes": 256,
          "maxLength": 2560,
          "type": "string"
        },
        "frequency": {
          "description": "How often it recurs.",
          "knownValues": [
            "daily",
            "as_needed",
            "weekly",
            "monthly"
          ],
          "maxGraphemes": 64,
          "maxLength": 640,
          "type": "string"
        },
        "name": {
          "description": "The name of the medication taken.",
          "maxGraphemes": 256,
          "maxLength": 2560,
          "type": "string"
        },
        "notes": {
          "description": "An additional note.",
          "maxGraphemes": 3000,
          "maxLength": 30000,
          "type": "string"
        },
        "purpose": {
          "description": "The reason for taking the medication, or the symptom it targets.",
          "maxGraphemes": 3000,
          "maxLength": 30000,
          "type": "string"
        },
        "status": {
          "description": "The status of taking the medication.",
          "knownValues": [
            "active",
            "stopped",
            "planned",
            "paused",
            "completed"
          ],
          "maxGraphemes": 64,
          "maxLength": 640,
          "type": "string"
        },
        "time": {
          "closed": true,
          "description": "The point in time or period over which the medication is taken.",
          "refs": [
            "ai.newnal.mydata.defs#instantTime",
            "ai.newnal.mydata.defs#intervalTime"
          ],
          "type": "union"
        },
        "treats": {
          "description": "List of the AT-URIs of the health condition, symptom or allergy records this medication is taken for.",
          "items": {
            "description": "One item of the list of the AT-URIs of the health condition, symptom or allergy records this medication is taken for.",
            "format": "at-uri",
            "type": "string"
          },
          "maxLength": 100,
          "type": "array"
        }
      },
      "type": "object"
    },
    "main": {
      "description": "Medications taken, with their purpose, dosage and status. The health conditions and symptoms treated with the medications are kept in health.healthStatus, and allergies in health.allergies.",
      "key": "tid",
      "record": {
        "properties": {
          "_meta": {
            "ref": "ai.newnal.mydata.defs#recordMeta",
            "type": "ref"
          },
          "data": {
            "closed": true,
            "refs": [
              "#entry"
            ],
            "type": "union"
          }
        },
        "required": [
          "data",
          "_meta"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "ai.newnal.mydata.healthMedications",
  "lexicon": 1
}
