Pre-SEM Medication Prescriptions and Administrations Dataset (1 Year Before Arrival)
melior_pre_sem_medications.Rd
This dataset contains information about medication prescriptions (ordinations) and their administrations from up to one year before healthcare contacts for patients in the SEM cohort from the Melior journal system.
Format
A data frame with 1,265,611 observations and 39 variables:
- contact_id
Character. Unique identifier for each healthcare contact/encounter, serves as a foreign key to link with other datasets. 139,346 unique values. Original field name: KontaktId
- patient_id
Integer. Patient pseudonym identifier, serves as a foreign key to link with other patient-level data. Original field name: Alias
- prescription_id
Integer. Unique identifier for each medication prescription. Range: 2 to 222,842. Original field name: OrdinationId
- prescription_start_date
POSIXct. Date/time when the medication was prescribed. Date range: 2012-01-30 to 2019-08-16. Distribution by year: 2017 (41.8%), 2016 (24.3%), 2018 (22.1%), with smaller percentages from 2012-2015 and 2019. Original field name: Ordination_InsattDatum
- prescription_end_date
POSIXct. Date/time when the medication prescription was discontinued. 653,284 NA values (51.6% of records), suggesting many open-ended prescriptions. Date range: 2015-09-14 to 2021-04-30. Distribution by year: 2017 (49.6%), 2018 (30.7%), 2016 (19.5%), with small fractions from 2015, 2019-2021. Original field name: Ordination_UtsattDatum
- prescription_end_reason
Integer. Numeric code for the reason for discontinuation of the medication. Values range from 0 to 14, with most common values being 0 and 1. The specific meaning of these codes is not documented in the available metadata. Original field name: Ordination_UtsattOrsak
- medication_atc_code
Character. ATC (Anatomical Therapeutic Chemical) classification code. 36,867 NA values (2.9%). 997 unique values, with top codes being N02BE01 (Paracetamol, 11.0%), B05BB01 (Electrolytes, 4.5%), and J01DD01 (Cefotaxime, 4.1%). Original field name: Ordination_ATCKod
- medication_npl_id
Numeric. NPL (National Product List) identifier for the medication. 308 NA values (<0.1%). Original field name: Ordination_NPLId
- medication_full_name
Character. Complete medication name including form, strength, and manufacturer. 5,276 unique values. Most common: "Alvedon® Filmdragerad tablett 500 mg" (5.1%), "Cefotaxim Sandoz Pulver till injektions-/infusionsvätska, lösning" (3.4%), "Ringer-Acetat Baxter Viaflo Infusionsvätska, lösning" (2.5%). Original field name: Ordination_SammansattLakemedelNamn
- medication_name
Character. Brand name of the medication. 2,637 unique values. Most common: "Alvedon®" (7.5%), "Cefotaxim Sandoz" (4.0%), "Ringer-Acetat Baxter Viaflo" (2.5%). 2 NA values (<0.1%). Original field name: Ordination_PreparatNamn
- medication_form
Character. Pharmaceutical form of the medication (e.g., tablet, injection). 25,897 NA values (2.0%). 168 unique values, with most common being "Filmdragerad tablett" (18.4%), "Tablett" (14.7%), and "Infusionsvätska, lösning" (8.5%). Original field name: Ordination_BeredningForm
- medication_form_group
Integer. Code for grouping similar medication forms. Values range from 0 to 141. Original field name: Ordination_BeredningFormGrupp
- container_id
Integer. Identifier for the medication container. Range: 1 to 222,841. Original field name: Ordination_Container
- main_prescription_id
Integer. Identifier linking to the main prescription if this is part of a series. Range: 2 to 222,842. Original field name: HuvudordinationId
- medication_generic_name
Character. Generic name of the medication. 1,228,699 NA values (97.1%). 73 unique values with most common (among non-NA) being "E00327" (1.4%), "E00195" (0.6%). Original field name: Ordination_Lakemedel
- administration_route_code
Integer. Code for route of administration. Values include: 1=oral (most common), 4=intravenous, 6=subcutaneous, 7=intramuscular, 3=rectal. Original field name: Ordination_Administration
- administration_group_code
Integer. Code grouping similar administration routes. Values range from 30400 to 30434. Original field name: Ordination_AdministrationGrupp
- prescriber_id
Integer. Identifier for the healthcare professional who prescribed the medication. Range: 73 to 67,466. Original field name: Ordination_Insattare
- dose_unit_code
Integer. Code for the unit of dose measurement. Values range from 1 to 17. Original field name: Ordination_Dosenhet
- prescription_comment
Character. Free-text comments on the prescription. 1,257,335 NA values (99.3%). 1,358 unique values among non-NA entries. Original field name: Ordination_Kommentar
- prescription_reason
Character. Reason for prescribing the medication. 963,662 NA values (76.1%). 14,871 unique values among non-NA entries, with top reasons being "smärta" (pain, 0.9%), "Smärta" (0.7%), and "infektion" (0.5%). Original field name: Ordination_OrdinationOrsak
- is_new_prescription
Logical. Flag indicating if this is a newly initiated medication (TRUE) or continuation of previous therapy (FALSE). Distribution: FALSE (50.5%), TRUE (49.5%). Original field name: Ordination_Nyinsatt
- is_general_prescription
Integer. Flag indicating if this is a general prescription (1) or patient-specific prescription (0). Nearly all values are 0, with some outliers. Original field name: Ordination_ArGenerellOrdination
- administration_date
POSIXct. Date/time when the medication was administered. Date range: 2016-01-02 to 2018-12-30. Distribution by year: 2017 (50.1%), 2018 (28.5%), 2016 (21.4%). Original field name: Utdelning_UtdeladDatum
- administration_method
Character. Description of the administration method. 19 unique values, with most common being "Adm.sätt, perorala" (oral, 55.1%), "Adm.sätt, ny inf" (new infusion, 22.3%), and "Adm.sätt, ny inj" (new injection, 17.3%). Original field name: Administrationssätt
- administered_dose
Numeric. Actual dose of medication administered. Range: 0 to 201,701, with most values being 0. Mean: 18.78. Original field name: Utdelning_UtdeladDos
- prescribed_dose
Numeric. Prescribed dose of the medication. Range: 0 to 21,000, with most values being 0. Mean: 8.38. Original field name: Dosering_Dosering
- dose_text
Character. Textual representation of the prescribed dose. 2,330 unique values. Most common: "=" (22.8%), "1x1" (11.8%), "1x2" (6.9%). 43 NA values (<0.1%). Original field name: Dosering_Dostext
- dose_type
Integer. Code indicating the type of dosing regimen. Values include: 1=variable dose (63.2%), 0=fixed dose (34.8%), 3=as needed (PRN) (1.7%), 2=other (0.4%). Original field name: Dosering_DosTyp
- dosing_schedule
Character. Schedule for medication administration. 186,088 NA values (14.7%). 118 unique values, with most common being "dag" (daily, 82.7%) followed by "mof" (0.7%), "titos" (0.4%), and "titol" (0.2%). The exact meanings of these abbreviations are not definitively documented, though they likely represent different day combinations for medication administration. Original field name: Ordination_Schema
- responsible_staff_id
Integer. Identifier for the healthcare professional responsible for the care. Range: 73 to 67,466. Original field name: AnsvarigPersonalId
- medication_strength_unit
Character. Unit of measurement for medication strength (e.g., mg, ml). 26,761 NA values (2.1%). 34 unique values, with most common being "mg" (48.0%), "Ospecificerad" (Unspecified, 25.0%), and "mg/ml" (14.6%). Original field name: Ordination_StyrkaEnhet
- medication_strength_numeric
Numeric. Numeric value of medication strength. Range: 0 to 1,000,000, with median of 9. 170 NA values (<0.1%). Original field name: Ordination_StyrkaNumeriskt
- medication_strength_text
Character. Complete textual representation of medication strength. 238,782 NA values (18.9%). 618 unique values, with most common being "500 mg" (9.8%), "5 mg" (6.9%), and "10 mg" (3.9%). Original field name: Ordination_StyrkaAlfanumeriskt
- prescription_duration_days
Numeric. Duration of the prescription in days. Added field, calculated from start and end dates
Details
This file was extracted from the Melior electronic health record system. The original filename indicates it contains information about medication prescriptions (Ordinationer) and administrations (Utdelningar) from one year before patient arrival (EttÅrFöreAnkomst). The dataset provides comprehensive medication information for the SEM cohort patients.
Note
The dataset includes 1,265,611 rows representing 54,118 unique patients, 139,346 unique contacts, and 41,913 unique medication orders
Prescription end dates have 653,284 missing values (51.6% of records)
ATC code N02BE01 (Paracetamol) is the most common medication class, followed by B05BB01 (Electrolytes) and J01DD01 (Third-generation cephalosporins)
Approximately 94.4% of administered doses match exactly with the prescribed doses
Most medications (82.7%) are administered on a daily schedule ("dag")
Administration routes are coded: 1=oral (59.7%), 4=intravenous (22.1%), 6=subcutaneous (13.0%)
Dosing types are coded: 1=variable dose (63.2%), 0=fixed dose (34.8%), 3=as needed/PRN (1.7%)
Approximately 49.5% of prescriptions are newly initiated medications (is_new_prescription=1)
The median prescription duration is 7 days, with the majority being short-term prescriptions (interquartile range: 3-15 days), though some extend up to several years
Medication administration peaks at 8 AM, 12 PM (noon), and 8 PM (20:00), reflecting typical hospital medication administration schedules