{
  "resourceType": "StructureDefinition",
  "id": "pr-medication-request",
  "meta": {
    "security": [
      {
        "system": "https://www.icanbwell.com/owner",
        "code": "bwell"
      },
      {
        "system": "https://www.icanbwell.com/access",
        "code": "bwell"
      }
    ]
  },
  "url": "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-request",
  "version": "1.0",
  "name": "MedicationRequest",
  "title": "Profile: Medication Request",
  "status": "active",
  "date": "2024-03-01",
  "experimental": false,
  "publisher": "b.Well Connected Health",
  "description": "Prescriptions",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "urn:iso:std:iso:3166",
          "code": "US",
          "display": "United States of America"
        }
      ],
      "text": "United States of America"
    }
  ],
  "fhirVersion": "4.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "MedicationRequest",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationRequest",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationRequest",
        "path": "MedicationRequest"
      },
      {
        "id": "MedicationRequest.id",
        "path": "MedicationRequest.id",
        "min": 1,
        "max": "1"
      },
      {
        "id": "MedicationRequest.meta",
        "path": "MedicationRequest.meta",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Meta"
          }
        ]
      },
      {
        "id": "MedicationRequest.meta.source",
        "path": "MedicationRequest.meta.source",
        "short": "uri of the data source",
        "definition": "Typically the data owner's URL followed by a source/file description",
        "requirements": "mandatory for all resources in bWell's FHIR Server",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "uri"
          }
        ],
        "example": [
          {
            "label": "example of meta.source",
            "valueUri": "https://www.icanbwell.com/provider-directory"
          }
        ]
      },
      {
        "id": "MedicationRequest.meta.security",
        "path": "MedicationRequest.meta.security",
        "short": "security tags representing the data's owner, vendor, and accessibility",
        "definition": "data owner: \n \n data vendor: \n \n data access: ",
        "requirements": "/owner & /access are mandatory for all resources in bWell's FHIR Server",
        "min": 1,
        "max": "*",
        "type": [
          {
            "code": "Coding"
          }
        ],
        "example": [
          {
            "label": "example of data owner security tag",
            "valueCoding": {
              "system": "https://www.icanbwell.com/owner",
              "code": "bwell"
            }
          },
          {
            "label": "example of data access security tag",
            "valueCoding": {
              "system": "https://www.icanbwell.com/access",
              "code": "bwell"
            }
          },
          {
            "label": "example of data vendor security tag",
            "valueCoding": {
              "system": "https://www.icanbwell.com/vendor",
              "code": "bwell"
            }
          }
        ]
      },
      {
        "id": "MedicationRequest.identifier",
        "path": "MedicationRequest.identifier",
        "slicing": {
          "description": "slice by types",
          "rules": "open"
        },
        "short": "a value to identify the resource",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Identifier"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.identifier.id",
        "path": "MedicationRequest.identifier.id",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "MedicationRequest.identifier.use",
        "path": "MedicationRequest.identifier.use",
        "short": "usual | official | temp | secondary | old (If known)",
        "definition": "The purpose of this identifier.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ]
      },
      {
        "id": "MedicationRequest.identifier.type",
        "path": "MedicationRequest.identifier.type",
        "short": "Description of identifier",
        "definition": "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.",
        "requirements": "Needs binding valueset",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ]
      },
      {
        "id": "MedicationRequest.identifier.system",
        "path": "MedicationRequest.identifier.system",
        "short": "The system which created the identifier",
        "definition": "Values may be an oid, uri, url, or canonical",
        "comment": "for mapped data, this is frequently a canonical url",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "uri"
          }
        ],
        "example": [
          {
            "label": "a client's unknown system",
            "valueUri": "https://www.health.org/person-identifier"
          }
        ]
      },
      {
        "id": "MedicationRequest.identifier.value",
        "path": "MedicationRequest.identifier.value",
        "short": "The unique value",
        "definition": "The raw identifier value that represents a resource",
        "requirements": "This should be the raw value, as it exists in the source data (ie without prefix)",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "MedicationRequest.identifier-rx-number",
        "path": "MedicationRequest.identifier",
        "sliceName": "rx-number",
        "short": "The prescription (Rx) unique identifier",
        "alias": [
          "rx-number"
        ],
        "min": 1,
        "max": "1",
        "example": [
          {
            "label": "Rx Identifier",
            "valueIdentifier": {
              "id": "rx-number",
              "type": {
                "coding": [
                  {
                    "id": "rx",
                    "system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/vs-identifier-type",
                    "code": "RX"
                  }
                ]
              }
            }
          }
        ]
      },
      {
        "id": "MedicationRequest.status",
        "path": "MedicationRequest.status",
        "short": "active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown",
        "comment": "default to 'completed'",
        "min": 1,
        "type": [
          {
            "code": "code"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.intent",
        "path": "MedicationRequest.intent",
        "short": "proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option",
        "comment": "default to 'order'",
        "min": 1,
        "type": [
          {
            "code": "code"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.category",
        "path": "MedicationRequest.category",
        "slicing": {
          "description": "slice by type",
          "rules": "open"
        },
        "short": "Type of medication usage",
        "min": 0,
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "example": [
          {
            "label": "MedicationRequest.category example",
            "valueCodeableConcept": {
              "id": "category",
              "coding": [
                {
                  "id": "order-category",
                  "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
                  "code": "community"
                }
              ]
            }
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.reported[x]",
        "path": "MedicationRequest.reported[x]",
        "short": "Reported rather than primary record",
        "min": 0,
        "type": [
          {
            "code": "boolean"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.medication[x]",
        "path": "MedicationRequest.medication[x]",
        "short": "a value to identify the resource",
        "min": 1,
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "example": [
          {
            "label": "medicationCodeableConcept example with ndc and snomed codes",
            "valueCodeableConcept": {
              "coding": [
                {
                  "id": "ndc",
                  "system": "http://hl7.org/fhir/sid/ndc",
                  "code": "0573-0134"
                },
                {
                  "id": "snomed",
                  "system": "http://snomed.info/sct",
                  "code": "387207008"
                }
              ],
              "text": "Advil"
            }
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.medication[x].coding",
        "path": "MedicationRequest.medication[x].coding",
        "slicing": {
          "description": "slice by code system",
          "rules": "open"
        },
        "short": "The code-system pair describing the medication",
        "min": 1,
        "max": "*",
        "type": [
          {
            "code": "Coding"
          }
        ]
      },
      {
        "id": "MedicationRequest.medication[x].coding-ndc",
        "path": "MedicationRequest.medication[x].coding-ndc",
        "sliceName": "ndc",
        "short": "National Drug Code",
        "definition": "system = http://hl7.org/fhir/sid/ndc",
        "type": [
          {
            "code": "Coding"
          }
        ]
      },
      {
        "id": "MedicationRequest.medication[x].coding-rxnorm",
        "path": "MedicationRequest.medication[x].coding-rxnorm",
        "sliceName": "rxnorm",
        "short": "RxNorm code",
        "definition": "system = http://www.nlm.nih.gov/research/umls/rxnorm",
        "type": [
          {
            "code": "Coding"
          }
        ]
      },
      {
        "id": "MedicationRequest.medication[x].coding-snomed",
        "path": "MedicationRequest.medication[x].coding-snomed",
        "sliceName": "snomed",
        "short": "SNOMED code",
        "definition": "system = http://snomed.info/sct",
        "type": [
          {
            "code": "Coding"
          }
        ]
      },
      {
        "id": "MedicationRequest.medication[x].coding-ndfrt",
        "path": "MedicationRequest.medication[x].coding-ndfrt",
        "sliceName": "ndfrt",
        "short": "National Durg File - Reference Terminology code",
        "definition": "system = http://hl7.org/fhir/ndfrt",
        "type": [
          {
            "code": "Coding"
          }
        ]
      },
      {
        "id": "MedicationRequest.medication[x].coding-gpi",
        "path": "MedicationRequest.medication[x].coding-gpi",
        "sliceName": "gpi",
        "short": "Generic Product Identifier code",
        "definition": "system = http://terminology.hl7.org/CodeSystem/MGPI",
        "type": [
          {
            "code": "Coding"
          }
        ]
      },
      {
        "id": "MedicationRequest.subject",
        "path": "MedicationRequest.subject",
        "short": "The patient",
        "alias": [
          "patient",
          "user"
        ],
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-patient"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.encounter",
        "path": "MedicationRequest.encounter",
        "short": "Reference to a relevent Encounter",
        "min": 0,
        "type": [
          {
            "code": "Reference"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.authoredOn",
        "path": "MedicationRequest.authoredOn",
        "short": "When the prescription was written by the requesting practitioner",
        "alias": [
          "prescribed-date"
        ],
        "min": 1,
        "type": [
          {
            "code": "dateTime"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.requester",
        "path": "MedicationRequest.requester",
        "short": "The practitioner who authored the prescription",
        "alias": [
          "prescribing-practitioner"
        ],
        "min": 1,
        "type": [
          {
            "code": "Reference"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.dosageInstruction",
        "path": "MedicationRequest.dosageInstruction",
        "slicing": {
          "description": "slice by type",
          "rules": "open"
        },
        "min": 0,
        "type": [
          {
            "code": "Dosage"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.dosageInstruction.id",
        "path": "MedicationRequest.dosageInstruction.id",
        "min": 1,
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "MedicationRequest.dosageInstruction.text",
        "path": "MedicationRequest.dosageInstruction.text",
        "short": "Free text dosage instructions",
        "alias": [
          "dosage-instruction"
        ],
        "min": 1,
        "type": [
          {
            "code": "string"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.dispenseRequest",
        "path": "MedicationRequest.dispenseRequest",
        "alias": [
          "dosage-instruction"
        ],
        "min": 0,
        "type": [
          {
            "code": "BackboneElement"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.dispenseRequest.numberOfRepeatsAllowed",
        "path": "MedicationRequest.dispenseRequest.numberOfRepeatsAllowed",
        "short": "Number of refills allowed",
        "comment": "Used to calculate number of refills remaining",
        "alias": [
          "total-refills",
          "refills-allowed"
        ],
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "unsignedInt"
          }
        ],
        "mustSupport": true
      }
    ]
  }
}