TITLE: Quality of Care Index (QCI)
AUTHORS: Esmaeil Mohammadi, Erfan Ghasemi, Sahar Saeedi Moghaddam, Moein Yoosefi, Shahin Roshani, Naser Ahmadi, Masoud Masinaei, Maryam Nasserinejad, Narges Ebrahimi, Sina Azadnajafabad, Mahtab Rouhifard Khalilabad, Negar Rezaei, Ali H Mokdad, Bagher Larijani, Farshad Farzadfar

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block"><span style = "font-weight:bold;">Abstract</span></div><div class = "text-block"><span>This protocol and set of codes bring forward a newly introduced index and system that can assess the quality of care given to health-seekers on a large-scale, named the quality of care index (QCI). Foremost, QCI is designated for data miners using a large amount of data entry. Dimension reduction approaches are utilized to reduce and ease the complexity of such environments. QCI codes have been trained and built based on the Global Burden of Disease (GBD) database structure [</span><a href="https://vizhub.healthdata.org/gbd-compare" style = "text-decoration:underline;color:blue;cursor:pointer;"><span style = ":;">https://vizhub.healthdata.org/gbd-compare/</span></a><span>]. Other data sources can be fed to the code upon re-structuring to the same formate as GBD's. Only aggregates are compatible for analysis and individual data sets are not appropriate commodities. Codes are considerately embedded in R language, easily transformable to Python. Classically, we use STATA file extensions (.dta) and efforts should be carried out to reformat files into other extensions if desired. Stages of QCI computation are 1. data acquisition 2. data curation 3. data analysis and/or 4. visualization.</span></div></div>

[STEPS]
?. [Data acquisition]
A. Consider retrieving data from the GBD data repository [https://vizhub.healthdata.org/gbd-compare/].B. Use the left sidebars and menus to navigate for causes.C. Primary parameters are required 1. age-standardized mortality rate 2. age-standardized prevalence rate 3. age-standardized incidence rate 4. age-standardized Disability-adjusted life years (DALYs) rate 5. age-standardized years of life lost (YLLs) rate and 6. age-standardized years lived with disability (YLDs) rate.D. The use of age-standardized measures is not mandatory and confounding effects of age and un-even distribution of population pyramid are weighted out.E. Manually inspect each parameter for zero estimates. Zeros interfere with the code and yield odd outputs.F. If nulls were encountered you might proceed with the elimination of the definite stratum with zero or very low estimates. For example, you need to limit your analysis on adults when you are working on gastric cancers as children are much less likely to have it and estimates of GBD (or any other source) are redundantG. Download from the right upper corner (in CSV format)H. You can download a clean template file from this link for 'CNS cancers'.
?. [First time run]
A. First time running the code requires installing some packages. You can do it either manually or let the code take care of it.B. Run the attached code to let R get ready [ or this link]
?. [Data curation]
A. GBD data export is large and hard to digest as it encompasses many regional aggregates and sub-national reports [intact CNS cancers sample in 2017]. We recommend this step to lighten the size of exported data and prune unnecessary details but it is not mandatory.B. We used the iso-3 naming of nations for merging and sub-setting. Any other way is just fine unless changing the cell names or column orders.C. The iso-3 names are attached and can be easily integrated into the main file with merge command [by location_name* or location_id] [CNS cancers sample for reduced version in 2017]D. Attached file is in STATA extension and can be imported to R with read_dta13 command [ or this link]E. Use of iso-3 names is recommended especially for merging two data or visualization on maps as the original full names may differ.*Script 'Georgia' corresponds to both a nation and a state (in the United States). Use of location_name merges these two and should be recoded before
?. [Data analysis]
- Data analysis is made of two steps that are simultaneously performed 1. secondary parameters calculation 2. principal component analysis (PCA) on the secondary parameters. [ or this link]- You only need to define age-groups related to your desired cause on line 44 of the code. By default, it is >1-year-old*. You can choose the options from code line 51. Choose them wisely and based on the GBD Compare tool for non-null estimates. [mind the quotation marks!]- Secondary parameters include four 1. mortality-to-incidence ratio (MIR)** 2. prevalence-to-incidence ratio 3. YLLs-to-YLDs ratio and 4. DALYs-to-prevalence ratio. These four indirectly show the quality of care. We aim to composite these four into one QCI.- The first component of PCA on these four measures are then saved and re-scaled into 0-100 and named QCI- This is a loop, takes some time to calculate based on the dimension of arrays you've chosen [age groups × sex groups].* Age-standardized values are used for the calculation of QCI in a nation as a whole, aimed for comparison purposes. For age-group strata, data are not age-standardized and comparisons should be made with caution.** For some portion of GBD's cause list, estimates of Death are close to zero, or the condition is not lethal. In such a situation, theMIR calculation yields lots of zeros and interfere with PCA. In this condition, code must be modified and MIR needs to be removed.§§§A. Recruit the libraries [Line 1-27] B. Define age groups on line 44C. Line 64, if you plan to use age-standardized estimates, by default it uses 'Rate'; otherwise, for all-age estimates, use 'Number'D. Define your function. The create_data function on line 28thE. Run the create_data functionF. It would ask you for your main data file [in .dta format] that you have downloaded from GBD, paste the location of file on your machine G. Then it would ask for iso-3, paste the address [ or this link]H. Then it would ask for location of folder you plan to save your outputs to.I. If it loops smoothly, it is working fine. Otherwise, a null has encountered and check your dataJ. Wait until it exports the outputs into your working directory. The output file is named 'main_data.dta' [Sample output of CNS cancers].K. The other exported file is 'variance_first_component.dta' that resmble the proportion of information [variance] of all data points of your original data enclosed in QCI.
?. [Visualization (QCI map)]
A. Visualization and maps creation is carried out with the 'ggplot2' and 'sf' packagesB. As this step is obligatory, commands for installing codes have not been implemented in Step 1C.  Use the attached file for the set of codes [ or this link]D. First time usage requires running the first line for installation of packages, otherwise start from line 4E. Recruit libraries from lines 4-13F.  Run line 14 and choose the output of Step 4 (file named as 'main_data.dta' [For a sample output of CNS cancers use this link])G. Run line 15 and choose iso-3 file [ or this link]H. Choose your desired year and sex (either 'Male', 'Female', or 'Both') from line 20I. Run the code line by line to the endJ. A map is created and you can save it [Sample output]K. You can save the output either manually or using the ggsave command
?. [Gender Disparity map]
A. Gender disparity ratio (GDR) is calculated from the QCI of males and females. [ or this link]B. First time usage requires running the first line for installation of packages, otherwise start from line 4C. Recruit libraries from lines 4-13D.  Run line 14 and choose the output of Step 4 (file named as 'main_data.dta' [For a sample output of CNS cancers use this link])E. Run line 15 and choose iso-3 file [ or this link]F. Choose your desired year from line 20G. Run the code line by line to the endH. A map is created and you can save it [Sample output]I. You can save the output either manually or using the ggsave command