View source: R/validate_data.R
| validate_prescriptions | R Documentation | 
This function performs a series of checks for mandatory and optional requirements on prescriptions data.
validate_prescriptions(data)
data | 
 a data frame containing one row per prescription  | 
NULL if the data passes the validation. The function will trigger 
errors when mandatory requirements are not met and warnings when
optional requirements are not met.
These fields are required in order to pass the validation:
patient_ida patient identifier with no missing value
prescription_ida prescription identifier with no missing value
prescription_texta character string summarising the prescription 
(to be displayed in user interfaces, eg: 'Amoxicillin oral 500mg BDS')
drug_codeidentifier of the drug (for antibacterials/antifungals, 
use as.ab())
drug_namepreferred name of the drug in the drug dictionary
(see ab_name())
drug_display_namedrug name to display in reports and user interfaces
(can be the same as drug_name)
drug_groupthe antimicrobial class see ab_group()
antiinfective_typetype of antiinfective ("antibacterial", "antifungal", "antiviral", or "antiparasitic")
ATC_codethe ATC code, see ab_atc()
ATC_routeroute of administration as defined in the ATC (
"O" = oral; "P" = parenteral; "Inhal" = inhaled; 
"N" = nasal; "SL" = sublingual/buccal/oromucosal;
"TD" = transdermal; "R" = rectal; "V" = vaginal)
authoring_datetimestamp for when the prescription was issued
prescription_starttimestamp for the prescription start
prescription_endtimestamp for the prescription end (mandated except
for one-off prescriptions with daily_frequency == -1 or 
prescriptions with prescription_status != "completed")
prescription_contexteither 'inpatient', 'opat', or 
'discharge'
prescription_statusone value from the following FHIR R4 reference set:
"active" the prescription is 'actionable', but not all actions 
that are implied by it have occurred yet.
"on-hold" actions implied by the prescription are to be 
temporarily halted, but are expected to continue later. 
"cancelled" the prescription has been withdrawn before any 
administrations have occurred.
"completed" all actions that are implied by the prescription 
have occurred.
"entered-in-error" some of the actions that are implied by the 
medication request may have occurred. For example, the medication may have 
been dispensed and the patient may have taken some of the medication. 
Clinical decision support systems should take this status into account.
"stopped" actions implied by the prescription are to be 
permanently halted, before all of the administrations occurred. This should 
not be used if the original order was entered in error.
"draft" the prescription is not yet 'actionable', e.g. it is a 
work in progress, requires sign-off, verification or needs to be run through 
decision support process.
"unknown" the authoring/source system does not know which of the 
status values currently applies for this observation. Note: This 
concept is not to be used for 'other' - one of the listed statuses is presumed 
to apply, but the authoring/source system does not know which.         
Note that prescriptions marked as "on-hold", "cancelled", 
"draft", "entered-in-error", or "unknown" will not 
count towards therapy episodes or antibiotic consumption estimates.
dosea numeric vector of dosage quantities
unita character vector of dosage units
routethe route of administration value natively assigned by system
frequencya character vector of frequencies of administrations
(eg: "BDS" or "Twice a day"). See also: reference_drug_frequency
daily_frequencya numeric translation of variable frequency
indicating the number of times the drug is to be administered per day. 
Values can be lower than 1 for prescriptions administered less than daily.
Values must be strictly positive, except for the following codes:
-1 for a single one-off administration
-9 for 'as required' (Pro Re Nata) prescriptions
combination_idsystem-issued identifiers for drugs 
prescribed as a bundle to treat the same indication either 
simultaneously (eg clarithromycin and amoxiclav) or consecutively 
(eg doxicycline 200mg followed by 100mg). Unless provided, 
such identifiers will be created by Ramses using 
transitive closure.
DDDthe prescribed daily dose (dose x daily_frequency)
expressed in defined daily doses, see compute_DDDs()
...any other field, as desired, can be loaded into the database
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.