Skip to content

medication flags, December 5th 2025 #61

Description

@npenzel

Please add the medication QC as discussed (updated on December 5th).

All flags refer to the past_pharmaceutical_treatment and current_pharmaceutical_treatment_floating_med_{med_number}; med_number = 125 or 2650
I have collected all flags (whether implemented or not).
Please make sure to implement all rules that are outstanding.
Consult Shiva to check them with you after implementation.
For each rule/flag, please make sure to link the lines of your GitHub code (also to the ones that are already implemented).
In brackets, I indicate whether the rule applies to past, current or both (past/current) treatment form.

General QC

  • General branching logic QC: (past/current)
    Is anything missing that should have been filled out following Owen’s general QC rule with the branching logic? I.e., if something needs to be filled it has to be there. Notably, since it’s a floating form, we do not consider the completed button or other calculations (as done for PRESCIENT for other forms).

Date errors

  • modification date after assessments (current)
    Is any visit date interview_date after the modification date. Modification date has to be at or after last visit (e.g., EEG, BPRS, PSYCHS etc.).
    Comment for QC: "Pharmaceutical treatment form modification date (chrpharm_date_mod, chrpharm_date_mod_2) is before last visit/questionnaire. Needs to be updated every time an assessment is done (e.g., form filled out)."
    Subjects who should be flagged
    "ME10086" does not have any modification date, CA41897 chrsofas_interview_date_fu (2025-05-27) is after chrpharm_date_mod (2025-01-21)

  • Mismatch onset vs offset date (past/current)
    Is any onset-date chrpharm_med{med_number}_onset{_past, ''} later than the corresponding offset-date chrpharm_med{med_number}_offset{_past, ''}?
    There is an exception to this rule if medication is ongoing 1909-01-01.

  • Mismatch onset/offset date with modification date (current)
    Is any onset-date chrpharm_med{med_number}_onset or offset-date chrpharm_med{med_number}_offset later than the respective modification-date chrpharm_date_mod, chrpharm_date_mod_2?

  • Mismatch between onset and first dose (current)
    Is any onset-date chrpharm_med{med_number}_onset different from first-dose chrpharm_firstdose_med{med_number}? The first-dose should be the same like the onset date only that it includes a time as well. Owen's QC accounts for the timestamp already correctly (checked on December 4th 2025).
    Subjects who should be flagged
    CA01089

  • medication duplicate (current/past)
    Is any medication a duplicate? 2 medication courses have the same name chrpharm_med{med_number}_name{_past, ''} and overlapping dates (check for onset and offset date) and both medications are simultaneously used chrpharm_med{med_number}_use{_past} == 1.

  • No medication (999) overlaps with medication (current/past)
    Is any course of no medication medication_name contains "999" overlapping with any other medication course? This is not a problem if the onset day and offset day are overlapping (i.e., "equal to" is no problem).
    Example from Scott Woods how clean data should look:
    Course 1: 300 (risp) 2 mg 01/01/2024 01/05/2024
    Course 2: 999 (none) na 01/05/2024 01/25/2024
    Course 3: 300 (risp) 1 mg 01/25/2024 06/05/2024

  • missing offset date to no medication (999) but other medication (current/past)
    Is any course of no medication medication_name contains "999" missing an offset-date (ongoing) but other medication course is coded after onset-date?

  • No ongoing medication in past pharmaceutical treatment form (past)
    Is any offset-date chrpharm_med{med_number}_offset_past ongoing (1901-01-01) in the past pharmaceutical treatment form?
    Comment for QC:
    "chrpharm_med{med_number}_offset_past is ongoing (1901-01-01), but medication courses in past-pharmaceutical treatment form cannot be ongoing. Please add this medication in the current pharmaceutical treatment form."

  • Ongoing medication but offset-date provided (current)
    Is any medication not “ongoing” chrpharm_interm_meds_{med_number} == 2 but offset-date chrpharm_med{med_number}_offset is provided and not 1901-01-01 (ongoing-code). Owen will have to update this in the general QC to include all medication courses for past and current treatment forms.

  • current medication not before past form (current)
    Is any medication offset-date chrpharm_med{med_number}_offset before the assessment date of the past-pharmaceutical treatment form chrpharm_interview_date?
    Subjects who should be flagged
    NC19645

General mismatches

  • No info code "888", but info provided (past/current)
    Does any medication name chrpharm_med{med_number}_name{_past} contain 888 but follow up information is provided?
    Check whether there is any valid information (no missing code) in the fields corresponding to the medication course: chrpharm_interm_meds, chrpharm_med{med_number}_dosage{_past}, chrpharm_med{med_number}_dosage_2{_past}, chrpharm_med{med_number}_frequency{_past}, chrpharm_med{med_number}_comp{_past}, chrpharm_med{med_number}_indication{_past}.
    Comment for QC: “The medication name is chrpharm_med{med_number}_name{_past}, however, based on other fields information is provided. Please check whether 777 seems more appropriate”

  • No medication code "999", but info provided (past/current)
    Does any medication name chrpharm_med{med_number}_name{_past} contain 999 but contains information?
    Check whether there is any valid information (no missing code) in the fields corresponding to the medication course:
    chrpharm_med{med_number}_indication{_past}, chrpharm_med{med_number}_dosage{_past}, chrpharm_med{med_number}_dosage_2{_past}, chrpharm_med{med_number}_frequency{_past}, chrpharm_med{med_number}_comp{_past}.
    Comment for QC: "The medication name is chrpharm_med{med_number}_name{_past}, however, based on other fields information is provided. Please check whether this period was really no medication."

Medication codes

  • blinded medication (past/current)
    Does any medication name chrpharm_med{med_number}_name{_past} contain: 573, 542, 538, 539?
    Comment for QC: “Please check the medication name. Currently, the medication is blinded: chrpharm_med{med_number}_name{_past}. If known by now, please update.”

Other errors

  • compliance range (past/current)
    Is any compliance chrpharm_med{med_number}_comp{_past} out of range (0-100)?

  • Missing code in Frequency per month field (past/current)
    Is any frequency per month field chrpharm_med{med_number}_frequency{_past} below 0 and not -3.
    Exception here is that the field can be -3 to indicate missingness.

Other errors

  • compliance range (past/current)
    Is any compliance chrpharm_med{med_number}_comp{_past} out of range (0-100)?

Moritz Errors

  • Flag if anyone receiving acute injections for longer than two weeks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions