Welcome to openEHR! :)
As you've noted in your question, in the currently published openEHR archetypes, the Medication order is the main information component, while the Prescription is a container for orders. There's also a Medication management archetype for documenting the process that happens after the order is issued, as well as a family of smaller archetypes for specifying the details of an order or management action, such as timing, dosage, mixtures, etc.
As you've also noted, the intent of the archetypes is ordering drugs for actual patients to get their treatment. This can happen either as inpatients in a hospital or other institution with all the planning, scheduling and timed administration performed by people other than the patient, or it can happen in an outpatient setting where the patient is dispensed their medication from a pharmacy, and do the rest of the work independently.
I'm not sure how your requirements for an analytics use case would differ from the clinical use case. Could you amend your question to make your requirements clearer?
I'd also like to point you to this document, which while slightly outdated, explains how the archetypes are intended to be used, with practical examples: https://openehr.atlassian.net/wiki/spaces/healthmod/pages/62062602/Examples+of+use+of+Medication+order+archetype+and+associated+cluster+archetypes