├── .gitignore ├── LICENSE ├── NEWS.md ├── README.md ├── closedLoop.pdf ├── cv19index ├── __init__.py ├── __main__.py ├── io.py ├── predict.py ├── preprocess.py ├── resources │ ├── ccsrEdges.txt │ ├── ccsrNodes.txt │ ├── claims.schema.json │ ├── demographics.schema.json │ ├── logistic_regression │ │ └── lr.p │ ├── xgboost │ │ ├── input.csv.schema.json │ │ └── model.pickle │ └── xgboost_all_ages │ │ ├── input.csv.schema.json │ │ └── model.pickle ├── server.py ├── shap_top_factors.py ├── test_predict.py └── util.py ├── examples ├── claims.csv ├── claims.xlsx ├── demographics.csv ├── demographics.xlsx ├── features.csv └── predictions.csv ├── img └── roc.png ├── run_cv19index.py ├── run_test.sh ├── sagemaker ├── Dockerfile └── docker-requirements.txt ├── setup.py └── testData ├── claims_no_inp.csv └── demographics_one_person.csv /.gitignore: -------------------------------------------------------------------------------- 1 | *ipynb_checkpoints* 2 | __pycache__ 3 | .vscode 4 | tmp 5 | /.idea/ 6 | /*.iml 7 | *.egg-info 8 | build 9 | dist 10 | venv/ 11 | /junk.ipynb 12 | cv19index/resources/xgboost/output.csv 13 | cv19index/resources/xgboost/example_input.csv 14 | pytest.xml 15 | /predictions-*.csv 16 | /.pytest_cache/ 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, ClosedLoop.ai 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | THIS SOFTWARE DOES NOT PROVIDE MEDICAL ADVICE IT IS INTENDED FOR INFORMATIONAL 32 | PURPOSES ONLY. IT IS NOT A SUBSTITUTE FOR PROFESSIONAL MEDICAL ADVICE, 33 | DIAGNOSIS OR TREATMENT. NEVER DISREGARD PROFESSIONAL MEDICAL ADVICE OR DELAY 34 | IN SEEKING IT BECAUSE OF SOMETHING YOU HAVE READ IN THIS SOFTWARE OR THE 35 | REPORTS AND RESULTS IT PRODUCES. -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | CV19 Index Change Log 2 | ================== 3 | 4 | This file records the changes in CV19 Index library in reverse chronological order. 5 | 6 | ## v1.1.4 (2020.05.12) 7 | 8 | * Fixes #21, #25, #26, #28 - handle cases where there is no inpatient data. Also fixed some install issues related to having different versions of various dependencies. 9 | 10 | ## v1.1.3 (2020.04.07) 11 | 12 | * Fixes #25 - resources directory missing with PIP install 13 | 14 | ## v1.1.2 (2020.04.07) 15 | 16 | * Fixes #21 - error with newer versions of Pandas 17 | 18 | ## v1.1.1 (2020.04.06) 19 | 20 | * Fixes handling of Excel files for input 21 | * Fixes some broken links in the README. 22 | 23 | ## v1.1.0 (2020.04.06) 24 | This release is a significant update 25 | 26 | #### All ages model 27 | 28 | This release incorporates a new model that is now appropriate for adults ages 18 and over. This model was trained on a combination of the original CMS Medicare data along with additional data provided by [HealthFirst](https://healthfirst.org/). 29 | 30 | The original Medicare only 'xgboost' model is still available by adding a `-m xgboost` option to cv19index. However, even for Medicare populations we recommend moving to the new `xgboost_all_ages` model. This model is now the default. 31 | 32 | #### Other updates 33 | 34 | * The README has been completely rewritten to make the usage more clear. 35 | * We have added prebuilt whl files to make instlalation on windows easier. 36 | * Documented the input and output formats more clearly. 37 | * Removed the old preprocessing code from version 1.0.0 38 | * Corrected a bug with the "# of Admissions" feature. 39 | * Corrected a bug where 3 character ICD-10 codes would not be mapped to CCSR. 40 | * Added a "features.csv" option to enable users to see the result of preprocessing. 41 | * Added a "run_cv19index.py" script that neables running the package without installing from PyPI. 42 | * Several asserts have been added to verify that data types and row counts are correct through the code. 43 | 44 | ##### Acknowledgements 45 | Many thanks to [HealthFirst](https://healthfirst.org/) for being one of the first users of the model and for allowing us to use their data in order to create a model for all ages. 46 | 47 | 48 | 49 | 50 | ## v1.0.2 (2020.03.28) 51 | 52 | Packaged preprocessing code and maint he main entry point `do_run_claims` instead of `do_run` 53 | 54 | 55 | ## v1.0.1 (2020.03.16) 56 | 57 | Initial Release 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [Join us for our webinar](https://closedloop.ai/cv19index-webinar) on the CV19 Index on Wednesday, April 8th, 2020 from 2:00 – 3:00pm CDT. 2 | 3 | __With the 1.1.0 release, the CV19 Index can now make predictions for any adult. It is no longer restricted to Medicare populations.__ 4 | 5 | 6 | 7 | # The COVID-19 Vulnerability Index (CV19 Index) 8 | 9 | [![Ion Channel Status](https://api.ionchannel.io/v1/report/getBadge?project_id=1166459a-15fe-420b-856f-874e612b08a6&branch=master)](http://console.ionchannel.io/) 10 | [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) 11 | [![PyPI version](https://badge.fury.io/py/cv19index.svg)](https://pypi.python.org/pypi/cv19index/) 12 | ![Release](https://img.shields.io/github/release/closedloop-ai/cv19index/all.svg) 13 | 14 | [Install](#installing-the-cv19-index) | 15 | [Data Prep](#data-prep) | 16 | [Running The Model](#running-the-model) | 17 | [Interpreting Results](#interpreting-the-results) | 18 | [Model Performance](#model-performance) | 19 | [Contributing](#contributing-to-the-cv19-index) | 20 | [Release Notes](NEWS.md) 21 | 22 | The COVID-19 Vulnerability Index (CV19 Index) is a predictive model that identifies people who are likely to have a heightened vulnerability to severe complications from COVID-19 (commonly referred to as “The Coronavirus”). The CV19 Index is intended to help hospitals, federal / state / local public health agencies and other healthcare organizations in their work to identify, plan for, respond to, and reduce the impact of COVID-19 in their communities. 23 | 24 | Full information on the CV19 Index, including the links to a full FAQ, User Forums, and information about upcoming Webinars is available at http://cv19index.com 25 | 26 | ## Data Requirements 27 | 28 | This repository provides information for those interested in running the COVID-19 Vulnerability Index on their own data. We provide the index as a pretrained model implemented in Python. We provide the source code, models, and example usage of the CV19 Index. 29 | 30 | The CV19 Index utilizes only a few fields which can be extracted from administrative claims or electronic medical records. The data requirements have intentionally been kept very limited in order to facilitate rapid implementation while still providing good predictive power. ClosedLoop is also offering a free, hosted version of the CV19 Index that uses additional data and provides better accuracy. For more information, see http://cv19index.com 31 | 32 | ## Install 33 | 34 | The CV19 Index can be installed from [PyPI](https://pypi.org/project/shap): 35 | 36 |
 37 | pip install cv19index
 38 | 
39 | 40 | _Notes for windows users_: Some Microsoft Windows users have gotten errors when running pip related to installing the SHAP and XGBoost dependencies. For these users we have provided prebuilt wheel files. To use these, download the wheel for [SHAP](http://c19survey.closedloop.ai/shap-0.35.0-cp37-cp37m-win_amd64.whl) and/or [XGBoost](http://c19survey.closedloop.ai/xgboost-1.0.2-py3-none-win_amd64.whl) to your machine. Then, from the directory where you downloaded the files, run: 41 | 42 |
 43 | pip install xgboost-1.0.2-py3-none-win_amd64.whl
 44 | pip install shap-0.35.0-cp37-cp37m-win_amd64.whl
 45 | 
46 | 47 | These wheel files are for Python 3.7. If you have a different Python version and would like prebuilt binaries, try https://www.lfd.uci.edu/~gohlke/pythonlibs/ . If you still have trouble, please create a GitHub issue. 48 | 49 | ## Data Prep 50 | 51 | The CV19 Index requires 2 data files, a demographics file and a claims file. They can be comma-separated value (CSV) or Excel files. The first row is a header file and remaining rows contain the data. In each file, certain columns are used, and any extra columns will be ignored. 52 | 53 | The model requires at least 6 months of claims history, so only those members with at least 6 months of prior history should be included. It is not necessary that they have any claims during this period. 54 | 55 | Sample input files are in the examples directory. [demographics.xlsx](examples/demographics.xlsx) and [claims.xlsx](examples/claims.xlsx) 56 | 57 | #### Demographics File 58 | 59 | The demographics file should contain one row for each person on whom you want to run a prediction. 60 | 61 | There are 3 required fields in the demographics file: 62 | * __personId__ - An identifier for each person. It is only used as a link into the claims table and to identify individuals in the output file. Each row in the demographics file must have a unique personId. 63 | * __age__ - Current age in years, specified as an integer 64 | * __gender__ - This can either be a string column containing the values 'male' or 'female', or it can be an integer column containing the numbers 0 and 1. For integer columns, 0 is female and 1 is male. Only binary genders are currently supported. 65 | 66 | #### Claims File 67 | 68 | The claims file contains a summary of medical claims for each patient. There can be multiple rows for each patient, one per claim. Both inpatient and outpatient claims should be included in the one file. If a patient has no claims, that patient should have no corresponding rows in this file. 69 | 70 | There are 6 required fields and several optional fields in the claims file: 71 | 72 | * __personId__ - An identified that should match with the `personId` from the demographics table. 73 | * __admitDate__ - For inpatient claims, this is the date of admission to the hospital. For outpatient claims this should be the date of service. This field should always be filled in. Dates in CSV files should be in the form YYYY-MM-DD. 74 | * __dischargeDate__ - For inpatient claims, this is the date of discharge from the hospital. For outpatient claims this should be left empty. 75 | * __erVisit__ - Flag indicating whether this claim was for an emergency room visit. Values which are empty, 0, or false will be considered false. Other values will be considered true. 76 | * __inpatient__ - Flag indicating whether this was an inpatient claim. If true, then dischargeDate should be set. Values which are empty, 0, or false will be considered false. Other values will be considered true. 77 | * __dx1__ - This field contains the primary ICD-10 diagnosis code for the claim. The code should be a string and can be entered with or without the period. e.g. `Z79.4` or `Z794` 78 | * __dx2-dx15__ - These are optional fields that can contain additional diagnosis codes for the claim. The ordering of diagnosis codes is not important. 79 | 80 | Note, if a patient first goes to the emergency room and then is later admitted, both the `erVisit` and `inpatient` flags should be set to true. 81 | 82 | If you need to enter more than 15 diagnosis codes for a claim, you can repeat the row, set the erVisit and inpatient flags to false, and then add in the additional diagnosis codes on the new row. 83 | 84 | ## Running the model 85 | 86 | If you have installed the CV19 Index from PyPI, it will create an executable that you can run. The following command run from the root directory of the GitHub checkout will generate predictions on the example data and put results at `examples/predictions.csv`. 87 | 88 | _Note: The `-a 2018-12-31` is only needed because the example data is from 2018. If you are using current data you can omit this argument._ 89 | 90 | ```bash 91 | cv19index -a 2018-12-31 examples/demographics.csv examples/claims.csv examples/predictions.csv 92 | ``` 93 | 94 | We also prove a `run_cv19index.py` scripts you can use to generate predictions from Python directly: 95 | 96 | ```bash 97 | python run_cv19index.py -a 2018-12-31 examples/demographics.csv examples/claims.csv examples/predictions.csv 98 | ``` 99 | 100 | Help is available which provides full details on all of the available options: 101 | 102 | ```bash 103 | python run_cv19index.py -h 104 | ``` 105 | 106 | ## Interpreting the results 107 | 108 | The output file created by the CV19 Index contains the predictions along with the explanations of the factors the influenced those predictions. 109 | 110 | If you simply want a list of the most vulnerable people, sort the file based on descending prediction. This will give you the population sorted by vulnerability, with the most vulnerable person first. 111 | 112 | If you'd like to do more analysis, the predictions file also contains other information, including explanations of which factors most influenced the risk, both positively and negatively. 113 | 114 | Here is a sample of the predictions output: 115 | 116 | | personId | prediction | risk_score | pos_factors_1 | pos_patient_values_1 | pos_shap_scores_1 | ... | 117 | | ------------- | ------ | ------ | ------ | ------ | ------ | ------ | 118 | | 772775338f7ee353 | 0.017149 | 100 | Diagnosis of Pneumonia | True | 0.358 119 | | d45d10ed2ec861c4 | 0.008979 | 98 | Diagnosis of Pneumonia | True | 0.264 120 | 121 | In addition to the personId, the output contains: 122 | * __prediction__ - This is raw outcome of the model. It should not be interpreted as the probability that the patient will have complications related to COVID-19 due to several factors, including the fact that a proxy endpoint was used and details around how the model was trained. A doubling of the prediction value indicates a doubling of the person's risk. 123 | * __risk_score__ - This percentile which indicates where this prediction lies in the distribution of predictinos on the test set. A value of 95 indicates that the prediction was higher than 95% of the test population, which was designed to be representative of the overall US population. 124 | * __pos_factors_1-10__ - These are the names of the _Contributing Factors_ which most increased the risk for this person. Factor 1 had the largest effect and 10 had the least. Not everyone will have 10 positive factors. 125 | * __pos_patient_values_1-10__ - The feature value that this person had for the associated _Contributing Factor_. For example, if factor 1 is "Diagnosis of Diseases of the circulatory system in the previous 12 months" and the value is "TRUE", that means the most important variable which increased this person's risk is that they were diagnosed with a circulatory disease in the last 12 months. All of the diagnosis categories are available in the [CCSR](https://www.hcup-us.ahrq.gov/toolssoftware/ccsr/ccs_refined.jsp). 126 | * __pos_shap_scores_1-10__ - Contributing factors are calculated using [SHAP scores](https://github.com/slundberg/shap). These are the SHAP scores associated with the factors. 127 | * __neg_factors_1-10__ - These are equivalent to the pos_factors, except these are features that decreased the person's risk. 128 | * __neg_patient_values_1-10__ - These are equivalent to the pos_patient_values, except these are features that decreased the person's risk. 129 | * __neg_shap_scores_1-10__ - These are equivalent to the pos_shap_scores, except these are features that decreased the person's risk. 130 | 131 | 132 | ## Model Performance 133 | There are 3 different versions of the CV19 Index. Each is a different predictive model for the CV19 Index. The models represent different tradeoffs between ease of implementation and overall accuracy. A full description of the creation of these models is available in the accompanying MedRxiv paper, ["Building a COVID-19 Vulnerability Index"](https://www.medrxiv.org/content/10.1101/2020.03.16.20036723v2) (http://cv19index.com). 134 | 135 | The 3 models are: 136 | 137 | * _Simple Linear_ - A simple linear logistic regression model that uses only 14 variables. An implementation of this model is included in this package. This model had a 0.731 ROC AUC on our test set. A pickle file containing the parameters for this model is available in the [lr.p file](cv19index/resources/logistic_regression/lr.p). 138 | 139 | * _Open Source ML_ - An XGBoost model, packaged with this repository, that uses Age, Gender, and 500+ features defined from the [CCSR](https://www.hcup-us.ahrq.gov/toolssoftware/ccsr/ccs_refined.jsp) categorization of diagnosis codes. This model had a 0.810 ROC AUC on our test set. 140 | 141 | * _Free Full_ - An XGBoost model that fully utilizes all the data available in Medicare claims, along with geographically linked public and Social Determinants of Health data. This model provides the highest accuracy of the 3 CV19 Indexes but requires additional linked data and transformations that preclude a straightforward open-source implementation. ClosedLoop is making a free, hosted version of this model available to healthcare organizations. For more information, see http://cv19index.com. 142 | 143 | We evaluate the model using a full train/test split. The models are tested on 369,865 individuals. We express model performance using the standard ROC curves, as well as the following metrics: 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 |
ModelROC AUCSensitivity as 3% Alert RateSensitivity as 5% Alert Rate
Logistic Regression.731.214.314
XGBoost, Diagnosis History + Age.810.234.324
XGBoost, Full Features.810.251.336
170 | 171 | 172 | 173 | ## Contributing to the CV19 Index 174 | 175 | We are not allowed to share the data used to train the models with our collaborators, but there are tons of ways you can help. If you are interested in participating, just pick up one of the issues marked with the GitHub "help wanted" tag or contact us at covid19-info@closedloop.ai 176 | 177 | A few examples are: 178 | * Helping us build mappings from common claims data formats for this predictor, such as OMAP and CCLF. https://www.ohdsi.org/data-standardization/the-common-data-model/ 179 | * Converting CMS BlueButton data into a format usable by this model: https://https://bluebutton.cms.gov/ 180 | * Providing install instructions and support on more platforms. See issue #10 & #11 181 | 182 | 183 | -------------------------------------------------------------------------------- /closedLoop.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/closedLoop.pdf -------------------------------------------------------------------------------- /cv19index/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/cv19index/__init__.py -------------------------------------------------------------------------------- /cv19index/__main__.py: -------------------------------------------------------------------------------- 1 | from .predict import main 2 | 3 | if __name__ == "__main__": 4 | main() 5 | -------------------------------------------------------------------------------- /cv19index/io.py: -------------------------------------------------------------------------------- 1 | # IO functions to read and write model and prediction files in an appropriate format. 2 | 3 | import json 4 | import logging 5 | import math 6 | import pickle 7 | from typing import Dict 8 | import pandas as pd 9 | from pkg_resources import resource_filename 10 | 11 | from .util import schema_dtypes 12 | 13 | logger = logging.getLogger(__name__) 14 | 15 | INDEX = 'personId' 16 | 17 | 18 | def read_model(fpath): 19 | with open(fpath, "rb") as fobj: 20 | return pickle.load(fobj) 21 | 22 | 23 | def get_na_values(dtypes): 24 | # Pandas converts a string with "NA" as a real NaN/Null. We don't want this 25 | # for real string columns. NA can show up as a real flag in data and 26 | # it doesn't mean it should be treated as NaN/Null. 27 | _NA_VALUES = set([ 28 | '-1.#IND', '1.#QNAN', '1.#IND', '-1.#QNAN', '#N/A N/A', '#N/A', 29 | 'N/A', 'n/a', 'NA', '#NA', 'NULL', 'null', 'NaN', '-NaN', 'nan', '-nan', '' 30 | ]) 31 | def na_vals(x): 32 | # For now, only ignore NA conversion for strings. Structs/etc can still use it. 33 | if x in ("str", ): 34 | return [] 35 | else: 36 | return _NA_VALUES 37 | 38 | return {k: na_vals(v) for k, v in dtypes.items()} 39 | 40 | 41 | def read_claim(fpath: str) -> pd.DataFrame: 42 | schame_fpath = resource_filename("cv19index", "resources/claims.schema.json") 43 | return read_frame(fpath, schame_fpath, date_cols = ['admitDate', 'dischargeDate']) 44 | 45 | import collections 46 | 47 | def read_demographics(fpath: str) -> pd.DataFrame: 48 | schema_fpath = resource_filename("cv19index", "resources/demographics.schema.json") 49 | df = read_frame(fpath, schema_fpath).set_index('personId') 50 | duplicates = [x[0] for x in collections.Counter(df.index.values).items() if x[1] > 1] 51 | assert len(duplicates) == 0, f"Duplicate person ids in demographics file: {duplicates[:5]}" 52 | return df 53 | 54 | 55 | def read_frame(fpath, schema_fpath, date_cols = []) -> pd.DataFrame: 56 | XLS = ('xls', 'xlsx', 'xlsm', 'xlsb', 'odf') 57 | 58 | def is_excel(fpath: str) -> bool: 59 | return fpath.endswith(XLS) 60 | 61 | with open(schema_fpath) as f: 62 | schema = json.load(f) 63 | dtypes = schema_dtypes(schema["schema"]) 64 | 65 | if is_excel(fpath): 66 | df = read_excel(fpath, dtypes, date_cols) 67 | elif fpath.endswith(".parquet"): 68 | df = read_parquet(fpath, dtypes, date_cols) 69 | elif fpath.endswith(".csv"): 70 | df = read_csv(fpath, dtypes, date_cols) 71 | else: 72 | raise TypeError(f'This script reads files based the extension.\n' 73 | f'The known extensions are {", ".join(XLS)}, .parquet, .csv' 74 | f'Please ensure your file is one of those file types with correct file extension.') 75 | 76 | return df 77 | 78 | 79 | def read_excel(fpath, dtype, date_cols) -> pd.DataFrame: 80 | na_values = get_na_values(dtype) 81 | 82 | df = pd.read_excel( 83 | fpath, 84 | header=0, 85 | dtype=dtype, 86 | parse_dates=date_cols, 87 | na_values=na_values, 88 | keep_default_na=False 89 | ) 90 | for c in date_cols: 91 | df[c] = pd.to_datetime(df[c], infer_datetime_format = True) 92 | 93 | return df 94 | 95 | 96 | def read_parquet(fpath, dtype, date_cols) -> pd.DataFrame: 97 | df = pd.read_parquet(fpath) 98 | # Now set the index. 99 | df = df.set_index(INDEX) 100 | return df 101 | 102 | 103 | def read_csv(fpath: str, dtype: Dict, date_cols) -> pd.DataFrame: 104 | na_values = get_na_values(dtype) 105 | 106 | # Pandas won't read in ints with NA values, so read those in as floats. 107 | def adj_type(x): 108 | if x == "int32" or x == "int64": 109 | return "float64" 110 | return x 111 | 112 | df = pd.read_csv( 113 | fpath, 114 | header=0, 115 | na_values=na_values, 116 | index_col=False, 117 | keep_default_na=False, 118 | ) 119 | 120 | # Oh, and if there are date/datetime types that are empty, pandas "helps us out" 121 | # by converting those to an int(0) instead of None. 122 | # Thanks pandas, but I'd prefer None here. 123 | for c in date_cols: 124 | df[c] = pd.to_datetime(df[c], infer_datetime_format = True) 125 | 126 | return df 127 | 128 | 129 | def write_predictions(predictions, fpath): 130 | if fpath.endswith(".csv"): 131 | output = predictions.to_csv(index=False, float_format="%f") 132 | elif fpath.endswith(".json"): 133 | if ( 134 | predictions.index.dtypes == "object" 135 | and predictions.index.size > 0 136 | and type(predictions.index[0]) == list 137 | ): 138 | predictions.index = [tuple(l) for l in predictions.index] 139 | js_rec = predictions.to_json(orient="records", double_precision=3) 140 | output = f'{{"records":{js_rec}}}' 141 | elif fpath.endswith(".jsonl"): 142 | # These next two lines are because there was a bug where to_json would 143 | # fail if called with an index that is an array, which happens with 144 | # compound ids. Since writing "records" doesn't write the index, we 145 | # throw it away. 146 | if predictions.index.dtypes == "object": 147 | predictions = predictions.reset_index(drop=True) 148 | output = predictions.to_json(orient="records", lines=True, double_precision=3) 149 | else: 150 | raise Exception( 151 | f"Unsupported output format for {fpath}. Must be .csv, .json, or .jsonl" 152 | ) 153 | with open(fpath, "wt") as fobj: 154 | fobj.write(output) 155 | 156 | 157 | def _eval_array_column(x): 158 | """Takes a column which is a JSON string and converts it into an array.""" 159 | if type(x) == str: 160 | a = eval(x) 161 | if type(a) != list: 162 | raise Exception(f"Unexpected data in array column: {x}") 163 | return a 164 | elif x is None or (type(x) == float and math.isnan(x)): 165 | return [] 166 | else: 167 | msg = f"Unexpected data in array column: {x}" 168 | raise Exception(msg) 169 | -------------------------------------------------------------------------------- /cv19index/predict.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import json 3 | import logging 4 | import math 5 | import urllib 6 | from typing import Any, Dict, List, Tuple 7 | from datetime import datetime 8 | 9 | import numpy as np 10 | import pandas as pd 11 | import xgboost as xgb 12 | from pkg_resources import resource_filename 13 | 14 | from .io import read_frame, read_model, write_predictions, read_claim, read_demographics 15 | from .preprocess import apply_int_mapping, preprocess_xgboost 16 | from .shap_top_factors import ( 17 | append_empty_shap_columns, 18 | calculate_shap_percentile, 19 | filter_rows_with_index, 20 | generate_shap_top_factors, 21 | reset_multiindex, 22 | select_index 23 | ) 24 | 25 | logger = logging.getLogger(__file__) 26 | 27 | PREDICTION_QUANTILES = "prediction_quantiles" 28 | 29 | 30 | def clean_floats(d: pd.DataFrame): 31 | new_d = d.copy() 32 | for k, v in new_d.items(): 33 | if math.isnan(v) or math.isinf(v): 34 | new_d[k] = None 35 | elif isinstance(v, np.float64): 36 | new_d[k] = float(v) 37 | return new_d 38 | 39 | 40 | def rescale_predictions( 41 | predictions: np.ndarray, train_data_stats: Dict[str, Any] 42 | ) -> np.ndarray: 43 | """ 44 | Function to rescale model predictions s.t. they correspond to probabilities. 45 | This funciton is only called if pos_scale_weight > 1. Some background can be 46 | found here: https://github.com/dmlc/xgboost/issues/863 47 | 48 | predictions - the original predictions which need to be rescaled 49 | train_data_stats - dictionary containing the total number of events and number 50 | of rare events 51 | 52 | Returns: rescaled predictions which now correspond to probabilities 53 | """ 54 | 55 | # original total number of events 56 | E = train_data_stats["total_events"] 57 | # original number of rare events 58 | B = train_data_stats["rare_events"] 59 | # original number of non-rare events 60 | A = E - B 61 | # new number of non-rare events 62 | C = A 63 | # new number of rare events 64 | D = A 65 | # new total number of events 66 | F = C + D 67 | 68 | fac1 = (A / E) / (C / F) 69 | fac2 = (B / E) / (D / F) 70 | 71 | def rescale_predictions(p): 72 | a0 = (1 - p) * fac1 73 | 74 | a1 = p * fac2 75 | 76 | return a1 / (a1 + a0) 77 | 78 | predictions = np.apply_along_axis(rescale_predictions, 0, predictions) 79 | 80 | return predictions 81 | 82 | 83 | def perform_predictions( 84 | df: pd.DataFrame, 85 | xmatrix: xgb.DMatrix, 86 | label: np.ndarray, 87 | predictor: Dict[str, Any], 88 | recompute_distribution: bool, 89 | shap_score_99: float = None, 90 | shap_cutoff: float = 0.02, 91 | compute_factors: bool = True, 92 | factor_cutoff: float = None, 93 | quote: bool = True, 94 | **kwargs, 95 | ) -> Tuple[pd.DataFrame, List[float], float, float]: 96 | """ 97 | Build predictions from a trained model, additionally build shap scores and quantiles 98 | 99 | Args: 100 | compute_factors_at_cutoff: float (0, 1], only compute SHAP for rows 101 | beyond this cutoff after sorted by prediction 102 | 103 | return prediction DataFrame, quantiles, shap_base_value, shap_score_99 104 | """ 105 | outcome_column = predictor["outcome_column"] 106 | mapping = predictor["mapping"] 107 | model = predictor["model"] 108 | 109 | predictions = model.predict(xmatrix) 110 | assert len(predictions) == df.shape[0] 111 | 112 | # rescale the predictions if model used scale_pos_weight_flag 113 | if predictor["predictor_type"] == "classification": 114 | if predictor["hyper_params"]["scale_pos_weight"] > 1: 115 | logger.info( 116 | f'Scale pos weight is {predictor["hyper_params"]["scale_pos_weight"]}.' 117 | " Rescaling predictions to probabilities" 118 | ) 119 | predictions = rescale_predictions( 120 | predictions, predictor["train_data_stats"] 121 | ) 122 | else: 123 | logger.info( 124 | f'Scale pos weight is {predictor["hyper_params"]["scale_pos_weight"]}.' 125 | " No need to rescale predictions" 126 | ) 127 | 128 | # If our index is a list type, convert it to tuples 129 | index_name = df.index.name 130 | if df.index.dtype == "object" and df.index.size > 0 and type(df.index[0]) == list: 131 | df.index = [tuple(l) for l in df.index] 132 | df.index.name = index_name 133 | 134 | prediction_quantiles = get_quantiles(predictions, predictor, recompute_distribution) 135 | risk_scores = np.digitize(predictions, prediction_quantiles) 136 | 137 | # need to include the label in the output df for split trains 138 | # in the case of a composite key DataFrame joining doesnt naively work 139 | # instead including it at construction time 140 | pred_dict = { 141 | df.index.name: df.index, 142 | "prediction": predictions, 143 | "risk_score": risk_scores, 144 | } 145 | if label is not None: 146 | pred_dict[outcome_column] = label 147 | prediction_result = pd.DataFrame(pred_dict, index=df.index) 148 | 149 | assert prediction_result.shape[0] == df.shape[0] 150 | 151 | # compute top factors and "base value" using SHAP technique 152 | top_factors, shap_base_value = (None, None) 153 | if compute_factors: 154 | if isinstance(factor_cutoff, float): 155 | compute_factors_cutoff_val = prediction_quantiles[ 156 | int(100 * (1 - factor_cutoff)) 157 | ] 158 | df_cutoff = df[predictions >= compute_factors_cutoff_val] 159 | #logger.info(f"Cutoff df: {df_cutoff}") 160 | top_factors, shap_base_value = generate_shap_top_factors( 161 | df_cutoff, model, outcome_column, mapping, **kwargs 162 | ) 163 | assert top_factors.shape[0] == df.shape[0], f"Found: {top_factors.shape[0]} Expected: {df.shape[0]}" 164 | logger.info( 165 | f"Computed SHAP scores for top {100 * factor_cutoff}% of predictions" 166 | f" resulting in {top_factors.shape[0]} scores." 167 | ) 168 | assert prediction_result.shape[0] == df.shape[0] 169 | prediction_result = prediction_result.join(top_factors) 170 | assert prediction_result.shape[0] == df.shape[0], f"Found: {prediction_result.shape[0]} Expected: {df.shape[0]}" 171 | 172 | empty_list = np.empty(shape=(0,)) 173 | for col_name in top_factors.columns: 174 | prediction_result[col_name] = prediction_result[col_name].apply( 175 | lambda d: d 176 | if (isinstance(d, list) or isinstance(d, np.ndarray)) 177 | else empty_list 178 | ) 179 | else: 180 | top_factors, shap_base_value = generate_shap_top_factors( 181 | df, model, outcome_column, mapping, **kwargs 182 | ) 183 | prediction_result = prediction_result.join(top_factors) 184 | 185 | # If index is tuples, convert it back to list 186 | if type(prediction_result.index[0]) == tuple: 187 | prediction_result[index_name] = [list(l) for l in prediction_result.index] 188 | prediction_result = prediction_result.set_index(index_name, drop=False) 189 | 190 | if compute_factors: 191 | # Calculate 99th percentile shap score if it doesn't already exist 192 | if shap_score_99 is None: 193 | abs_shap_scores = np.abs( 194 | np.concatenate( 195 | prediction_result[ 196 | ["pos_shap_scores", "neg_shap_scores"] 197 | ].values.flatten() 198 | ) 199 | ) 200 | if len(abs_shap_scores) < 1: 201 | shap_score_99 = 0.0 202 | else: 203 | shap_score_99 = np.percentile(abs_shap_scores, 99) 204 | 205 | logger.info(f"Cutoff for SHAP values: {shap_cutoff}") 206 | assert prediction_result.shape[0] == df.shape[0] 207 | 208 | prediction_result["neg_index_filter"] = prediction_result[ 209 | "neg_shap_scores" 210 | ].apply(filter_rows_with_index, args=(shap_cutoff,)) 211 | prediction_result["pos_index_filter"] = prediction_result[ 212 | "pos_shap_scores" 213 | ].apply(filter_rows_with_index, args=(shap_cutoff,)) 214 | 215 | prediction_result["neg_shap_scores_w"] = ( 216 | prediction_result["neg_shap_scores"] / shap_score_99 217 | ) 218 | prediction_result["pos_shap_scores_w"] = ( 219 | prediction_result["pos_shap_scores"] / shap_score_99 220 | ) 221 | 222 | prediction_result["neg_shap_scores"] = ( 223 | reset_multiindex(prediction_result)[["neg_shap_scores", "neg_index_filter"]] 224 | .apply(lambda x: select_index(*x), axis=1) 225 | .values 226 | ) 227 | prediction_result["neg_shap_scores_w"] = ( 228 | reset_multiindex(prediction_result)[ 229 | ["neg_shap_scores_w", "neg_index_filter"] 230 | ] 231 | .apply(lambda x: select_index(*x), axis=1) 232 | .values 233 | ) 234 | def unquote(col): 235 | if quote: 236 | return urllib.parse.unquote(col) 237 | else: 238 | return col 239 | prediction_result["neg_factors"] = ( 240 | reset_multiindex(prediction_result)[["neg_factors", "neg_index_filter"]] 241 | .apply(lambda x: select_index(*x), axis=1) 242 | .apply(lambda x: [unquote(col) for col in x]) 243 | .values 244 | ) 245 | prediction_result["neg_patient_values"] = ( 246 | reset_multiindex(prediction_result)[ 247 | ["neg_patient_values", "neg_index_filter"] 248 | ] 249 | .apply(lambda x: select_index(*x), axis=1) 250 | .values 251 | ) 252 | 253 | prediction_result["pos_shap_scores"] = ( 254 | reset_multiindex(prediction_result)[["pos_shap_scores", "pos_index_filter"]] 255 | .apply(lambda x: select_index(*x), axis=1) 256 | .values 257 | ) 258 | prediction_result["pos_shap_scores_w"] = ( 259 | reset_multiindex(prediction_result)[ 260 | ["pos_shap_scores_w", "pos_index_filter"] 261 | ] 262 | .apply(lambda x: select_index(*x), axis=1) 263 | .values 264 | ) 265 | prediction_result["pos_factors"] = ( 266 | reset_multiindex(prediction_result)[["pos_factors", "pos_index_filter"]] 267 | .apply(lambda x: select_index(*x), axis=1) 268 | .apply(lambda x: [unquote(col) for col in x]) 269 | .values 270 | ) 271 | prediction_result["pos_patient_values"] = ( 272 | reset_multiindex(prediction_result)[ 273 | ["pos_patient_values", "pos_index_filter"] 274 | ] 275 | .apply(lambda x: select_index(*x), axis=1) 276 | .values 277 | ) 278 | 279 | prediction_result = prediction_result.drop( 280 | columns=["neg_index_filter", "pos_index_filter"] 281 | ) 282 | assert prediction_result.shape[0] == df.shape[0] 283 | else: 284 | prediction_result = append_empty_shap_columns(prediction_result) 285 | 286 | return prediction_result, prediction_quantiles, shap_base_value, shap_score_99 287 | 288 | 289 | def flatten_predictions(prediction: pd.DataFrame): 290 | def extract_col(name, ix): 291 | prediction[name].apply(lambda x: x[ix]) 292 | 293 | pos_cols_to_flatten = ['pos_factors', 'pos_patient_values', 'pos_shap_scores'] 294 | neg_cols_to_flatten = ['neg_factors', 'neg_patient_values', 'neg_shap_scores'] 295 | 296 | for i in range(10): 297 | for name in pos_cols_to_flatten: 298 | prediction[f"{name}_{i+1}"] = prediction[name].apply(lambda x: x[i] if i < len(x) else None) 299 | for i in range(10): 300 | for name in neg_cols_to_flatten: 301 | prediction[f"{name}_{i+1}"] = prediction[name].apply(lambda x: x[i] if i < len(x) else None) 302 | 303 | cols_to_drop = ['pos_shap_scores_w', 'neg_shap_scores_w'] 304 | prediction = prediction.drop(cols_to_drop + pos_cols_to_flatten + neg_cols_to_flatten, axis=1) 305 | return prediction 306 | 307 | def get_quantiles( 308 | predictions: np.ndarray, predictor: Dict[str, Any], recompute_distribution: bool 309 | ) -> List[float]: 310 | """ 311 | Helper to get the quantiles of a prediction DataFrame 312 | """ 313 | if recompute_distribution: 314 | q = np.array(range(100)) 315 | prediction_quantiles = list(np.percentile(predictions, q=q)) 316 | else: 317 | prediction_quantiles = predictor[PREDICTION_QUANTILES] 318 | return sorted(prediction_quantiles) 319 | 320 | 321 | def get_agg_preds(val_to_preds: Dict[str, Any]) -> pd.DataFrame: 322 | """ 323 | Take the dictionary that maps the split key to the model output 324 | aggregate the prediction DataFrames together as well as join the label data 325 | which can then be used to build test results 326 | 327 | """ 328 | agg_preds = None 329 | for val, results in val_to_preds.items(): 330 | if agg_preds is None: 331 | agg_preds = results["predictions"] 332 | else: 333 | agg_preds = pd.concat((agg_preds, results["predictions"])) 334 | 335 | return agg_preds 336 | 337 | 338 | def reorder_inputs(df_inputs: pd.DataFrame, predictor: Dict[str, Any]) -> pd.DataFrame: 339 | """This code reorders in the input data frame columns to match the expected order 340 | from training. If the lists of columns don't match, no error is raised, as this 341 | will cause issues later.""" 342 | if set(predictor["model"].feature_names) == set(df_inputs.columns) and predictor[ 343 | "model" 344 | ].feature_names != list(df_inputs.columns): 345 | logger.info("Reordering test inputs to match training.") 346 | return df_inputs.loc[:, predictor["model"].feature_names] 347 | return df_inputs 348 | 349 | 350 | def run_xgb_model(run_df: pd.DataFrame, predictor: Dict, quote: bool, **kwargs) -> pd.DataFrame: 351 | import xgboost as xgb 352 | 353 | df_inputs = apply_int_mapping( 354 | predictor["mapping"], run_df, error_unknown_values=False 355 | ) 356 | 357 | if quote: 358 | df_inputs.columns = [urllib.parse.quote(col) for col in df_inputs.columns] 359 | df_inputs = reorder_inputs(df_inputs, predictor) 360 | run = xgb.DMatrix(df_inputs) 361 | factor_cutoff = ( 362 | kwargs["predict_factor_cutoff"] if "predict_factor_cutoff" in kwargs else 1.0 363 | ) 364 | assert run.num_row() == run_df.shape[0] 365 | assert df_inputs.shape[0] == run_df.shape[0] 366 | 367 | predictions, prediction_quantiles, shap_base_value, _ = perform_predictions( 368 | df_inputs, 369 | run, 370 | None, 371 | predictor, 372 | recompute_distribution=False, 373 | shap_score_99=predictor["shap_score_99"], 374 | factor_cutoff=factor_cutoff, 375 | quote = quote, 376 | **kwargs, 377 | ) 378 | assert predictions.shape[0] == run_df.shape[0] 379 | 380 | shap_pct = predictor.get("shap_pct") 381 | if shap_pct is None: 382 | shap_pct = calculate_shap_percentile(predictions) 383 | 384 | return predictions 385 | 386 | 387 | def write_xgb_predictions(predictions: pd.DataFrame, summary_file): 388 | predictions = flatten_predictions(predictions) 389 | output = predictions.to_csv(index=False, float_format="%f") 390 | 391 | with open(summary_file, "wt") as fobj: 392 | fobj.write(output) 393 | 394 | 395 | def do_run( 396 | input_fpath: str, schema_fpath: str, model_fpath: str, output_fpath: str, quote: bool, **kwargs 397 | ) -> None: 398 | """ 399 | Deprecated run function. Use do_run_claims instead. 400 | """ 401 | logger.info(f"Running {model_fpath} using {input_fpath} to {output_fpath}") 402 | run_df = read_frame(input_fpath, schema_fpath) 403 | 404 | if not run_df.empty: 405 | model = read_model(model_fpath) 406 | out = run_xgb_model(run_df, model, **kwargs) 407 | write_predictions(out, output_fpath) 408 | else: 409 | # If there are no inputs to run predictions on, bypass 410 | # executing the model and output an successful empty file. 411 | write_predictions(run_df, output_fpath) 412 | 413 | 414 | def do_run_claims(fdemo, fclaim, output, model_name, asOfDate, feature_file = None): 415 | """ 416 | Reads in claims and demographics files along with a trained model and generates an output file with predictions. 417 | """ 418 | demo_df = read_demographics(fdemo) 419 | claim_df = read_claim(fclaim) 420 | model_file = resource_filename('cv19index', f'resources/{model_name}/model.pickle') 421 | 422 | logger.info(f"Reading model from {model_file}. Writing results to {output}") 423 | 424 | input_df = preprocess_xgboost(claim_df, demo_df, asOfDate) 425 | assert input_df.shape[0] == demo_df.shape[0], f"Demographics file had {demo_df.shape[0]} lines." 426 | if feature_file is not None: 427 | input_df.to_csv(feature_file) 428 | 429 | model = read_model(model_file) 430 | quote = model_name == 'xgboost_all_ages' 431 | predictions = run_xgb_model(input_df, model, quote = quote) 432 | assert predictions.shape[0] == demo_df.shape[0], f"Predictions file didn't match demographics {predictions.shape[0]} != {demo_df.shape[0]} " 433 | 434 | write_xgb_predictions(predictions, output) 435 | logger.info(f"Done. Wrote {predictions.shape[0]} predictions.") 436 | 437 | 438 | def parser(): 439 | 440 | parser = argparse.ArgumentParser(description="Runs the CV19 Vulnerability Index form the command line. Takes two files as input and produces an output file containing the predictions.") 441 | parser.add_argument("demographics_file", help='Path to the file containing demographics') 442 | parser.add_argument("claims_file", help='Path to the file containing claims data') 443 | parser.add_argument("output_file", default=f'predictions-{datetime.now().strftime("%Y-%M-%dT%H:%m:%S")}.csv', help='Path to the output file containing the results of the predictions.') 444 | parser.add_argument("-f", "--feature-file", help='If specified, writes a CSV file containing the preprocessed features that will be fed to the model.') 445 | parser.add_argument("-m", "--model", choices=["xgboost", "xgboost_all_ages"], default="xgboost_all_ages", help="Name of the model to use. Corresponds to a directory under cv19index/resources.") 446 | parser.add_argument("-a", "--as-of-date", default=pd.to_datetime(datetime.today().isoformat()), help="Claims data uses data from 1 year prior to the prediction date. This defaults to the current date, but can be overridden with this argument.") 447 | 448 | return parser.parse_args() 449 | 450 | 451 | def main(): 452 | logging.basicConfig(level=logging.DEBUG) 453 | args = parser() 454 | do_run_claims(args.demographics_file, args.claims_file, args.output_file, args.model, args.as_of_date, args.feature_file) 455 | -------------------------------------------------------------------------------- /cv19index/preprocess.py: -------------------------------------------------------------------------------- 1 | import json 2 | import logging 3 | import math 4 | import regex as re 5 | from datetime import datetime 6 | 7 | import numpy as np 8 | import pandas as pd 9 | from pkg_resources import resource_filename 10 | 11 | from .util import none_or_nan, nonnull_column 12 | 13 | logger = logging.getLogger(__name__) 14 | 15 | 16 | def apply_int_mapping(mapping, data, error_unknown_values=True): 17 | """Maps strings to integers in a Data Frame using a prespecified mapping. 18 | Takes a mapping of values and applies it to the data. 19 | Null or None values will be mapped over. 20 | Params: 21 | mapping - A nested dictionary of {colName: {'value':mapped_value}} 22 | data - The DataFrame to map 23 | Returns: 24 | A new DataFrame with the string columns mapped. 25 | """ 26 | ret = data.loc[:, list(set(data.columns) - set(mapping.keys()))].copy() 27 | for col, value_map in mapping.items(): 28 | if col not in data.columns: 29 | if error_unknown_values: 30 | logger.error(f'No column named "{col}" in {data.columns}') 31 | raise ValueError(f'No column named "{col}" in {data.columns}') 32 | else: 33 | continue 34 | 35 | ret[col] = data[col].map(value_map) 36 | 37 | # Check if any non-null values in the original array are not mapped 38 | if error_unknown_values and np.any( 39 | np.logical_and(np.isnan(ret[col]), nonnull_column(data[col])) 40 | ): 41 | raise ValueError( 42 | f"Column '{col}' had invalid values:" 43 | f" {set(data[col].unique()) - set(value_map.keys())}." 44 | f" Valid values are {set(value_map.keys())}" 45 | ) 46 | return ret 47 | 48 | 49 | def cleanICD10Syntax(code): 50 | code = str(code) 51 | if len(code) > 3 and '.' not in code: 52 | return code[:3] + '.' + code[3:] 53 | else: 54 | return code 55 | 56 | 57 | def preprocess_xgboost(claim_df: pd.DataFrame, demo_df: pd.DataFrame, asOfDate: pd.datetime): 58 | DIAGNOSIS_COLS = ['dx1', 'dx2', 'dx3', 'dx4', 'dx5', 'dx6', 'dx7', 'dx8', 'dx9', 'dx10', 'dx11', 'dx12', 'dx13', 59 | 'dx14', 'dx15', 'dx16'] 60 | preprocessed_df = demo_df.loc[:,['gender', 'age']].rename(columns={'gender': 'Gender', 'age': 'Age'}) 61 | 62 | logger.debug(f"Beginning claims data frame preprocessing, raw data frame as follows.") 63 | logger.debug(claim_df.head(5)) 64 | 65 | asOfPastYear = str(pd.to_datetime(asOfDate) - pd.DateOffset(years=1))[:10] 66 | 67 | # limit to last year of claims 68 | orig_len = claim_df.shape[0] 69 | claim_df = claim_df[(asOfPastYear <= claim_df['admitDate']) 70 | & (claim_df['admitDate'] <= asOfDate)] 71 | logger.debug(f"Filtered claims to just those within the dates {asOfPastYear} to {asOfDate}. Claim count went from {orig_len} to {len(claim_df)}") 72 | 73 | # total numbers of days in the ER 74 | er_visit = claim_df.loc[claim_df['erVisit'] == True, :].groupby('personId').admitDate.nunique() 75 | preprocessed_df['# of ER Visits (12M)'] = er_visit 76 | 77 | inpatient_rows = claim_df.loc[claim_df['inpatient'] == True, :] 78 | preprocessed_df['# of Admissions (12M)'] = inpatient_rows.groupby('personId').admitDate.nunique() 79 | date_diff = pd.to_timedelta(inpatient_rows['dischargeDate'].dt.date - inpatient_rows['admitDate'].dt.date) 80 | inpatient_days = pd.Series(date_diff.dt.days, index=claim_df['personId']) 81 | preprocessed_df['Inpatient Days'] = inpatient_days.groupby('personId').sum() 82 | 83 | # Cleaning the diagnosis codes to apply to all the dx cols 84 | logger.debug(f"Cleaning diagnosis codes.") 85 | used_diags = [x for x in DIAGNOSIS_COLS if x in claim_df.columns] 86 | for column in used_diags: 87 | claim_df[column] = claim_df.loc[:,column].map(cleanICD10Syntax, na_action='ignore') 88 | 89 | # Generating features for each node 90 | logger.debug(f"Computing diagnosis flags.") 91 | nodes = pd.read_csv(resource_filename('cv19index', 'resources/ccsrNodes.txt')) 92 | edges_df = pd.read_csv(resource_filename('cv19index', 'resources/ccsrEdges.txt')) 93 | edges_df['code'] = edges_df['child'].apply(lambda x: x.split(':')[1]) 94 | 95 | diags_unique = pd.unique(claim_df[used_diags].values.ravel('K')) 96 | diags_dtype = pd.api.types.CategoricalDtype(categories=diags_unique, 97 | ordered=False) 98 | 99 | diags_df = pd.DataFrame() 100 | for column in used_diags: 101 | diags_df[column] = claim_df[column].astype(diags_dtype).cat.codes 102 | 103 | for CCSR, description in nodes.values: 104 | # Getting the codes 105 | codes = edges_df[edges_df['parent'].str.contains(CCSR)]['code'] 106 | #logger.debug(f"Codes are {codes}") 107 | codes_s = pd.unique(codes.astype(diags_dtype).cat.codes) 108 | matches = diags_df.isin(codes_s).any(axis=1) 109 | #logger.debug(f"Matches are {matches.shape[0]}\n{matches.head()}") 110 | selected_claim = claim_df.loc[matches, 'personId'] 111 | #logger.debug(f"selected_claim are {selected_claim.shape[0]}\n{selected_claim.head()}") 112 | selected_personId = np.unique(selected_claim) 113 | #logger.debug(f"Selected are {selected_personId.shape[0]}") 114 | 115 | # Assigning the diagnosis flag to the person 116 | description = re.sub("[^\P{P}-/']+", "_", description.replace(")", "")) 117 | column_name = "Diagnosis of " + description + " in the previous 12 months" 118 | preprocessed_df[column_name] = pd.Series(True, index=selected_personId, dtype=np.bool) 119 | preprocessed_df[column_name] = preprocessed_df[column_name].fillna(False) 120 | #preprocessed_df[column_name] = preprocessed_df[column_name].astype(np.bool) 121 | #logger.debug(f"Final is\n{preprocessed_df[column_name]}") 122 | 123 | # fill in 0's 124 | preprocessed_df.fillna(0, inplace=True) 125 | 126 | logger.debug(f"Preprocessing complete.") 127 | return preprocessed_df 128 | -------------------------------------------------------------------------------- /cv19index/resources/ccsrNodes.txt: -------------------------------------------------------------------------------- 1 | code,description 2 | INF,Certain infectious and parasitic diseases 3 | NEO,Neoplasms 4 | BLD,Diseases of the blood and blood-forming organs and certain disorders involving the immune mechanism 5 | END,"Endocrine, nutritional and metabolic diseases" 6 | MBD,"Mental, behavioral and neurodevelopmental disorders" 7 | NVS,Diseases of the nervous system 8 | EYE,Diseases of the eye and adnexa 9 | EAR,Diseases of the ear and mastoid process 10 | CIR,Diseases of the circulatory system 11 | RSP,Diseases of the respiratory system 12 | DIG,Diseases of the digestive system 13 | SKN,Diseases of the skin and subcutaneous tissue 14 | MUS,Diseases of the musculoskeletal system and connective tissue 15 | GEN,Diseases of the genitourinary system 16 | PRG,"Pregnancy, childbirth and the puerperium" 17 | PNL,Certain conditions originating in the perinatal period 18 | MAL,"Congenital malformations, deformations and chromosomal abnormalities" 19 | SYM,"Symptoms, signs and abnormal clinical and laboratory findings, not elsewhere classified" 20 | INJ,"Injury, poisoning and certain other consequences of external causes" 21 | EXT,External causes of morbidity 22 | FAC,Factors influencing health status and contact with health services 23 | BLD001,Nutritional anemia 24 | BLD002,Hemolytic anemia 25 | BLD003,Aplastic anemia 26 | BLD004,Acute posthemorrhagic anemia 27 | BLD005,Sickle cell trait/anemia 28 | BLD006,Coagulation and hemorrhagic disorders 29 | BLD007,Diseases of white blood cells 30 | BLD008,Immunity disorders 31 | BLD009,Postprocedural or postoperative complications of the spleen 32 | BLD010,Other specified and unspecified hematologic conditions 33 | CIR001,Chronic rheumatic heart disease 34 | CIR002,Acute rheumatic heart disease 35 | CIR003,Nonrheumatic and unspecified valve disorders 36 | CIR004,Endocarditis and endocardial disease 37 | CIR005,Myocarditis and cardiomyopathy 38 | CIR006,Pericarditis and pericardial disease 39 | CIR007,Essential hypertension 40 | CIR008,Hypertension with complications and secondary hypertension 41 | CIR009,Acute myocardial infarction 42 | CIR010,Complications of acute myocardial infarction 43 | CIR011,Coronary atherosclerosis and other heart disease 44 | CIR012,Nonspecific chest pain 45 | CIR013,Acute pulmonary embolism 46 | CIR014,Pulmonary heart disease 47 | CIR015,Other and ill-defined heart disease 48 | CIR016,Conduction disorders 49 | CIR017,Cardiac dysrhythmias 50 | CIR018,Cardiac arrest and ventricular fibrillation 51 | CIR019,Heart failure 52 | CIR020,Cerebral infarction 53 | CIR021,Acute hemorrhagic cerebrovascular disease 54 | CIR022,Sequela of hemorrhagic cerebrovascular disease 55 | CIR023,Occlusion or stenosis of precerebral or cerebral arteries without infarction 56 | CIR024,Other and ill-defined cerebrovascular disease 57 | CIR025,Sequela of cerebral infarction and other cerebrovascular disease 58 | CIR026,Peripheral and visceral vascular disease 59 | CIR027,Arterial dissections 60 | CIR028,Gangrene 61 | CIR029,Aortic; peripheral; and visceral artery aneurysms 62 | CIR030,Aortic and peripheral arterial embolism or thrombosis 63 | CIR031,Hypotension 64 | CIR032,Other specified and unspecified circulatory disease 65 | CIR033,Acute phlebitis; thrombophlebitis and thromboembolism 66 | CIR034,Chronic phlebitis; thrombophlebitis and thromboembolism 67 | CIR035,Varicose veins of lower extremity 68 | CIR036,Postthrombotic syndrome and venous insufficiency/hypertension 69 | CIR037,Vasculitis 70 | CIR038,Postprocedural or postoperative circulatory system complication 71 | CIR039,Other specified diseases of veins and lymphatics 72 | DIG001,Intestinal infection 73 | DIG002,Disorders of teeth and gingiva 74 | DIG003,Diseases of mouth; excluding dental 75 | DIG004,Esophageal disorders 76 | DIG005,Gastroduodenal ulcer 77 | DIG006,Gastrointestinal and biliary perforation 78 | DIG007,Gastritis and duodenitis 79 | DIG008,Other specified and unspecified disorders of stomach and duodenum 80 | DIG009,Appendicitis and other appendiceal conditions 81 | DIG010,Abdominal hernia 82 | DIG011,Regional enteritis and ulcerative colitis 83 | DIG012,Intestinal obstruction and ileus 84 | DIG013,Diverticulosis and diverticulitis 85 | DIG014,Hemorrhoids 86 | DIG015,Anal and rectal conditions 87 | DIG016,Peritonitis and intra-abdominal abscess 88 | DIG017,Biliary tract disease 89 | DIG018,Hepatic failure 90 | DIG019,Other specified and unspecified liver disease 91 | DIG020,Pancreatic disorders (excluding diabetes) 92 | DIG021,Gastrointestinal hemorrhage 93 | DIG022,Noninfectious gastroenteritis 94 | DIG023,Noninfectious hepatitis 95 | DIG024,Postprocedural or postoperative digestive system complication 96 | DIG025,Other specified and unspecified gastrointestinal disorders 97 | EAR001,Otitis media 98 | EAR002,Diseases of middle ear and mastoid (except otitis media) 99 | EAR003,Diseases of inner ear and related conditions 100 | EAR004,Hearing loss 101 | EAR005,Postprocedural or postoperative ear and/or mastoid process complication 102 | EAR006,Other specified and unspecified disorders of the ear 103 | END001,Thyroid disorders 104 | END002,Diabetes mellitus without complication 105 | END003,Diabetes mellitus with complication 106 | END004,"Diabetes mellitus, Type 1" 107 | END005,"Diabetes mellitus, Type 2" 108 | END006,"Diabetes mellitus, due to underlying condition, drug or chemical induced, or other specified type" 109 | END007,Nutritional deficiencies 110 | END008,Malnutrition 111 | END009,Obesity 112 | END010,Disorders of lipid metabolism 113 | END011,Fluid and electrolyte disorders 114 | END012,Cystic fibrosis 115 | END013,Pituitary disorders 116 | END014,Postprocedural or postoperative endocrine or metabolic complication 117 | END015,Other specified and unspecified endocrine disorders 118 | END016,Other specified and unspecified nutritional and metabolic disorders 119 | END017,Sequela of malnutrition and other nutritional deficiencies 120 | EXT001,External cause codes: cut/pierce; initial encounter 121 | EXT002,External cause codes: drowning/submersion; initial encounter 122 | EXT003,External cause codes: fall; initial encounter 123 | EXT004,External cause codes: fire/burn; initial encounter 124 | EXT005,External cause codes: firearm; initial encounter 125 | EXT006,External cause codes: machinery; initial encounter 126 | EXT007,External cause codes: motor vehicle traffic (MVT); initial encounter 127 | EXT008,External cause codes: pedal cyclist; not MVT; initial encounter 128 | EXT009,External cause codes: pedestrian; not MVT; initial encounter 129 | EXT010,External cause codes: transport; not MVT; initial encounter 130 | EXT011,External cause codes: natural/environment; initial encounter 131 | EXT012,External cause codes: bites; initial encounter 132 | EXT013,External cause codes: overexertion; initial encounter 133 | EXT014,External cause codes: poisoning by drug 134 | EXT015,External cause codes: poisoning by non-drug 135 | EXT016,External cause codes: struck by; against; initial encounter 136 | EXT017,External cause codes: suffocation/inhalation; initial encounter 137 | EXT018,"External cause codes: other specified, classifiable and NEC; initial encounter" 138 | EXT019,External cause codes: unspecified mechanism 139 | EXT020,"External cause codes: intent of injury, accidental/unintentional" 140 | EXT021,"External cause codes: intent of injury, self-harm" 141 | EXT022,"External cause codes: intent of injury, assault" 142 | EXT023,"External cause codes: intent of injury, undetermined" 143 | EXT024,"External cause codes: intent of injury, legal intervention/war" 144 | EXT025,"External cause codes: complications of medical and surgical care, initial encounter" 145 | EXT026,External cause codes: activity codes 146 | EXT027,External cause codes: place of occurrence of the external cause 147 | EXT028,External cause codes: evidence of alcohol involvement 148 | EXT029,External cause codes: subsequent encounter 149 | EXT030,External cause codes: sequela 150 | EYE001,Cornea and external disease 151 | EYE002,Cataract and other lens disorders 152 | EYE003,Glaucoma 153 | EYE004,Uveitis and ocular inflammation 154 | EYE005,Retinal and vitreous conditions 155 | EYE006,Neuro-ophthalmology 156 | EYE007,Strabismus 157 | EYE008,Oculofacial plastics and orbital conditions 158 | EYE009,Refractive error 159 | EYE010,Blindness and vision defects 160 | EYE011,Postprocedural or postoperative eye complication 161 | EYE012,Other specified eye disorders 162 | FAC001,Encounter for administrative purposes 163 | FAC002,Encounter for mental health services related to abuse 164 | FAC003,"Encounter for observation and examination for conditions ruled out (excludes infectious disease, neoplasm, mental disorders)" 165 | FAC004,Encounter for prophylactic or other procedures 166 | FAC005,Encounter for prophylactic measures (excludes immunization) 167 | FAC006,Encounter for antineoplastic therapies 168 | FAC007,Encounter for mental health conditions 169 | FAC008,Neoplasm-related encounters 170 | FAC009,"Implant, device or graft related encounter" 171 | FAC010,Other aftercare encounter 172 | FAC011,Counseling related to sexual behavior or orientation 173 | FAC012,Other specified encounters and counseling 174 | FAC013,Contraceptive and procreative management 175 | FAC014,Medical examination/evaluation 176 | FAC015,Resistance to antimicrobial drugs 177 | FAC016,"Exposure, encounters, screening or contact with infectious disease" 178 | FAC017,No immunization or underimmunization 179 | FAC018,Screening for neurocognitive or neurodevelopmental condition 180 | FAC019,Socioeconomic/psychosocial factors 181 | FAC020,Lifestyle/life management factors 182 | FAC021,Personal/family history of disease 183 | FAC022,Acquired absence of limb or organ 184 | FAC023,Organ transplant status 185 | FAC024,Carrier status 186 | FAC025,Other specified status 187 | GEN001,Nephritis; nephrosis; renal sclerosis 188 | GEN002,Acute and unspecified renal failure 189 | GEN003,Chronic kidney disease 190 | GEN004,Urinary tract infections 191 | GEN005,Calculus of urinary tract 192 | GEN006,Other specified and unspecified diseases of kidney and ureters 193 | GEN007,Other specified and unspecified diseases of bladder and urethra 194 | GEN008,Urinary incontinence 195 | GEN009,Hematuria 196 | GEN010,Proteinuria 197 | GEN011,Vesicoureteral reflux 198 | GEN012,Hyperplasia of prostate 199 | GEN013,Inflammatory conditions of male genital organs 200 | GEN014,Erectile dysfunction 201 | GEN015,Male infertility 202 | GEN016,Other specified male genital disorders 203 | GEN017,Nonmalignant breast conditions 204 | GEN018,Inflammatory diseases of female pelvic organs 205 | GEN019,Endometriosis 206 | GEN020,Prolapse of female genital organs 207 | GEN021,Menstrual disorders 208 | GEN022,Benign ovarian cyst 209 | GEN023,Menopausal disorders 210 | GEN024,Female infertility 211 | GEN025,Other specified female genital disorders 212 | GEN026,Postprocedural or postoperative genitourinary system complication 213 | INF001,Tuberculosis 214 | INF002,Septicemia 215 | INF003,Bacterial infections 216 | INF004,Fungal infections 217 | INF005,Foodborne intoxications 218 | INF006,HIV infection 219 | INF007,Hepatitis 220 | INF008,Viral infection 221 | INF009,"Parasitic, other specified and unspecified infections" 222 | INF010,Sexually transmitted infections (excluding HIV and hepatitis) 223 | INF011,Sequela of specified infectious disease conditions 224 | INJ001,"Fracture of head and neck, initial encounter" 225 | INJ002,"Fracture of the spine and back, initial encounter" 226 | INJ003,"Fracture of torso, initial encounter" 227 | INJ004,"Fracture of the upper limb, initial encounter" 228 | INJ005,"Fracture of the lower limb (except hip), initial encounter" 229 | INJ006,"Fracture of the neck of the femur (hip), initial encounter" 230 | INJ007,"Dislocations, initial encounter" 231 | INJ008,"Traumatic brain injury (TBI); concussion, initial encounter" 232 | INJ009,"Spinal cord injury (SCI), initial encounter" 233 | INJ010,"Internal organ injury, initial encounter" 234 | INJ011,"Open wounds of head and neck, initial encounter" 235 | INJ012,"Open wounds to limbs, initial encounter" 236 | INJ013,"Open wounds of trunk, initial encounter" 237 | INJ014,"Amputation of a limb, initial encounter" 238 | INJ015,"Amputation of other body parts, initial encounter" 239 | INJ016,"Injury to blood vessels, initial encounter" 240 | INJ017,"Superficial injury; contusion, initial encounter" 241 | INJ018,"Crushing injury, initial encounter" 242 | INJ019,"Burn and corrosion, initial encounter" 243 | INJ020,"Effect of foreign body entering opening, initial encounter" 244 | INJ021,"Effect of other external causes, initial encounter" 245 | INJ022,"Poisoning by drugs, initial encounter" 246 | INJ023,"Toxic effects, initial encounter" 247 | INJ024,"Sprains and strains, initial encounter" 248 | INJ025,"Injury to nerves, muscles and tendons, initial encounter" 249 | INJ026,Other specified injury 250 | INJ027,Other unspecified injury 251 | INJ028,"Adverse effects of medical drugs, initial encounter" 252 | INJ029,"Underdosing of drugs, initial encounter" 253 | INJ030,Drug induced or toxic related condition 254 | INJ031,Allergic reactions 255 | INJ032,Maltreatment/abuse 256 | INJ033,"Complication of cardiovascular device, implant or graft, initial encounter" 257 | INJ034,"Complication of genitourinary device, implant or graft, initial encounter" 258 | INJ035,"Complication of internal orthopedic device or implant, initial encounter" 259 | INJ036,"Complication of transplanted organs or tissue, initial encounter" 260 | INJ037,"Complication of other surgical or medical care, injury, initial encounter" 261 | INJ038,"Fracture of head and neck, subsequent encounter" 262 | INJ039,"Fracture of the spine and back, subsequent encounter" 263 | INJ040,"Fracture of torso, subsequent encounter" 264 | INJ041,"Fracture of the upper limb, subsequent encounter" 265 | INJ042,"Fracture of lower limb (except hip), subsequent encounter" 266 | INJ043,"Fracture of the neck of the femur (hip), subsequent encounter" 267 | INJ044,"Dislocations, subsequent encounter" 268 | INJ045,"Traumatic brain injury (TBI); concussion, subsequent encounter" 269 | INJ046,"Spinal cord injury (SCI), subsequent encounter" 270 | INJ047,"Internal organ injury, subsequent encounter" 271 | INJ048,"Open wounds of head and neck, subsequent encounter" 272 | INJ049,"Open wounds to limbs, subsequent encounter" 273 | INJ050,"Open wounds of trunk, subsequent encounter" 274 | INJ051,"Amputation of a limb, subsequent encounter" 275 | INJ052,"Amputation of other body parts, subsequent encounter" 276 | INJ053,"Injury to blood vessels, subsequent encounter" 277 | INJ054,"Superficial injury; contusion, subsequent encounter" 278 | INJ055,"Crushing injury, subsequent encounter" 279 | INJ056,"Burns and corrosion, subsequent encounter" 280 | INJ057,"Effect of foreign body entering opening, subsequent encounter" 281 | INJ058,"Effect of other external causes, subsequent encounter" 282 | INJ059,"Poisoning by drugs, subsequent encounter" 283 | INJ060,"Toxic effects, subsequent encounter" 284 | INJ061,"Sprains and strains, subsequent encounter" 285 | INJ062,"Injury to nerves, muscles and tendons, subsequent encounter" 286 | INJ063,"Other specified injury, subsequent encounter" 287 | INJ064,"Other unspecified injuries, subsequent encounter" 288 | INJ065,"Adverse effects of medical drugs, subsequent encounter" 289 | INJ066,"Underdosing of drugs, subsequent encounter" 290 | INJ067,"Allergic reactions, subsequent encounter" 291 | INJ068,"Maltreatment/abuse, subsequent encounter" 292 | INJ069,"Complication of cardiovascular device, implant or graft, subsequent encounter" 293 | INJ070,"Complication of genitourinary device, implant or graft, subsequent encounter" 294 | INJ071,"Complication of internal orthopedic device or implant, subsequent encounter" 295 | INJ072,"Complication of other surgical or medical care, injury, subsequent encounter" 296 | INJ073,"Injury, sequela" 297 | INJ074,"Effect of other external causes, sequela" 298 | INJ075,"Poisoning/toxic effect/adverse effects/underdosing, sequela" 299 | INJ076,"Complication, sequela" 300 | MAL001,Cardiac and circulatory congenital anomalies 301 | MAL002,Digestive congenital anomalies 302 | MAL003,Genitourinary congenital anomalies 303 | MAL004,Nervous system congenital anomalies 304 | MAL005,"Congenital malformations of eye, ear, face, neck" 305 | MAL006,Cleft lip or palate 306 | MAL007,Respiratory congenital malformations 307 | MAL008,Musculoskeletal congenital conditions 308 | MAL009,Chromosomal abnormalities 309 | MAL010,Other specified and unspecified congenital anomalies 310 | MBD001,Schizophrenia spectrum and other psychotic disorders 311 | MBD002,Depressive disorders 312 | MBD003,Bipolar and related disorders 313 | MBD004,Other specified and unspecified mood disorders 314 | MBD005,Anxiety and fear-related disorders 315 | MBD006,Obsessive-compulsive and related disorders 316 | MBD007,Trauma- and stressor-related disorders 317 | MBD008,"Disruptive, impulse-control and conduct disorders" 318 | MBD009,Personality disorders 319 | MBD010,Feeding and eating disorders 320 | MBD011,Somatic disorders 321 | MBD012,Suicidal ideation/attempt/intentional self-harm 322 | MBD013,Miscellaneous mental and behavioral disorders/conditions 323 | MBD014,Neurodevelopmental disorders 324 | MBD015,Neonatal abstinence syndrome 325 | MBD016,Fetal alcohol syndrome 326 | MBD017,Alcohol-related disorders 327 | MBD018,Opioid-related disorders 328 | MBD019,Cannabis-related disorders 329 | MBD020,Sedative-related disorders 330 | MBD021,Stimulant-related disorders 331 | MBD022,Hallucinogen-related disorders 332 | MBD023,Inhalant-related disorders 333 | MBD024,Tobacco-related disorders 334 | MBD025,Other specified substance-related disorders 335 | MBD026,Mental and substance use disorders in remission 336 | MBD027,Suicide attempt/intentional self-harm; subsequent encounter 337 | MBD028,Opioid-related disorders; subsequent encounter 338 | MBD029,Stimulant-related disorders; subsequent encounter 339 | MBD030,Cannabis-related disorders; subsequent encounter 340 | MBD031,Hallucinogen-related disorders; subsequent encounter 341 | MBD032,Sedative-related disorders; subsequent encounter 342 | MBD033,Inhalant-related disorders; subsequent encounter 343 | MBD034,Mental and substance use disorders; sequela 344 | MUS001,Infective arthritis 345 | MUS002,Osteomyelitis 346 | MUS003,Rheumatoid arthritis and related disease 347 | MUS004,Juvenile arthritis 348 | MUS005,Other specified chronic arthropathy 349 | MUS006,Osteoarthritis 350 | MUS007,Other specified joint disorders 351 | MUS008,Immune-mediated/reactive arthropathies 352 | MUS009,Tendon and synovial disorders 353 | MUS010,Musculoskeletal pain 354 | MUS011,Spondylopathies/spondyloarthropathy (including infective) 355 | MUS012,Biomechanical lesions 356 | MUS013,Osteoporosis 357 | MUS014,"Pathological fracture, initial encounter" 358 | MUS015,"Pathological fracture, subsequent encounter" 359 | MUS016,"Stress fracture, initial encounter" 360 | MUS017,"Stress fracture, subsequent encounter" 361 | MUS018,"Atypical fracture, initial encounter" 362 | MUS019,"Atypical fracture, subsequent encounter" 363 | MUS020,"Pathological, stress and atypical fractures, sequela" 364 | MUS021,Acquired foot deformities 365 | MUS022,Scoliosis and other postural dorsopathic deformities 366 | MUS023,Acquired deformities (excluding foot) 367 | MUS024,Systemic lupus erythematosus and connective tissue disorders 368 | MUS025,Other specified connective tissue disease 369 | MUS026,Muscle disorders 370 | MUS027,Musculoskeletal abscess 371 | MUS028,Other specified bone disease and musculoskeletal deformities 372 | MUS029,Disorders of jaw 373 | MUS030,Aseptic necrosis and osteonecrosis 374 | MUS031,Traumatic arthropathy 375 | MUS032,Neurogenic/neuropathic arthropathy 376 | MUS033,Gout 377 | MUS034,Crystal arthropathies (excluding gout) 378 | MUS035,Osteomalacia 379 | MUS036,Autoinflammatory syndromes 380 | MUS037,Postprocedural or postoperative musculoskeletal system complication 381 | NEO001,Head and neck cancers - eye 382 | NEO002,Head and neck cancers - lip and oral cavity 383 | NEO003,Head and neck cancers - throat 384 | NEO004,Head and neck cancers - salivary gland 385 | NEO005,Head and neck cancers - nasopharyngeal 386 | NEO006,Head and neck cancers - hypopharyngeal 387 | NEO007,Head and neck cancers - pharyngeal 388 | NEO008,Head and neck cancers - laryngeal 389 | NEO009,Head and neck cancers - tonsils 390 | NEO010,Head and neck cancers - all other types 391 | NEO011,Cardiac cancers 392 | NEO012,Gastrointestinal cancers - esophagus 393 | NEO013,Gastrointestinal cancers - stomach 394 | NEO014,Gastrointestinal cancers - small intestine 395 | NEO015,Gastrointestinal cancers - colorectal 396 | NEO016,Gastrointestinal cancers - anus 397 | NEO017,Gastrointestinal cancers - liver 398 | NEO018,Gastrointestinal cancers - bile duct 399 | NEO019,Gastrointestinal cancers - gallbladder 400 | NEO020,Gastrointestinal cancers - peritoneum 401 | NEO021,Gastrointestinal cancers - all other types 402 | NEO022,Respiratory cancers 403 | NEO023,Bone cancer 404 | NEO024,Sarcoma 405 | NEO025,Skin cancers - melanoma 406 | NEO026,Skin cancers - basal cell carcinoma 407 | NEO027,Skin cancers - squamous cell carcinoma 408 | NEO028,Skin cancers - all other types 409 | NEO029,Breast cancer - ductal carcinoma in situ (DCIS) 410 | NEO030,Breast cancer - all other types 411 | NEO031,Female reproductive system cancers - uterus 412 | NEO032,Female reproductive system cancers - cervix 413 | NEO033,Female reproductive system cancers - ovary 414 | NEO034,Female reproductive system cancers - fallopian tube 415 | NEO035,Female reproductive system cancers - endometrium 416 | NEO036,Female reproductive system cancers - vulva 417 | NEO037,Female reproductive system cancers - vagina 418 | NEO038,Female reproductive system cancers - all other types 419 | NEO039,Male reproductive system cancers - prostate 420 | NEO040,Male reproductive system cancers - testis 421 | NEO041,Male reproductive system cancers - penis 422 | NEO042,Male reproductive system cancers - all other types 423 | NEO043,Urinary system cancers - bladder 424 | NEO044,Urinary system cancers - ureter and renal pelvis 425 | NEO045,Urinary system cancers - kidney 426 | NEO046,Urinary system cancers - urethra 427 | NEO047,Urinary system cancers - all other types 428 | NEO048,Nervous system cancers - brain 429 | NEO049,Nervous system cancers - all other types 430 | NEO050,Endocrine system cancers - thyroid 431 | NEO051,Endocrine system cancers - pancreas 432 | NEO052,Endocrine system cancers - thymus 433 | NEO053,Endocrine system cancers - adrenocortical 434 | NEO054,Endocrine system cancers - parathyroid 435 | NEO055,Endocrine system cancers - pituitary gland 436 | NEO056,Endocrine system cancers - all other types 437 | NEO057,Hodgkin lymphoma 438 | NEO058,Non-Hodgkin lymphoma 439 | NEO059,Leukemia - acute lymphoblastic leukemia (ALL) 440 | NEO060,Leukemia - acute myeloid leukemia (AML) 441 | NEO061,Leukemia - chronic lymphocytic leukemia (CLL) 442 | NEO062,Leukemia - chronic myeloid leukemia (CML) 443 | NEO063,Leukemia - hairy cell 444 | NEO064,Leukemia - all other types 445 | NEO065,Multiple myeloma 446 | NEO066,Malignant neuroendocrine tumors 447 | NEO067,Mesothelioma 448 | NEO068,Myelodysplastic syndrome (MDS) 449 | NEO069,Cancer of other sites 450 | NEO070,Secondary malignancies 451 | NEO071,"Malignant neoplasm, unspecified" 452 | NEO072,Neoplasms of unspecified nature or uncertain behavior 453 | NEO073,Benign neoplasms 454 | NEO074,Conditions due to neoplasm or the treatment of neoplasm 455 | NVS001,Meningitis 456 | NVS002,Encephalitis 457 | NVS003,Other specified CNS infection and poliomyelitis 458 | NVS004,Parkinson's disease 459 | NVS005,Multiple sclerosis 460 | NVS006,Other specified hereditary and degenerative nervous system conditions 461 | NVS007,Cerebral palsy 462 | NVS008,Paralysis (other than cerebral palsy) 463 | NVS009,Epilepsy; convulsions 464 | NVS010,Headache; including migraine 465 | NVS011,Neurocognitive disorders 466 | NVS012,Transient cerebral ischemia 467 | NVS013,Coma; stupor; and brain damage 468 | NVS014,CNS abscess 469 | NVS015,Polyneuropathies 470 | NVS016,Sleep wake disorders 471 | NVS017,Nerve and nerve root disorders 472 | NVS018,Myopathies 473 | NVS019,Nervous system pain and pain syndromes 474 | NVS020,Other specified nervous system disorders 475 | NVS021,Postprocedural or postoperative nervous system complication 476 | NVS022,Sequela of specified nervous system conditions 477 | PNL001,Liveborn 478 | PNL002,Short gestation; low birth weight; and fetal growth retardation 479 | PNL003,Neonatal acidemia and hypoxia 480 | PNL004,Neonatal cerebral disorders 481 | PNL005,Respiratory distress syndrome 482 | PNL006,Respiratory perinatal condition 483 | PNL007,Hemolytic jaundice and perinatal jaundice 484 | PNL008,Birth trauma 485 | PNL009,Perinatal infections 486 | PNL010,Newborn affected by maternal conditions or complications of labor/delivery 487 | PNL011,Hemorrhagic and hematologic disorders of newborn 488 | PNL012,Neonatal digestive and feeding disorders 489 | PNL013,Other specified and unspecified perinatal conditions 490 | PRG001,Antenatal screening 491 | PRG002,Gestational weeks 492 | PRG003,Spontaneous abortion and complications of spontaneous abortion 493 | PRG004,Induced abortion and complications of termination of pregnancy 494 | PRG005,Ectopic pregnancy and complications of ectopic pregnancy 495 | PRG006,Molar pregnancy and other abnormal products of conception 496 | PRG007,Complications following ectopic and/or molar pregnancy 497 | PRG008,Supervision of high-risk pregnancy 498 | PRG009,"Early, first or unspecified trimester hemorrhage" 499 | PRG010,Hemorrhage after first trimester 500 | PRG011,Early or threatened labor 501 | PRG012,Multiple gestation 502 | PRG013,Maternal care related to fetal conditions 503 | PRG014,Polyhydramnios and other problems of amniotic cavity 504 | PRG015,Obstetric history affecting care in pregnancy 505 | PRG016,Previous C-section 506 | PRG017,Maternal care for abnormality of pelvic organs 507 | PRG018,Maternal care related to disorders of the placenta and placental implantation 508 | PRG019,Diabetes or abnormal glucose tolerance complicating pregnancy; childbirth; or the puerperium 509 | PRG020,Hypertension and hypertensive-related conditions complicating pregnancy; childbirth; and the puerperium 510 | PRG021,Maternal intrauterine infection 511 | PRG022,Prolonged pregnancy 512 | PRG023,Complications specified during childbirth 513 | PRG024,"Malposition, disproportion or other labor complications" 514 | PRG025,Anesthesia complications during pregnancy 515 | PRG026,OB-related trauma to perineum and vulva 516 | PRG027,Complications specified during the puerperium 517 | PRG028,Other specified complications in pregnancy 518 | PRG029,"Uncomplicated pregnancy, delivery or puerperium" 519 | PRG030,Maternal outcome of delivery 520 | RSP001,Sinusitis 521 | RSP002,Pneumonia (except that caused by tuberculosis) 522 | RSP003,Influenza 523 | RSP004,Acute and chronic tonsillitis 524 | RSP005,Acute bronchitis 525 | RSP006,Other specified upper respiratory infections 526 | RSP007,Other specified and unspecified upper respiratory disease 527 | RSP008,Chronic obstructive pulmonary disease and bronchiectasis 528 | RSP009,Asthma 529 | RSP010,Aspiration pneumonitis 530 | RSP011,"Pleurisy, pleural effusion and pulmonary collapse" 531 | RSP012,Respiratory failure; insufficiency; arrest 532 | RSP013,Lung disease due to external agents 533 | RSP014,Pneumothorax 534 | RSP015,Mediastinal disorders 535 | RSP016,Other specified and unspecified lower respiratory disease 536 | RSP017,Postprocedural or postoperative respiratory system complication 537 | SKN001,Skin and subcutaneous tissue infections 538 | SKN002,Other specified inflammatory condition of skin 539 | SKN003,Pressure ulcer of skin 540 | SKN004,Non-pressure ulcer of skin 541 | SKN005,Contact dermatitis 542 | SKN006,Postprocedural or postoperative skin complication 543 | SKN007,Other specified and unspecified skin disorders 544 | SYM001,Syncope 545 | SYM002,Fever 546 | SYM003,Shock 547 | SYM004,Nausea and vomiting 548 | SYM005,Dysphagia 549 | SYM006,Abdominal pain and other digestive/abdomen signs and symptoms 550 | SYM007,Malaise and fatigue 551 | SYM008,Symptoms of mental and substance use conditions 552 | SYM009,Abnormal findings related to substance use 553 | SYM010,Nervous system signs and symptoms 554 | SYM011,Genitourinary signs and symptoms 555 | SYM012,Circulatory signs and symptoms 556 | SYM013,Respiratory signs and symptoms 557 | SYM014,Skin/Subcutaneous signs and symptoms 558 | SYM015,General sensation/perception signs and symptoms 559 | SYM016,Other general signs and symptoms 560 | SYM017,Abnormal findings without diagnosis 561 | -------------------------------------------------------------------------------- /cv19index/resources/claims.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": [ 3 | { 4 | "name": "personId", 5 | "dataType": { 6 | "dataType": "string", 7 | "metadata": {} 8 | } 9 | }, 10 | { 11 | "name": "admitDate", 12 | "dataType": { 13 | "dataType": "date", 14 | "metadata": {} 15 | } 16 | }, { 17 | "name": "dischargeDate", 18 | "dataType": { 19 | "dataType": "date", 20 | "metadata": {} 21 | } 22 | }, { 23 | "name": "erVisit", 24 | "dataType": { 25 | "dataType": "boolean", 26 | "metadata": {} 27 | } 28 | }, { 29 | "name": "inpatient", 30 | "dataType": { 31 | "dataType": "boolean", 32 | "metadata": {} 33 | } 34 | }, { 35 | "name": "dx1", 36 | "dataType": { 37 | "dataType": "string", 38 | "metadata": {} 39 | } 40 | }, { 41 | "name": "dx2", 42 | "dataType": { 43 | "dataType": "string", 44 | "metadata": {} 45 | } 46 | }, { 47 | "name": "dx3", 48 | "dataType": { 49 | "dataType": "string", 50 | "metadata": {} 51 | } 52 | }, { 53 | "name": "dx4", 54 | "dataType": { 55 | "dataType": "string", 56 | "metadata": {} 57 | } 58 | }, { 59 | "name": "dx5", 60 | "dataType": { 61 | "dataType": "string", 62 | "metadata": {} 63 | } 64 | }, { 65 | "name": "dx6", 66 | "dataType": { 67 | "dataType": "string", 68 | "metadata": {} 69 | } 70 | }, { 71 | "name": "dx7", 72 | "dataType": { 73 | "dataType": "string", 74 | "metadata": {} 75 | } 76 | }, { 77 | "name": "dx8", 78 | "dataType": { 79 | "dataType": "string", 80 | "metadata": {} 81 | } 82 | }, { 83 | "name": "dx8", 84 | "dataType": { 85 | "dataType": "string", 86 | "metadata": {} 87 | } 88 | }, { 89 | "name": "dx9", 90 | "dataType": { 91 | "dataType": "string", 92 | "metadata": {} 93 | } 94 | }, { 95 | "name": "dx10", 96 | "dataType": { 97 | "dataType": "string", 98 | "metadata": {} 99 | } 100 | }, { 101 | "name": "dx11", 102 | "dataType": { 103 | "dataType": "string", 104 | "metadata": {} 105 | } 106 | }, { 107 | "name": "dx12", 108 | "dataType": { 109 | "dataType": "string", 110 | "metadata": {} 111 | } 112 | }, { 113 | "name": "dx13", 114 | "dataType": { 115 | "dataType": "string", 116 | "metadata": {} 117 | } 118 | }, { 119 | "name": "dx14", 120 | "dataType": { 121 | "dataType": "string", 122 | "metadata": {} 123 | } 124 | }, { 125 | "name": "dx15", 126 | "dataType": { 127 | "dataType": "string", 128 | "metadata": {} 129 | } 130 | } 131 | ] 132 | } -------------------------------------------------------------------------------- /cv19index/resources/demographics.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema": [ 3 | { 4 | "name": "personId", 5 | "dataType": { 6 | "dataType": "string", 7 | "metadata": {} 8 | } 9 | }, 10 | { 11 | "name": "gender", 12 | "dataType": { 13 | "dataType": "string", 14 | "metadata": {} 15 | } 16 | }, 17 | { 18 | "name": "age", 19 | "dataType": { 20 | "dataType": "integer", 21 | "metadata": {} 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /cv19index/resources/logistic_regression/lr.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/cv19index/resources/logistic_regression/lr.p -------------------------------------------------------------------------------- /cv19index/resources/xgboost/input.csv.schema.json: -------------------------------------------------------------------------------- 1 | {"schema": [{"name": "personId", "dataType": {"dataType": "string", "metadata": {}}}, {"name": "# of ER Visits (12M)", "dataType": {"dataType": "long", "metadata": {}}}, {"name": "Gender", "dataType": {"dataType": "string", "metadata": {}}}, {"name": "Age", "dataType": {"dataType": "long", "metadata": {}}}, {"name": "Diagnosis of Certain infectious and parasitic diseases in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neoplasms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the blood and blood-forming organs and certain disorders involving the immune mechanism in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine_ nutritional and metabolic diseases in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Mental_ behavioral and neurodevelopmental disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the nervous system in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the eye and adnexa in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the ear and mastoid process in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the circulatory system in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the respiratory system in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the digestive system in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the skin and subcutaneous tissue in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the musculoskeletal system and connective tissue in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of the genitourinary system in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pregnancy_ childbirth and the puerperium in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Certain conditions originating in the perinatal period in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Congenital malformations_ deformations and chromosomal abnormalities in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Symptoms_ signs and abnormal clinical and laboratory findings_ not elsewhere classified in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Injury_ poisoning and certain other consequences of external causes in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External causes of morbidity in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Factors influencing health status and contact with health services in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nutritional anemia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hemolytic anemia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Aplastic anemia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute posthemorrhagic anemia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sickle cell trait/anemia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Coagulation and hemorrhagic disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of white blood cells in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Immunity disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative complications of the spleen in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified hematologic conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Chronic rheumatic heart disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute rheumatic heart disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nonrheumatic and unspecified valve disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocarditis and endocardial disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Myocarditis and cardiomyopathy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pericarditis and pericardial disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Essential hypertension in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hypertension with complications and secondary hypertension in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute myocardial infarction in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complications of acute myocardial infarction in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Coronary atherosclerosis and other heart disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nonspecific chest pain in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute pulmonary embolism in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pulmonary heart disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other and ill-defined heart disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Conduction disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cardiac dysrhythmias in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cardiac arrest and ventricular fibrillation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Heart failure in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cerebral infarction in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute hemorrhagic cerebrovascular disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sequela of hemorrhagic cerebrovascular disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Occlusion or stenosis of precerebral or cerebral arteries without infarction in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other and ill-defined cerebrovascular disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sequela of cerebral infarction and other cerebrovascular disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Peripheral and visceral vascular disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Arterial dissections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gangrene in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Aortic_ peripheral_ and visceral artery aneurysms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Aortic and peripheral arterial embolism or thrombosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hypotension in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified circulatory disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute phlebitis_ thrombophlebitis and thromboembolism in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Chronic phlebitis_ thrombophlebitis and thromboembolism in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Varicose veins of lower extremity in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postthrombotic syndrome and venous insufficiency/hypertension in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Vasculitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative circulatory system complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified diseases of veins and lymphatics in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Intestinal infection in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Disorders of teeth and gingiva in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of mouth_ excluding dental in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Esophageal disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastroduodenal ulcer in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal and biliary perforation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastritis and duodenitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified disorders of stomach and duodenum in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Appendicitis and other appendiceal conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Abdominal hernia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Regional enteritis and ulcerative colitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Intestinal obstruction and ileus in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diverticulosis and diverticulitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hemorrhoids in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Anal and rectal conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Peritonitis and intra-abdominal abscess in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Biliary tract disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hepatic failure in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified liver disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pancreatic disorders _excluding diabetes in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal hemorrhage in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Noninfectious gastroenteritis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Noninfectious hepatitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative digestive system complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified gastrointestinal disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Otitis media in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of middle ear and mastoid _except otitis media in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diseases of inner ear and related conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hearing loss in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative ear and/or mastoid process complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified disorders of the ear in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Thyroid disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diabetes mellitus without complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diabetes mellitus with complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diabetes mellitus_ Type 1 in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diabetes mellitus_ Type 2 in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diabetes mellitus_ due to underlying condition_ drug or chemical induced_ or other specified type in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nutritional deficiencies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Malnutrition in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Obesity in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Disorders of lipid metabolism in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fluid and electrolyte disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cystic fibrosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pituitary disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative endocrine or metabolic complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified endocrine disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified nutritional and metabolic disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sequela of malnutrition and other nutritional deficiencies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ cut/pierce_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ drowning/submersion_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ fall_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ fire/burn_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ firearm_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ machinery_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ motor vehicle traffic _MVT_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ pedal cyclist_ not MVT_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ pedestrian_ not MVT_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ transport_ not MVT_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ natural/environment_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ bites_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ overexertion_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ poisoning by drug in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ poisoning by non-drug in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ struck by_ against_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ suffocation/inhalation_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ other specified_ classifiable and NEC_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ unspecified mechanism in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ intent of injury_ accidental/unintentional in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ intent of injury_ self-harm in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ intent of injury_ assault in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ intent of injury_ undetermined in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ intent of injury_ legal intervention/war in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ complications of medical and surgical care_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ activity codes in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ place of occurrence of the external cause in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ evidence of alcohol involvement in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of External cause codes_ sequela in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cornea and external disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cataract and other lens disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Glaucoma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Uveitis and ocular inflammation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Retinal and vitreous conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neuro-ophthalmology in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Strabismus in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Oculofacial plastics and orbital conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Refractive error in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Blindness and vision defects in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative eye complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified eye disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encounter for administrative purposes in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encounter for mental health services related to abuse in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encounter for observation and examination for conditions ruled out _excludes infectious disease_ neoplasm_ mental disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encounter for prophylactic or other procedures in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encounter for prophylactic measures _excludes immunization in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encounter for antineoplastic therapies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encounter for mental health conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neoplasm-related encounters in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Implant_ device or graft related encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other aftercare encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Counseling related to sexual behavior or orientation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified encounters and counseling in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Contraceptive and procreative management in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Medical examination/evaluation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Resistance to antimicrobial drugs in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Exposure_ encounters_ screening or contact with infectious disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of No immunization or underimmunization in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Screening for neurocognitive or neurodevelopmental condition in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Socioeconomic/psychosocial factors in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Lifestyle/life management factors in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Personal/family history of disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acquired absence of limb or organ in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Organ transplant status in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Carrier status in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified status in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nephritis_ nephrosis_ renal sclerosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute and unspecified renal failure in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Chronic kidney disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Urinary tract infections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Calculus of urinary tract in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified diseases of kidney and ureters in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified diseases of bladder and urethra in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Urinary incontinence in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hematuria in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Proteinuria in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Vesicoureteral reflux in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hyperplasia of prostate in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Inflammatory conditions of male genital organs in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Erectile dysfunction in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Male infertility in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified male genital disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nonmalignant breast conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Inflammatory diseases of female pelvic organs in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endometriosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Prolapse of female genital organs in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Menstrual disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Benign ovarian cyst in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Menopausal disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female infertility in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified female genital disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative genitourinary system complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Tuberculosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Septicemia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Bacterial infections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fungal infections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Foodborne intoxications in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of HIV infection in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hepatitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Viral infection in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Parasitic_ other specified and unspecified infections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sexually transmitted infections _excluding HIV and hepatitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sequela of specified infectious disease conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of head and neck_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of the spine and back_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of torso_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of the upper limb_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of the lower limb _except hip_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of the neck of the femur _hip_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Dislocations_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Traumatic brain injury _TBI_ concussion_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Spinal cord injury _SCI_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Internal organ injury_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Open wounds of head and neck_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Open wounds to limbs_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Open wounds of trunk_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Amputation of a limb_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Amputation of other body parts_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Injury to blood vessels_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Superficial injury_ contusion_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Crushing injury_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Burn and corrosion_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Effect of foreign body entering opening_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Effect of other external causes_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Poisoning by drugs_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Toxic effects_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sprains and strains_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Injury to nerves_ muscles and tendons_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified injury in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other unspecified injury in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Adverse effects of medical drugs_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Underdosing of drugs_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Drug induced or toxic related condition in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Allergic reactions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Maltreatment/abuse in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of cardiovascular device_ implant or graft_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of genitourinary device_ implant or graft_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of internal orthopedic device or implant_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of transplanted organs or tissue_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of other surgical or medical care_ injury_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of head and neck_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of the spine and back_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of torso_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of the upper limb_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of lower limb _except hip_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fracture of the neck of the femur _hip_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Dislocations_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Traumatic brain injury _TBI_ concussion_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Spinal cord injury _SCI_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Internal organ injury_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Open wounds of head and neck_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Open wounds to limbs_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Open wounds of trunk_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Amputation of a limb_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Amputation of other body parts_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Injury to blood vessels_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Superficial injury_ contusion_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Crushing injury_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Burns and corrosion_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Effect of foreign body entering opening_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Effect of other external causes_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Poisoning by drugs_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Toxic effects_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sprains and strains_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Injury to nerves_ muscles and tendons_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified injury_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other unspecified injuries_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Adverse effects of medical drugs_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Underdosing of drugs_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Allergic reactions_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Maltreatment/abuse_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of cardiovascular device_ implant or graft_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of genitourinary device_ implant or graft_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of internal orthopedic device or implant_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication of other surgical or medical care_ injury_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Injury_ sequela in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Effect of other external causes_ sequela in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Poisoning/toxic effect/adverse effects/underdosing_ sequela in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complication_ sequela in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cardiac and circulatory congenital anomalies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Digestive congenital anomalies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Genitourinary congenital anomalies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nervous system congenital anomalies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Congenital malformations of eye_ ear_ face_ neck in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cleft lip or palate in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Respiratory congenital malformations in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Musculoskeletal congenital conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Chromosomal abnormalities in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified congenital anomalies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Schizophrenia spectrum and other psychotic disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Depressive disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Bipolar and related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified mood disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Anxiety and fear-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Obsessive-compulsive and related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Trauma- and stressor-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Disruptive_ impulse-control and conduct disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Personality disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Feeding and eating disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Somatic disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Suicidal ideation/attempt/intentional self-harm in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Miscellaneous mental and behavioral disorders/conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neurodevelopmental disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neonatal abstinence syndrome in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fetal alcohol syndrome in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Alcohol-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Opioid-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cannabis-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sedative-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Stimulant-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hallucinogen-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Inhalant-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Tobacco-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified substance-related disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Mental and substance use disorders in remission in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Suicide attempt/intentional self-harm_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Opioid-related disorders_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Stimulant-related disorders_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cannabis-related disorders_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hallucinogen-related disorders_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sedative-related disorders_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Inhalant-related disorders_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Mental and substance use disorders_ sequela in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Infective arthritis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Osteomyelitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Rheumatoid arthritis and related disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Juvenile arthritis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified chronic arthropathy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Osteoarthritis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified joint disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Immune-mediated/reactive arthropathies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Tendon and synovial disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Musculoskeletal pain in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Spondylopathies/spondyloarthropathy _including infective in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Biomechanical lesions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Osteoporosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pathological fracture_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pathological fracture_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Stress fracture_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Stress fracture_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Atypical fracture_ initial encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Atypical fracture_ subsequent encounter in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pathological_ stress and atypical fractures_ sequela in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acquired foot deformities in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Scoliosis and other postural dorsopathic deformities in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acquired deformities _excluding foot in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Systemic lupus erythematosus and connective tissue disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified connective tissue disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Muscle disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Musculoskeletal abscess in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified bone disease and musculoskeletal deformities in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Disorders of jaw in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Aseptic necrosis and osteonecrosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Traumatic arthropathy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neurogenic/neuropathic arthropathy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gout in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Crystal arthropathies _excluding gout in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Osteomalacia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Autoinflammatory syndromes in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative musculoskeletal system complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - eye in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - lip and oral cavity in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - throat in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - salivary gland in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - nasopharyngeal in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - hypopharyngeal in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - pharyngeal in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - laryngeal in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - tonsils in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Head and neck cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cardiac cancers in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - esophagus in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - stomach in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - small intestine in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - colorectal in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - anus in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - liver in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - bile duct in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - gallbladder in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - peritoneum in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gastrointestinal cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Respiratory cancers in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Bone cancer in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sarcoma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Skin cancers - melanoma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Skin cancers - basal cell carcinoma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Skin cancers - squamous cell carcinoma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Skin cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Breast cancer - ductal carcinoma in situ _DCIS in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Breast cancer - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - uterus in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - cervix in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - ovary in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - fallopian tube in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - endometrium in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - vulva in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - vagina in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Female reproductive system cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Male reproductive system cancers - prostate in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Male reproductive system cancers - testis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Male reproductive system cancers - penis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Male reproductive system cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Urinary system cancers - bladder in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Urinary system cancers - ureter and renal pelvis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Urinary system cancers - kidney in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Urinary system cancers - urethra in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Urinary system cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nervous system cancers - brain in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nervous system cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine system cancers - thyroid in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine system cancers - pancreas in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine system cancers - thymus in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine system cancers - adrenocortical in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine system cancers - parathyroid in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine system cancers - pituitary gland in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Endocrine system cancers - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hodgkin lymphoma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Non-Hodgkin lymphoma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Leukemia - acute lymphoblastic leukemia _ALL in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Leukemia - acute myeloid leukemia _AML in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Leukemia - chronic lymphocytic leukemia _CLL in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Leukemia - chronic myeloid leukemia _CML in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Leukemia - hairy cell in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Leukemia - all other types in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Multiple myeloma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Malignant neuroendocrine tumors in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Mesothelioma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Myelodysplastic syndrome _MDS in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cancer of other sites in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Secondary malignancies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Malignant neoplasm_ unspecified in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neoplasms of unspecified nature or uncertain behavior in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Benign neoplasms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Conditions due to neoplasm or the treatment of neoplasm in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Meningitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Encephalitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified CNS infection and poliomyelitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Parkinson's disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Multiple sclerosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified hereditary and degenerative nervous system conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Cerebral palsy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Paralysis _other than cerebral palsy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Epilepsy_ convulsions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Headache_ including migraine in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neurocognitive disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Transient cerebral ischemia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Coma_ stupor_ and brain damage in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of CNS abscess in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Polyneuropathies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sleep wake disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nerve and nerve root disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Myopathies in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nervous system pain and pain syndromes in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified nervous system disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative nervous system complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sequela of specified nervous system conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Liveborn in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Short gestation_ low birth weight_ and fetal growth retardation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neonatal acidemia and hypoxia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neonatal cerebral disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Respiratory distress syndrome in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Respiratory perinatal condition in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hemolytic jaundice and perinatal jaundice in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Birth trauma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Perinatal infections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Newborn affected by maternal conditions or complications of labor/delivery in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hemorrhagic and hematologic disorders of newborn in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Neonatal digestive and feeding disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified perinatal conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Antenatal screening in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Gestational weeks in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Spontaneous abortion and complications of spontaneous abortion in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Induced abortion and complications of termination of pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Ectopic pregnancy and complications of ectopic pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Molar pregnancy and other abnormal products of conception in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complications following ectopic and/or molar pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Supervision of high-risk pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Early_ first or unspecified trimester hemorrhage in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hemorrhage after first trimester in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Early or threatened labor in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Multiple gestation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Maternal care related to fetal conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Polyhydramnios and other problems of amniotic cavity in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Obstetric history affecting care in pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Previous C-section in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Maternal care for abnormality of pelvic organs in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Maternal care related to disorders of the placenta and placental implantation in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Diabetes or abnormal glucose tolerance complicating pregnancy_ childbirth_ or the puerperium in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Hypertension and hypertensive-related conditions complicating pregnancy_ childbirth_ and the puerperium in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Maternal intrauterine infection in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Prolonged pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complications specified during childbirth in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Malposition_ disproportion or other labor complications in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Anesthesia complications during pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of OB-related trauma to perineum and vulva in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Complications specified during the puerperium in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified complications in pregnancy in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Uncomplicated pregnancy_ delivery or puerperium in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Maternal outcome of delivery in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Sinusitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pneumonia _except that caused by tuberculosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Influenza in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute and chronic tonsillitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Acute bronchitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified upper respiratory infections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified upper respiratory disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Chronic obstructive pulmonary disease and bronchiectasis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Asthma in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Aspiration pneumonitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pleurisy_ pleural effusion and pulmonary collapse in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Respiratory failure_ insufficiency_ arrest in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Lung disease due to external agents in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pneumothorax in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Mediastinal disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified lower respiratory disease in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative respiratory system complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Skin and subcutaneous tissue infections in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified inflammatory condition of skin in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Pressure ulcer of skin in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Non-pressure ulcer of skin in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Contact dermatitis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Postprocedural or postoperative skin complication in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other specified and unspecified skin disorders in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Syncope in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Fever in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Shock in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nausea and vomiting in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Dysphagia in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Abdominal pain and other digestive/abdomen signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Malaise and fatigue in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Symptoms of mental and substance use conditions in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Abnormal findings related to substance use in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Nervous system signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Genitourinary signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Circulatory signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Respiratory signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Skin/Subcutaneous signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of General sensation/perception signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Other general signs and symptoms in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "Diagnosis of Abnormal findings without diagnosis in the previous 12 months", "dataType": {"dataType": "boolean", "metadata": {}}}, {"name": "# of Admissions (12M)", "dataType": {"dataType": "long", "metadata": {}}}, {"name": "Inpatient Days", "dataType": {"dataType": "long", "metadata": {}}}]} -------------------------------------------------------------------------------- /cv19index/resources/xgboost/model.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/cv19index/resources/xgboost/model.pickle -------------------------------------------------------------------------------- /cv19index/resources/xgboost_all_ages/model.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/cv19index/resources/xgboost_all_ages/model.pickle -------------------------------------------------------------------------------- /cv19index/server.py: -------------------------------------------------------------------------------- 1 | import tempfile 2 | import time 3 | import pandas as pd 4 | import numpy as np 5 | 6 | from pkg_resources import resource_filename 7 | from flask import Flask, make_response, request, abort 8 | 9 | from .predict import do_run 10 | from .io import read_model 11 | 12 | 13 | def create_model_app(model_fpath, schema_fpath, **kwargs): 14 | model = read_model(model_fpath) 15 | 16 | app = Flask(__name__) 17 | 18 | @app.route("/ping", methods=("GET",)) 19 | def ping(): 20 | return make_response("") 21 | 22 | @app.route("/invocations", methods=("POST",)) 23 | def invocations(): 24 | start = time.time() 25 | 26 | with tempfile.NamedTemporaryFile(suffix=".csv") as input_fobj: 27 | input_fpath = input_fobj.name 28 | 29 | input_fobj.write(request.data) 30 | input_fobj.seek(0) 31 | 32 | with tempfile.NamedTemporaryFile(suffix=".csv") as output_fobj: 33 | output_fpath = output_fobj.name 34 | 35 | try: 36 | do_run(input_fpath, schema_fpath, model_fpath, output_fpath) 37 | except Exception as e: 38 | abort(400, f"Error parsing payload: {e}") 39 | 40 | output_fobj.seek(0) 41 | results = output_fobj.read() 42 | response = make_response(results) 43 | response.mimetyhpe = "text/csv" 44 | return response 45 | 46 | return app 47 | 48 | 49 | def sagemaker_serve(): 50 | app = create_model_app( 51 | resource_filename("cv19index", "resources/xgboost/model.pickle"), 52 | resource_filename("cv19index", "resources/xgboost/input.csv.schema.json"), 53 | ) 54 | app.run("0.0.0.0", 8080, debug=False) 55 | -------------------------------------------------------------------------------- /cv19index/shap_top_factors.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import operator 3 | 4 | import numpy as np 5 | import pandas as pd 6 | import shap 7 | 8 | __all__ = [ 9 | "append_empty_shap_columns", 10 | "calculate_shap_percentile", 11 | "filter_rows_with_index", 12 | "generate_shap_top_factors", 13 | "reset_multiindex", 14 | "select_index", 15 | "shap_score_to_percentile", 16 | ] 17 | 18 | logger = logging.getLogger(__file__) 19 | MAX_FEATURES = 10 20 | 21 | 22 | def get_shap_factor_values(row, shap_score_dict, key): 23 | if key == "pos": 24 | reverse = True 25 | else: 26 | reverse = False 27 | 28 | sorted_shap_score_dict = sorted( 29 | shap_score_dict.items(), key=operator.itemgetter(1), reverse=reverse 30 | ) 31 | 32 | # loop thru top factors and extract factor name, its shap value, and the patient's 33 | # value for that factor 34 | num_features = min(len(sorted_shap_score_dict), MAX_FEATURES) 35 | 36 | factors = [sorted_shap_score_dict[idx][0][:-11] for idx in range(num_features)] 37 | shap_scores = [ 38 | round(row[sorted_shap_score_dict[idx][0]], 3) for idx in range(num_features) 39 | ] 40 | patient_values = [ 41 | row[sorted_shap_score_dict[idx][0][:-11]] for idx in range(num_features) 42 | ] 43 | 44 | row[key + "_factors"] = factors 45 | row[key + "_shap_scores"] = np.array(shap_scores) 46 | row[key + "_patient_values"] = patient_values 47 | 48 | return row 49 | 50 | 51 | # function to construct top factor df in a vectorized way 52 | def build_top_factor_df(row, shap_base_value): 53 | # build dictionary for positive and negative shap_scores 54 | pos_shap_score_dict = {} 55 | neg_shap_score_dict = {} 56 | 57 | for k, v in row.to_dict().items(): 58 | if v is not None and k.endswith("_shap_score") and v > 0.0: 59 | pos_shap_score_dict[k] = v 60 | elif v is not None and k.endswith("_shap_score") and v < 0.0: 61 | neg_shap_score_dict[k] = v 62 | 63 | row = get_shap_factor_values(row, pos_shap_score_dict, "pos") 64 | row = get_shap_factor_values(row, neg_shap_score_dict, "neg") 65 | 66 | return row 67 | 68 | 69 | def unmap_int_cols(df, outcome_column, mapping): 70 | """ 71 | function to unmap categorical columns 72 | 73 | df - dataframe 74 | mapping - mapping dictionary 75 | 76 | returns: df with categorical columns mapped back to original values 77 | """ 78 | for key in mapping.keys(): 79 | 80 | # build the unmapping dictionary for "key" 81 | unmap_dict = {v: k for k, v in mapping[key].items()} 82 | 83 | # apply the unmapping to the items in column "key" 84 | if key != outcome_column: 85 | # df[key] = df[key].apply(lambda x: unmap_dict[x]) 86 | df[key] = df[key].apply( 87 | lambda x: unmap_dict[x] if (np.all(pd.notnull(x))) else None 88 | ) 89 | 90 | return df 91 | 92 | 93 | def append_empty_shap_columns(df): 94 | factor_column_list = [ 95 | "pos_factors", 96 | "pos_shap_scores", 97 | "pos_patient_values", 98 | "pos_shap_scores_w", 99 | "pos_shap_percentile", 100 | "neg_factors", 101 | "neg_shap_scores", 102 | "neg_patient_values", 103 | "neg_shap_scores_w", 104 | "neg_shap_percentile", 105 | ] 106 | # Make a column containing an empty list for every row. 107 | l = [] 108 | v = df[df.columns[0]].apply(lambda x: l) 109 | for c in factor_column_list: 110 | df[c] = v 111 | return df 112 | 113 | 114 | def generate_shap_top_factors( 115 | df, model, outcome_column, mapping, shap_approximate=False, **kwargs 116 | ): 117 | """Computes the contributing factors using the SHAP package and orders 118 | them by absolute value 119 | 120 | Input: feature dataframe and the xgboost model object 121 | Output: dataframe of ordered contributing factors, 122 | their shap value and std devs from population mean 123 | and the patient's feature value 124 | """ 125 | # compute the shap values 126 | logger.warning(f"Computing SHAP scores. Approximate = {shap_approximate}") 127 | shap_values = shap.TreeExplainer(model).shap_values( 128 | df, approximate=shap_approximate, check_additivity=False 129 | ) 130 | logger.warning(f"SHAP values completed") 131 | shap_df = pd.DataFrame(shap_values) 132 | #logger.info(f"SHAP: {shap_df.shape[0]} {df.shape[0]}") 133 | 134 | shap_base_value = shap_df.iloc[0, -1] 135 | 136 | # drop the bias term (last column) - unless it's not present. 137 | if shap_df.shape[1] == df.shape[1] + 1: 138 | shap_df.drop(shap_df.shape[1] - 1, axis=1, inplace=True) 139 | 140 | assert shap_df.shape[0] == df.shape[0], ( 141 | f"shap_values was {shap_df.shape}, didn't have the same number of rows" 142 | f" as {df.shape}" 143 | ) 144 | assert shap_df.shape[1] == df.shape[1], ( 145 | f"shap_values was {shap_df.shape}, did not have the same number of columns" 146 | f" as {df.shape} {shap_df.columns.tolist()}" 147 | ) 148 | 149 | # make a dict for feature name 150 | df_columns = df.columns.tolist() 151 | shap_df_columns = shap_df.columns.tolist() 152 | feature_map = { 153 | shap_df_columns[i]: df_columns[i] + "_shap_score" 154 | for i in range(len(df_columns)) 155 | } 156 | 157 | # rename columns to align with passed in df 158 | shap_df.rename(columns=feature_map, inplace=True) 159 | shap_df.index = df.index 160 | 161 | # join original data with shap_df 162 | assert shap_df.shape[0] == df.shape[0] 163 | assert len(set(shap_df.index.values)) == df.shape[0] 164 | assert len(set(df.index.values)) == df.shape[0] 165 | assert (shap_df.index.values == df.index.values).all() 166 | #joined_df = pd.merge(df, shap_df, left_index=True, right_index=True) 167 | joined_df = df.join(shap_df) 168 | assert joined_df.shape[0] == df.shape[0], f"{joined_df.shape[0]} == {df.shape[0]}" 169 | 170 | # unmap categorical columns 171 | joined_df = unmap_int_cols(joined_df, outcome_column, mapping) 172 | 173 | # initialize top factor columns (capped at MAX_FEATURES) 174 | num_features = len(shap_df_columns) 175 | if num_features > MAX_FEATURES: 176 | num_features = MAX_FEATURES 177 | factor_column_list = [ 178 | "pos_factors", 179 | "pos_shap_scores", 180 | "pos_patient_values", 181 | "neg_factors", 182 | "neg_shap_scores", 183 | "neg_patient_values", 184 | ] 185 | 186 | # use build_top_factor_df function to compute top factor info 187 | joined_df = joined_df.apply(build_top_factor_df, args=(shap_base_value,), axis=1) 188 | 189 | # keep only the top factor columns 190 | top_factor_df = joined_df[factor_column_list] 191 | 192 | return top_factor_df, shap_base_value 193 | 194 | 195 | def calculate_shap_percentile(pred): 196 | """Computes the percentile of a distribution of SHAP scores 197 | input: dataframe with pos and neg shap score column_names 198 | output: array of percentiles for abs() value of all shap scores 199 | """ 200 | 201 | pos_shap_scores = np.abs(np.hstack(pred["pos_shap_scores"])) 202 | neg_shap_scores = np.abs(np.hstack(pred["neg_shap_scores"])) 203 | all_shap_scores = np.concatenate([pos_shap_scores, neg_shap_scores]) 204 | 205 | q = np.array(range(100)) 206 | 207 | if len(all_shap_scores) == 0: 208 | all_shap_scores = [0.0] 209 | shap_pct = np.percentile(all_shap_scores, q) 210 | 211 | return shap_pct 212 | 213 | 214 | def filter_rows_with_index(r, cutoff): 215 | """Return index of items in the list above the cutoff""" 216 | return [i for i, x in enumerate(r) if abs(x) > cutoff] 217 | 218 | 219 | def select_index(r, i): 220 | """Return the items in the list from the specified index list""" 221 | return list(np.take(r, i)) 222 | 223 | 224 | def reset_multiindex(df): 225 | return df.reset_index(drop=True, level=0) 226 | -------------------------------------------------------------------------------- /cv19index/test_predict.py: -------------------------------------------------------------------------------- 1 | from cv19index.io import read_demographics, read_claim 2 | from .predict import do_run_claims, do_run 3 | from .preprocess import preprocess_xgboost 4 | from datetime import datetime 5 | import pandas as pd 6 | 7 | 8 | def test_do_run_claims(): 9 | do_run_claims('examples/demographics.csv', 10 | 'examples/claims.csv', 11 | f'predictions-{datetime.now().strftime("%Y-%M-%dT%H-%m-%S")}.csv', 12 | 'xgboost_all_ages', 13 | pd.to_datetime('2018-12-01')) 14 | 15 | def test_do_run_claims_xgboost(): 16 | do_run_claims('examples/demographics.csv', 17 | 'examples/claims.csv', 18 | f'predictions-{datetime.now().strftime("%Y-%M-%dT%H-%m-%S")}.csv', 19 | 'xgboost', 20 | pd.to_datetime('2018-12-01')) 21 | 22 | def test_do_run_claims_no_inp(): 23 | do_run_claims('testData/demographics_one_person.csv', 24 | 'testData/claims_no_inp.csv', 25 | f'predictions-{datetime.now().strftime("%Y-%M-%dT%H-%m-%S")}.csv', 26 | 'xgboost_all_ages', 27 | pd.to_datetime('2018-12-01')) 28 | 29 | def test_do_run_claims_xlsx(): 30 | do_run_claims('examples/demographics.xlsx', 31 | 'examples/claims.xlsx', 32 | f'predictions-{datetime.now().strftime("%Y-%M-%dT%H-%m-%S")}.csv', 33 | 'xgboost_all_ages', 34 | pd.to_datetime('2018-12-01')) 35 | -------------------------------------------------------------------------------- /cv19index/util.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | import numpy as np 4 | import pandas as pd 5 | 6 | _defaultDtypeDict = { 7 | "string": "str", 8 | "struct": "object", 9 | "boolean": "bool", 10 | "double": "float64", 11 | "integer": "int32", 12 | "long": "int64", 13 | "date": "object", 14 | "timestamp": "object", 15 | "datetime": "object", 16 | "array": "object", 17 | } 18 | 19 | 20 | class UserException(Exception): 21 | """Raise for exceptions that indicate bad input """ 22 | 23 | 24 | def schema_dtypes(schema_json: list, dtype_dict=None): 25 | if dtype_dict is None: 26 | dtype_dict = _defaultDtypeDict 27 | 28 | def lookup(x): 29 | t = dtype_dict.get(x["dataType"]["dataType"]) 30 | assert len(t) > 0 31 | return t 32 | 33 | return {x["name"]: lookup(x) for x in schema_json} 34 | 35 | 36 | def nonnull_column(s: pd.Series): 37 | """ Takes a pandas Series and return sa vector of all entries that have 38 | values (are not None or float.nan). 39 | """ 40 | if s.dtype == float: 41 | return np.logical_not(np.isnan(s)) 42 | else: 43 | return np.logical_not(pd.isnull(s)) 44 | 45 | 46 | def none_or_nan(v): 47 | """Returns True if the value is None or float('nan')""" 48 | return v is None or (isinstance(v, float) and math.isnan(v)) 49 | -------------------------------------------------------------------------------- /examples/claims.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/examples/claims.xlsx -------------------------------------------------------------------------------- /examples/demographics.csv: -------------------------------------------------------------------------------- 1 | personId,gender,age,extraColumnsAreIgnored 2 | 772775338f7ee353,male,73,0 3 | d45d10ed2ec861c4,male,89,0 4 | 590bda01eeb795ee,male,71,0 5 | 14ad855b9fc39501,female,68,0 6 | 48b8f6c7a0435491,female,67,0 7 | fa97e785e0e2ca8e,male,74,0 8 | 7de0a4effc42449b,male,84,0 9 | 21640e27ebae18b1,female,68,0 10 | 254256f5c4821dda,male,85,0 11 | 57dec386b49374b3,female,30,0 12 | af63238c3582818c,male,88,0 13 | d58b7ccc39e1b6f9,female,90,0 14 | ce80f245ff6e9911,female,59,0 15 | e67d374e4aa8c18d,male,81,0 16 | a1f3a2c2be7e69ba,female,91,0 17 | e77d12a40f1d0056,female,91,0 18 | fa3445db652cc1c7,female,54,0 19 | ad607b80dc9fd08b,female,73,0 20 | bb428e87fb20bba2,male,72,0 21 | 5379a6c06156a37c,male,78,0 22 | 8e7898a9584a367b,female,53,0 23 | d021a3c4eb4bd844,male,74,0 24 | 787f03ed168e4515,female,76,0 25 | 4c57386bf0e4f732,female,78,0 26 | ebe936b2140d16ba,female,101,0 27 | 334a902d17e189fa,male,76,0 28 | 53dc3bf6b9ed0a45,male,69,0 29 | de777bf0db10a1e7,female,89,0 30 | 6a7061e81b48d3ab,female,78,0 31 | 2ac8e1ad58d0a95e,male,70,0 32 | 67a9dbac2cb063e5,female,77,0 33 | 4040ed7460acbc27,female,85,0 34 | 538dd86e5375a3cf,male,64,0 35 | 97e539e1d10a1b45,male,85,0 36 | 9477f3bb9a01b79a,male,79,0 37 | d8298885883807be,male,53,0 38 | 2b48c94be790dcc3,female,86,0 39 | a2499879d92c0469,male,64,0 40 | 7c5b6bd933264e43,female,85,0 41 | 2e915c2495bdee33,female,74,0 42 | eaec35043098bdc6,male,57,0 43 | e575de21c89456aa,female,57,0 44 | 78e73ddb7e41c0ad,female,86,0 45 | a411925f3fae9c52,male,76,0 46 | 92e2ae9572cd138b,male,82,0 47 | 6416ef7e2a050291,female,72,0 48 | cf7e65d9f8699fb0,male,76,0 49 | 6e2784a6ebbe7f0e,female,73,0 50 | 1d5dfab553bb7038,male,59,0 51 | 88cc50f69075b7d4,female,68,0 52 | 84b4af0a52504eba,female,68,0 53 | 819eea80ec915e16,male,72,0 54 | 5c611ee0dcaf4b89,male,73,0 55 | 177c6e534e755f2c,female,87,0 56 | bcce7a564f07c151,male,71,0 57 | e7332f7349da059d,female,99,0 58 | 7623751fa7363867,male,79,0 59 | 7ddcb26a671bad6c,male,85,0 60 | aa6b997a8c3fa6a3,female,69,0 61 | 5cb6436eee451a97,female,69,0 62 | 17871f5bbf41cf34,female,75,0 63 | b2c5ec11092d545c,male,75,0 64 | 6ddcf97fece65757,male,92,0 65 | 679a6cc94e833c09,male,71,0 66 | b34a60d46a2209a4,male,81,0 67 | d2e86810a90cab46,male,90,0 68 | 2b07e973bbf7cc8e,female,76,0 69 | 56f028d28d8fcc6e,female,72,0 70 | a4a7968a6e3335c4,male,76,0 71 | 58c125a10de641d3,male,76,0 72 | 584631bf824565eb,male,62,0 73 | f18c376fcec23980,male,69,0 74 | 3ede4ad936370c2f,male,69,0 75 | ebb9814398fd75a6,male,89,0 76 | dab732bebfe8d372,female,73,0 77 | 7f88b709ba1b069c,female,97,0 78 | 2614b876293a6755,female,78,0 79 | 1fd3945385a15b13,male,71,0 80 | eb9f682bc8ee320c,female,90,0 81 | 72605dd7e02d78d8,male,41,0 82 | baaa5de154e66baa,female,87,0 83 | 986887f9b00865f3,male,73,0 84 | 0d55929af6d6668f,female,73,0 85 | 9982d77174c5cbe5,female,79,0 86 | 05c11f1250127302,female,73,0 87 | 791971c942424f19,male,82,0 88 | 0309a0f8f25beaa8,male,80,0 89 | b1bb673a4b78d9bc,male,81,0 90 | 0207945da550a441,female,78,0 91 | ee5214771170fd96,female,94,0 92 | bc272ebab24917e0,female,69,0 93 | e34d96c0289f9668,female,79,0 94 | b609b0670fb91709,male,75,0 95 | bc9560916f129832,male,72,0 96 | f9277b618e61170c,male,75,0 97 | fd84f77a5ec7b253,female,69,0 98 | 20c6aed04401f357,female,84,0 99 | 71bad65348a71b71,female,92,0 100 | 6a592f59a9baff9a,male,69,0 101 | 5d4c5f85988a0a76,female,85,0 102 | a166b9582289c431,male,84,0 103 | aa5fd10725174791,female,75,0 104 | 1cc2a31d1b2d409a,male,32,0 105 | 5e1340ac967e98b9,female,74,0 106 | b74b352999681ef7,male,94,0 107 | 87b81efd917a1ed5,male,76,0 108 | 3be98f8a17d4fc98,female,93,0 109 | 5e7a3c9d0c4b1fb4,male,76,0 110 | bc36284e6d7de9fd,male,25,0 111 | f2965f73e3e3003d,female,80,0 112 | 17a2f75571d8ab12,female,71,0 113 | b07cc0d2dc0b70d0,female,70,0 114 | 5793dd34acc9a3c6,male,75,0 115 | fcc1e4a5add5567a,female,73,0 116 | 2640a253f6601c1b,female,60,0 117 | 06559bf776c4aa50,male,90,0 118 | 7ed8a9befe27abd1,female,85,0 119 | cd99c0bf93400d31,female,69,0 120 | f951a0630b3d36d5,male,76,0 121 | 5bdf7099fbf076c6,female,91,0 122 | c05860482f554de7,female,67,0 123 | e8ba1a715c9873c9,female,107,0 124 | 3659fae7c1aee7eb,female,91,0 125 | df1a9511da86153e,female,91,0 126 | a165b8b81d6cdeaa,female,68,0 127 | f14e460204380687,male,56,0 128 | 5b3eb628cf63dcde,male,95,0 129 | 17f20066992549fd,female,71,0 130 | def6e538e5c4dd53,female,82,0 131 | 0535d9e3909563c0,male,92,0 132 | 622c795a617d159d,male,81,0 133 | 5d6673a91c01d648,male,61,0 134 | e0054c5ce6c55e53,female,71,0 135 | e3beb20f77911324,female,79,0 136 | ae16f6fc22145249,female,50,0 137 | 065c6d88df8f48d7,male,73,0 138 | 8bf505bf66c5c9a6,female,70,0 139 | 8fa1b61604742a54,female,82,0 140 | 2675e2f384d82948,female,72,0 141 | b7f45b297d7e5620,female,78,0 142 | eb5e8f83ea34ebd4,male,67,0 143 | 3846065a676c81cb,male,91,0 144 | 04a4ff4caaece09b,male,86,0 145 | 39a0eaf29afb415b,female,74,0 146 | 180938d265b270b5,male,81,0 147 | 174083e4982242e5,male,74,0 148 | 08f196230463c1ce,male,79,0 149 | 6f6e4e8299a6b207,male,91,0 150 | 0f739ec4ae6ac952,male,72,0 151 | ce50fd4a034fbec0,male,76,0 152 | ee50a98aa8a20798,female,77,0 153 | 5081184ccf6791f1,female,88,0 154 | ac8b931642a63403,female,73,0 155 | 9033d6e2b9a9c571,male,60,0 156 | cef1a11aeb7b3f48,male,69,0 157 | 9c8e694ef9287f17,female,101,0 158 | f5665c59f13f16c6,female,55,0 159 | 7c735e3a3829a93b,male,57,0 160 | c328a4f33030abe4,female,70,0 161 | 1d348738ef611713,female,70,0 162 | 25623809070010af,male,82,0 163 | 04e9176a7cd94d46,male,84,0 164 | 50f72ecb27b449d8,female,67,0 165 | 3ded64c20b7b6088,female,76,0 166 | 05cf4f2bd3d9a1ba,male,54,0 167 | a566ece572097831,female,70,0 168 | 015e674b3c39f428,male,85,0 169 | 5a22db3f66c0330d,female,74,0 170 | 34d140df43a351aa,male,76,0 171 | 68ac915500646870,female,75,0 172 | 38de610023b977d4,female,77,0 173 | e760247352aac762,female,80,0 174 | b3430c61a820ab87,female,71,0 175 | b958af20f38ab8de,female,80,0 176 | b7c55405400e642a,female,74,0 177 | c1ba927fb6d92cfe,male,79,0 178 | c5428994ab731fc4,male,55,0 179 | f9000f86a36ae95c,male,59,0 180 | 8fcb838365d2219c,female,88,0 181 | c9b6765360111372,male,83,0 182 | b653df6e31c8b149,female,67,0 183 | 5adf2c84785cc3d4,female,74,0 184 | a6135b2df202e9ef,male,88,0 185 | b1a687856e6dc59c,male,76,0 186 | 2c3b0fe52afab257,male,94,0 187 | ea136ced9669fdc5,female,94,0 188 | e31f358b678598b0,male,41,0 189 | 1f5bfbbdf428ae0a,female,68,0 190 | 38c830d3306234ad,male,73,0 191 | e0351f829fab3e93,female,45,0 192 | 088f834002740bcf,female,83,0 193 | f23377916a4c17a2,female,97,0 194 | f0eff60ea079d86a,female,91,0 195 | 0568adb0c80cc3b1,female,80,0 196 | 2431fc4e977d75b5,female,81,0 197 | 8a3ed9be3288d598,male,71,0 198 | dfe48acc105568ff,male,65,0 199 | 5f0ad6bbbadb5588,male,69,0 200 | e07e0f501f08f692,male,51,0 201 | 39317db6218b62b8,male,70,0 202 | 779ec9cd98c055fa,male,75,0 203 | 62b2adfdb0257c2d,female,84,0 204 | b842cf0f95c4e54c,female,83,0 205 | 87502b05af052f19,female,86,0 206 | 3c9f30805306325e,female,81,0 207 | 26c3655046b97bdb,female,82,0 208 | 9d925dba206a0264,male,92,0 209 | 046b1f90b1c874bd,male,80,0 210 | 58f251b7247ad632,male,69,0 211 | af3bb63debda7b59,female,69,0 212 | 463f5030657336fc,female,94,0 213 | 793b0a4dc0819064,male,85,0 214 | 16959495c4b66225,female,84,0 215 | 5de775060c49308a,male,86,0 216 | d3900b81975397dc,male,75,0 217 | ad3affd47805837a,female,82,0 218 | 358e0b5a855e1083,female,92,0 219 | c1c4d01b0cba821e,female,87,0 220 | 7a77b2044a537fc1,female,89,0 221 | 14b594e7bf16a8fd,female,71,0 222 | e9caa5f07806727c,female,81,0 223 | c7874bd4b7b26a5f,female,78,0 224 | 0e33795a4e6b0c40,female,74,0 225 | 0eb49f8c9f738230,female,71,0 226 | d788bdf4d3397fbf,male,91,0 227 | c60dd45b6e4dc1e4,male,70,0 228 | 876810b5526d73b0,female,85,0 229 | 56da97adc0172173,female,73,0 230 | 840652a25826a85d,female,68,0 231 | c409ad43f047c16e,female,69,0 232 | 0ab879955726c125,female,70,0 233 | 26a3bb511d0eead8,male,39,0 234 | 4c1dfd01129d2a2b,female,84,0 235 | fcf8a8fb46e4473f,female,68,0 236 | 1f1ad2a8c4167056,female,26,0 237 | d2156b1b694c8965,female,69,0 238 | e105431b3d97d275,female,69,0 239 | 16b53720df22c55a,male,73,0 240 | 5c284ff0d78a2a06,male,72,0 241 | e7f902c5e1add6ab,male,68,0 242 | 14dc3215bc3fb320,male,76,0 243 | dd0576e27466d4f6,female,82,0 244 | 2721f1ae5580b631,male,72,0 245 | 06f8ea0a42cd0e15,female,93,0 246 | ac5a46d387fdd6d7,male,72,0 247 | f7a3d4877c4f55c8,male,79,0 248 | bdfec73f513bc3c9,male,74,0 249 | 37694b0f451174ea,female,90,0 250 | ad5614bf411fd246,male,70,0 251 | d57d3c1b2f3235d3,male,92,0 252 | 13a3ceb10e2089aa,female,89,0 253 | bac0983fe809f885,male,61,0 254 | 55ac7e57c3e84538,female,87,0 255 | 3bf20049721b27c9,male,77,0 256 | 9d5b24a318a99e98,female,74,0 257 | 04ac29795d63724b,female,72,0 258 | 8c57a219ebf54f26,female,71,0 259 | 6e4d89b692877c2a,female,69,0 260 | 70511b219a6f0050,female,52,0 261 | 22e201680003c86e,male,67,0 262 | f9399009854a024b,female,73,0 263 | c561313230e129de,female,72,0 264 | 8826ef17ba79a491,male,82,0 265 | 4ee0ff7935395b32,male,91,0 266 | 3ede4ad936370c2e,male,69,0 267 | 4a582db6e4955abf,male,79,0 268 | 30b98a91f3468d92,male,59,0 269 | 5a9b74d447ea5409,female,75,0 270 | 7c4f97eaa7a05237,female,76,0 271 | 21471114c24550cf,male,47,0 272 | bc74ab3c4e589943,male,104,0 273 | 773cc518f09873ac,male,88,0 274 | 4a8c62a3100e60b7,female,86,0 275 | db27f12c7bccd16a,male,75,0 276 | 5224cdccd726df62,female,68,0 277 | c3ae7cec410a9fab,male,74,0 278 | 65e0e02333352ee7,male,82,0 279 | e4c7e950c898dbf8,female,52,0 280 | bc2cb094fbd30e22,male,77,0 281 | d8f02a6bafe65b95,female,69,0 282 | 803aa03f1baaf46e,male,95,0 283 | a0d942d4b7b58a4e,female,66,0 284 | b39e1cf1acd12e96,female,77,0 285 | 06e8ce7a4c1f5348,female,57,0 286 | fd515b079a7a1976,female,72,0 287 | 3b5cce4c9e5d5542,female,83,0 288 | 001ef63fe5cb0cc5,male,84,0 289 | c277bd7815e92a0a,female,72,0 290 | 25a18028276f9194,female,77,0 291 | 2eaeafa0dc4729a8,female,80,0 292 | 7dc05393d132fecc,male,77,0 293 | 124289ea829c3205,female,70,0 294 | 9056e6f201a68c0e,female,88,0 295 | f05888ee40d12bfa,female,76,0 296 | 4dd950d2fd5cb095,female,78,0 297 | 590bf6af32c0ef19,female,69,0 298 | 2c2a910bb899810c,male,73,0 299 | e7e204111d61f452,female,90,0 300 | d44ea147efacb0b5,male,87,0 301 | 71e6d994860b4a04,female,46,0 302 | e7e88091dcea3e6a,female,78,0 303 | 8178ef7151c9d497,male,76,0 304 | 78e02c6f944ac198,male,42,0 305 | 62c7313acffcd63e,male,65,0 306 | e9c13e98cf8a33d9,male,38,0 307 | 3d3e9a576e5c5cd9,male,73,0 308 | 82c7282837e52cf3,male,94,0 309 | fd94a3619c1114b7,female,83,0 310 | 827c94c680e63fef,male,78,0 311 | 04ef49f24adf3bcf,female,69,0 312 | 590b0b77bfa15133,female,71,0 313 | b7da9f98492a448a,male,72,0 314 | bbd0e13ca2bf1e57,female,83,0 315 | eaed9190a8c33c7f,male,90,0 316 | 67f1716c3c2474df,female,74,0 317 | 8de8c0d06233b935,male,78,0 318 | e999b9ede8282c07,female,96,0 319 | b56add037d01bf07,male,68,0 320 | 214e11bb617ecb5d,female,94,0 321 | b9d1ebedbd85a25e,female,96,0 322 | f3f72198809e0b4d,male,74,0 323 | f75a58ccbf398ed0,male,74,0 324 | 8e06fdec2583120e,male,68,0 325 | a6e09a26a0d4edbf,male,69,0 326 | 0bcf2e158bb20425,female,70,0 327 | 1c60518fbde04a3b,male,72,0 328 | 7ae7a467219bd2be,male,74,0 329 | 6cc56b29113cf64a,male,70,0 330 | 40f0c660c9ad8120,male,72,0 331 | d83830535ea4cc95,female,88,0 332 | f3b8588946d3f4c2,male,84,0 333 | cf2f9b51b5d91604,female,58,0 334 | d07d9aa0bfaa977b,male,61,0 335 | a9a3cfaeb24cbd0c,female,69,0 336 | abcf32968197e1f5,male,80,0 337 | a60c507656225c98,female,67,0 338 | 55f4fa1761c98068,female,60,0 339 | e34635f36d0424a3,female,35,0 340 | 6c95211992ed669c,female,72,0 341 | c441a40c27607fa3,female,63,0 342 | 9b8d3343814d6bba,male,87,0 343 | 77cecef50a0c09c5,female,64,0 344 | bbac875565c819ba,male,75,0 345 | 37f318a4fee4e446,male,72,0 346 | e54ac7d151dddab8,male,87,0 347 | 5ed36ccfea7ddd9c,male,88,0 348 | a5f4b956979fac77,female,75,0 349 | 049b02900ebf1b8d,female,71,0 350 | b4795216c923e81f,male,66,0 351 | 41cb2e37be41660f,female,77,0 352 | 6bffed35e949db60,male,76,0 353 | c8e057afba40a732,female,79,0 354 | 62a3a8d647b08c94,female,55,0 355 | 8c163cb792cf4da8,male,73,0 356 | fe9f11dc74e06921,male,74,0 357 | cdfda64b4993dac3,male,65,0 358 | 1d59a13460bac5f8,male,72,0 359 | 3aa3ad5cb52ff2e3,female,72,0 360 | de6987c0d4a81a4d,male,47,0 361 | 358be5decd99ab41,female,93,0 362 | cc0a590ec5c5f247,female,72,0 363 | fdaab3cc520dab30,female,79,0 364 | a75eb8b6d59beafb,male,78,0 365 | 4e0ab13af4d94d63,female,80,0 366 | 853d2c65b7ccb776,female,72,0 367 | 6a51a04407eee7a9,male,69,0 368 | 4cfc6944fd48904b,male,71,0 369 | fd41a6532308cc51,female,74,0 370 | 19f5be986977c20f,male,72,0 371 | 053658c650ffe856,male,81,0 372 | fff56bad642b8d0f,female,71,0 373 | 0a0cd90e6d440abd,male,43,0 374 | f26819031d0975d8,female,108,0 375 | 5fee8e757e8aa4a8,male,73,0 376 | 7b32591a709810c6,male,89,0 377 | 4571c543437d6a4d,female,74,0 378 | 0a93d77f68b64a48,female,81,0 379 | 52b4b6acabbd252e,female,92,0 380 | 5be8729302c74b18,male,64,0 381 | 365304d2a31af51f,male,94,0 382 | 258022e2e1ae0137,female,52,0 383 | a8c142fad07f3e71,female,83,0 384 | e09b16d8d660918c,male,83,0 385 | 3250819f76d043ad,male,74,0 386 | 1720d1504120b0f8,male,75,0 387 | f59a7c1ad879c720,male,63,0 388 | 3488f96e030ade14,female,79,0 389 | f878911dc405a2fb,female,70,0 390 | 079d0b2fd5985faf,male,75,0 391 | 5a254203be06acb6,male,39,0 392 | 0ea6354df45a96d8,female,71,0 393 | 236973aac33661b8,male,65,0 394 | 5bad6e649b3241b5,female,72,0 395 | 591b05a899d13912,male,74,0 396 | 5eb2b4cf728cc291,male,72,0 397 | 0f6a5537175661fa,male,72,0 398 | f2cfe8ea675c6f0b,female,73,0 399 | f9c53aabb2fe8202,female,95,0 400 | 58acaf728322fa9a,male,81,0 401 | 7b93d20ffd3b1452,female,77,0 402 | 1f74c8654db19144,male,72,0 403 | 69ca7c66fca8117f,female,85,0 404 | ce2eaa270ebad815,female,92,0 405 | bf69307200ead1c8,female,72,0 406 | 767cf89a65c2241e,male,69,0 407 | f29cc127f92a0cc4,male,73,0 408 | b142df960ff0184e,female,64,0 409 | 50a3f1fa2296207f,female,77,0 410 | 6b04a3d7f66f7e3a,female,48,0 411 | 00cf64b1fb5d4463,female,89,0 412 | 5855d5d5e7151c08,male,41,0 413 | c0fa85538609a26e,female,84,0 414 | 4bcb855f323370e9,female,84,0 415 | 04aa1963f8a13653,female,72,0 416 | c2fc4694cd057779,female,92,0 417 | b3de4b8ba428f6e9,female,90,0 418 | 4e816bb5ab3314de,female,87,0 419 | 933b9f1b855c27c3,female,68,0 420 | 55ba3497f4172f37,female,106,0 421 | 2bad05685e420cea,male,77,0 422 | 0aeafb44d5f1666b,female,85,0 423 | 943c9daf23b56b96,female,82,0 424 | 370f1a8fae772a6a,female,72,0 425 | 3d44e950d581dfa9,male,64,0 426 | e2f229b7c18a869f,female,69,0 427 | adfadf2ba46057c4,female,85,0 428 | 0b63b1c6685692ff,female,80,0 429 | 4bad869ad8489808,male,69,0 430 | f3d78bc148a2da46,female,72,0 431 | 642438e9d8ca0da2,male,67,0 432 | 98bb37f667f03fb5,male,78,0 433 | 5bf095df15582be3,male,45,0 434 | dfc8b4c7cddec044,female,74,0 435 | 5baef11e58cbf28f,male,59,0 436 | 21af38e05c0d12b6,female,78,0 437 | 51ab974123ee5871,female,88,0 438 | dac99aa8e0dc9263,female,71,0 439 | f253132c4f7045c0,female,86,0 440 | da1f507698c9df7b,female,86,0 441 | d3b046a68d89db85,male,72,0 442 | a09e11d57f4e332d,female,87,0 443 | c68673ab6ab44ec8,male,69,0 444 | 48097eaca4b6edd8,female,76,0 445 | 5a4f30eda0c77e3b,female,72,0 446 | c1ec94f9c3bb7a6f,male,87,0 447 | 5e68ee1cae11d273,male,58,0 448 | 5859f73966d105bb,female,79,0 449 | 94fc1e5e3051fd26,male,81,0 450 | d885ed1fe2363dad,female,56,0 451 | 4342521e6df5fd58,female,72,0 452 | 29294b41b010a218,female,75,0 453 | 7ffef8885ffcaf0a,male,85,0 454 | 6df8e27231091ce2,male,50,0 455 | 499d5c6a783918bb,female,59,0 456 | 9ea51a990426e352,male,91,0 457 | 852e2aa94f17ab26,male,73,0 458 | 5a24f865919f75ed,female,69,0 459 | 79fcf002a2affb09,male,72,0 460 | 90c6d1a92c998009,female,44,0 461 | 7e759ffb6ddc79a9,female,81,0 462 | 20737c3c8bbb0873,female,78,0 463 | 2012c66cf2812b08,female,83,0 464 | f52fd1be07326a2e,female,57,0 465 | c07ba926cc8cf178,male,83,0 466 | 5c7b7b1de2ed4bda,male,63,0 467 | 150b61f4d7714cba,female,73,0 468 | eb786d1f5eca6d19,female,85,0 469 | e6e3ff3f289b3528,male,77,0 470 | 697931dfa17de049,male,88,0 471 | 49e8ffb7020e4e77,male,79,0 472 | 82012afc2af3f0b7,female,79,0 473 | a00088f11fcda7b8,female,77,0 474 | 899c41026006b79a,female,92,0 475 | 29e45fec516f1622,male,73,0 476 | f611ec397e19c354,male,75,0 477 | d5f650f1a95c4f7c,female,81,0 478 | 878cc28e0ebc51d5,female,70,0 479 | 1be83fa3d7a89b5a,female,71,0 480 | ae09585a58ce3389,male,60,0 481 | 0a4beb8e528b4c66,male,79,0 482 | 35c05aef7882ff37,female,75,0 483 | ec725feba71f710f,male,71,0 484 | e9f64b2fd4c7e148,male,70,0 485 | 5fb161b7cfb5154b,male,65,0 486 | db2c7ddf181aa325,male,89,0 487 | 72cbfaedd505c844,male,72,0 488 | 188eb678029449bb,male,76,0 489 | faf4b6c9cc159a0e,male,88,0 490 | 56550baae957b10c,female,71,0 491 | 29647088b87c5569,female,79,0 492 | 0f9bc46f406cd83b,male,53,0 493 | aa929747c1e67397,female,86,0 494 | c1011bd75cb76c97,female,40,0 495 | 21964a0a6f59b581,male,84,0 496 | 0dde91f184083dfb,female,63,0 497 | dd731c7227850669,male,83,0 498 | 7797ceb2eebfb761,male,68,0 499 | 4816a5ebd8aabf9c,female,77,0 500 | b3d3de86ff270266,male,71,0 501 | 80cbf4d39a902746,female,76,0 502 | aee3b38e7fce7b31,male,70,0 503 | 1e7342f7d2992738,female,95,0 504 | e4971ebe6ce77e2a,male,72,0 505 | 9e09dd56fa6b72cb,female,75,0 506 | 2badbe66ca16107d,female,79,0 507 | f1e31b61a60ecea1,female,82,0 508 | d7cda868796f414a,female,76,0 509 | 027682520660843f,female,79,0 510 | ffe3944afc84aab3,female,47,0 511 | 43303357a0444228,female,77,0 512 | f83c5a5e5aee7d76,male,71,0 513 | 379db7fd136f31c3,female,76,0 514 | 5f12efd22c665d3e,female,45,0 515 | ef7cd1cf80fc2477,male,70,0 516 | d68bffb7ddeca8c1,male,77,0 517 | f3baaf74cb5487d5,male,97,0 518 | cc896a9d1a615d02,female,81,0 519 | 3144b1943fd0eb87,male,73,0 520 | 7149c9f7ba925398,female,70,0 521 | 29780b935609521d,male,67,0 522 | a28d786c202b83ab,female,86,0 523 | ebbb610638db3318,female,72,0 524 | 019a142f46a5bc3a,female,79,0 525 | 9973e2e0973cfaaa,female,81,0 526 | e69f0c1e30209915,male,76,0 527 | 6b120a66fed8a71e,male,79,0 528 | 0ee54febb7a87322,male,71,0 529 | f706b28667f87e15,male,74,0 530 | b71673e1d2313635,female,83,0 531 | aa8f86c4cc547caa,male,76,0 532 | 46cd2f3cdc819c16,male,64,0 533 | cb0cd3de2a806760,female,90,0 534 | d4ba856b7c644c78,female,72,0 535 | 5b3af01db839dae0,female,80,0 536 | 9729edeb9c7f828e,female,85,0 537 | b74974097456c961,female,71,0 538 | 869129aa894a6cbb,female,64,0 539 | 66bd5d4a727274e3,male,74,0 540 | fa8c53cad5323de5,female,63,0 541 | bbff1bd030b2ed03,female,76,0 542 | 85bc5c08b3c660c5,female,72,0 543 | b52242d04e0663a0,female,78,0 544 | 2dc7e1ba1786ec00,female,65,0 545 | 4980c77a872d48b7,female,64,0 546 | 2336d82c8798d681,male,79,0 547 | 332371849cc082d7,female,69,0 548 | 1af7fdbc8eb972e0,male,85,0 549 | aa67692e92fc6b12,female,91,0 550 | 7335b6bf2429e0a0,female,75,0 551 | 3fcc2677cfbb4ce5,female,71,0 552 | 05f32cff3753d3c1,female,85,0 553 | 8080104b8e27ac9a,female,53,0 554 | 04b70b7e8d252353,female,84,0 555 | 6e1e85b9ca6a751d,female,86,0 556 | f09402965ffce169,female,82,0 557 | b38efb8365c8ffb2,female,79,0 558 | 4489168af7a53fff,male,76,0 559 | e81cab6a02a698f2,male,77,0 560 | 9ead3710e2a987c6,male,85,0 561 | 3ca863af0bb9eec0,male,77,0 562 | c58313130c1a1923,female,67,0 563 | 7892a92363f14aab,female,72,0 564 | 0d9d6291c6c3f541,male,83,0 565 | 088210e78245e140,female,74,0 566 | 6547315ca9008444,female,70,0 567 | 49c9b788bc6e69e1,male,76,0 568 | 47bd9b9ee940e5c0,female,78,0 569 | 58e7236c74c64080,male,81,0 570 | a7b0bd839b3a5fee,female,86,0 571 | 59f7df039f597ad4,male,85,0 572 | b010b3df9b4d1acf,female,73,0 573 | c893ec1422bcc480,male,74,0 574 | 59e6c485befb3d79,female,84,0 575 | 4f7a733ece0e9505,female,67,0 576 | 3d2c06a17c75123f,female,72,0 577 | 785a27c2476618ec,male,79,0 578 | 9b3a9be7bd300e99,female,71,0 579 | 4be82cf998bd4720,male,69,0 580 | 26549589a4de21a0,male,77,0 581 | ed629c72783c74a7,female,70,0 582 | 0baf3a51206c9f51,female,77,0 583 | e3ed9b5479c97247,female,79,0 584 | 52740491282f36c7,female,91,0 585 | 1bfde0b8e1c289f5,female,99,0 586 | 6602eccb3dc056f6,female,72,0 587 | aa5cc9ea11d63e32,male,70,0 588 | ea71ee2a80d68d39,female,74,0 589 | 4fab4c60f885e32b,female,73,0 590 | 2850b4257535e11a,male,86,0 591 | 10a938ee8178c6da,female,74,0 592 | 513c2844acb6d329,female,84,0 593 | ffdf9bc2792b33ce,female,62,0 594 | 1b80ae464a6faf45,female,80,0 595 | 19cc60a2193bdc30,female,94,0 596 | b14829708636c00e,female,71,0 597 | c266e1243041d7b8,male,49,0 598 | 275a5354b326f888,female,75,0 599 | 974bc3440a767f9a,female,91,0 600 | 035d012441ba3c2e,male,71,0 601 | 0620009cd4d53831,female,80,0 602 | f4abaea27dc13648,male,78,0 603 | 53e8a85628064b83,female,84,0 604 | 2f223d6c256ab57d,male,78,0 605 | c11e4bcaafc1fbe2,female,84,0 606 | ded5f6012217f734,female,69,0 607 | 6d78288091885799,male,59,0 608 | 8bf1cedb845bde3a,female,78,0 609 | efb4f69ba8b53a83,female,75,0 610 | 11c1bc223fed558f,male,73,0 611 | 0e6393b2a6d17955,male,71,0 612 | 4e601e2335bc36b9,female,77,0 613 | 60e7fb6714df116b,female,76,0 614 | ab82cccabe6f4d21,female,63,0 615 | 3c8d1edd20e1dd8b,female,82,0 616 | 92c9164d2d1bfa2f,male,79,0 617 | cd460d115540604b,female,69,0 618 | b6474c82f9745952,female,51,0 619 | cd4092b2a06e312b,female,86,0 620 | 9e2ff97b9d472f6a,female,71,0 621 | 72910579f688d81e,female,77,0 622 | 3f0685333609bd1f,male,67,0 623 | 6329537db44f21bc,female,68,0 624 | 71d7aede79ff5ebb,male,72,0 625 | a8dce473fe51edc4,female,79,0 626 | c7fa22564af8b768,male,89,0 627 | 75777cc5403ba93f,male,58,0 628 | 019abf48fe1031f2,male,80,0 629 | 4a96b47951afb5c5,male,65,0 630 | 649a69faa32d2b40,female,69,0 631 | 732716dccf7d7ecc,female,70,0 632 | 27482471cbda73c9,female,76,0 633 | 57774df30a1f72e5,female,76,0 634 | 157fc47d7fe78faf,female,76,0 635 | 7d87e57a88aa1d0a,male,82,0 636 | 25adf394c39f8a8f,female,61,0 637 | d2b81d01f6557434,female,69,0 638 | 3387f1b14308af35,female,58,0 639 | a1e3c215f53d5cd8,male,78,0 640 | 81175aaf47452328,female,78,0 641 | 5e5f093b8069f00d,female,67,0 642 | e46c683f5bf627cf,male,74,0 643 | 56c2b7121a086fed,female,94,0 644 | 57cee9618e7c6a66,female,88,0 645 | cf359179c2539a97,female,82,0 646 | e93352b6aa4b7335,male,77,0 647 | cd5832f6c0533e42,female,70,0 648 | d8bbe8798869bb3a,female,78,0 649 | 065dc1ac710588d1,male,61,0 650 | e80714c9394af5c1,female,82,0 651 | a8907cef2ad372f8,male,96,0 652 | cc2d34a9c5f64a72,male,72,0 653 | effbd88af5d55e70,female,88,0 654 | 7e2710bc0b1df290,female,69,0 655 | ef88ada2f8b11b4f,female,57,0 656 | 99d5e43989dc2c1d,male,84,0 657 | ebcc34cbaf7c2d80,female,56,0 658 | 7940be7c76238c0a,female,86,0 659 | af0948f044f90b41,female,73,0 660 | 13da71690b52445a,male,84,0 661 | 6e0c1280d5e45196,female,85,0 662 | d46099ff75e84e1b,male,76,0 663 | 2e79298d5bd9d78c,female,98,0 664 | a58052b09f842c12,male,68,0 665 | e98ec20f5025b339,male,71,0 666 | 9b861736d2e3cd35,female,80,0 667 | 0d90c980e75b26f8,female,90,0 668 | 331651bf43432881,male,76,0 669 | 910b726806176a39,female,80,0 670 | c73c7b3462893d8d,male,47,0 671 | 756c1c0c56e2d9a4,male,77,0 672 | 43e0fa2b4b82fb9b,female,83,0 673 | 293f0c1a4441a600,male,71,0 674 | 3a2635e4eec1c0dd,male,75,0 675 | 7973d38b21d9a2d7,female,73,0 676 | f05bdd6fec517459,female,77,0 677 | d7bee4dbe70f3786,female,92,0 678 | dd2a9598322084bf,male,92,0 679 | 9ec1ca84ea9a02ce,female,69,0 680 | fd1c257eeb5f3be4,male,73,0 681 | 488f5e3561d57b0b,female,79,0 682 | cbb745490997bd83,female,75,0 683 | 9b44941b58084a8b,female,85,0 684 | c49bdb62dee74b0f,female,75,0 685 | c058a810574053f1,female,80,0 686 | 8e48f568df0c345b,female,71,0 687 | 3d930973e43dd7d8,female,83,0 688 | 1ec0d3e758a3f308,female,68,0 689 | 4bb588afac7a087f,female,85,0 690 | 47aa470be6b23c7e,female,72,0 691 | 9f639970e94cf7e2,male,69,0 692 | 96118103b0ade532,male,76,0 693 | b5d6debf60f2904b,male,65,0 694 | d4be0cbadf9e049d,male,63,0 695 | 83629ff472a10666,female,56,0 696 | 32972c13ce512013,male,94,0 697 | ca2ebbbafec60ab0,male,65,0 698 | ca6bfe760572c820,female,92,0 699 | 16ee954472d31950,female,77,0 700 | 4ee5af7f8dac72eb,female,79,0 701 | 59bd892fc1476461,female,37,0 702 | 50c6b8f219697961,male,73,0 703 | e881faf0101547e2,female,77,0 704 | 10a38329961aa12d,male,73,0 705 | df37b12f42be810e,female,74,0 706 | 19bd94148f0f67b4,male,70,0 707 | e83903b91ffae2f0,male,52,0 708 | cf5b24723a1a3147,female,87,0 709 | bbfe97650e6f1194,female,74,0 710 | 3c993231ef6d5768,female,86,0 711 | 3f1b120532fbb116,male,82,0 712 | e9f83be409686e4d,male,71,0 713 | cd517bfb4ecaa586,male,76,0 714 | 97209e91e87383ee,female,78,0 715 | 154d3fbd62fc8682,female,85,0 716 | 81a4a6b47b8609ae,female,80,0 717 | 5652bbbc248bf82f,male,78,0 718 | 6e79166202eabba3,female,85,0 719 | 0e1696281d7fee4a,female,75,0 720 | 99af9d230f1a2a1c,female,89,0 721 | d2ed77b4964c85f0,female,78,0 722 | ad3d9e229e4cdfcd,female,109,0 723 | 4c6370bacc5abd72,male,76,0 724 | 7e69f39451c68522,female,73,0 725 | 8692f2fed69dc4b7,male,93,0 726 | c2e711a01f7a83a8,male,92,0 727 | b2b44a301a04d29f,female,76,0 728 | 7c11e5aec8921e75,female,58,0 729 | 480ee04767b0784d,female,75,0 730 | 3320867c4c678f88,female,54,0 731 | 0671b4abadc7c415,male,76,0 732 | 850adb195eadf993,male,93,0 733 | 5a3dbc61ffa37453,female,83,0 734 | 14f1530658e3c286,male,69,0 735 | 9f1741a33c8fc493,female,66,0 736 | ba2c965fc574a166,female,80,0 737 | 3ad810ff245237c2,female,78,0 738 | 6191d76b64685262,female,69,0 739 | d14df0493acad78e,female,72,0 740 | 458a20d4d712cc3b,female,92,0 741 | 2e90082b6158869e,female,32,0 742 | 55b8cc9c671d9726,male,74,0 743 | 63f10380bfc2f539,male,51,0 744 | 267cdaf31c44933d,female,92,0 745 | 94a9bd78b411a826,female,81,0 746 | 5bc329f18a5944c3,male,33,0 747 | bfb2ae91e520f793,male,79,0 748 | 9579006f14f83001,female,71,0 749 | aed5ba350d8828c8,female,80,0 750 | bff1f230899fe5fa,male,79,0 751 | b062c1e6b3b61359,male,73,0 752 | b9758970371ea74b,female,68,0 753 | 1cfa829bb5ff7099,female,76,0 754 | 39f30d3d6e45d5d0,male,74,0 755 | a4045f3ca21bd664,male,79,0 756 | 572abb866aca7ebd,female,90,0 757 | 526c484fcca3aa17,male,81,0 758 | 809b04f925f2c29b,male,66,0 759 | 361ae0063b161d21,female,69,0 760 | 911f3c1fcd979d07,male,67,0 761 | 00669248edd53308,male,69,0 762 | aec71a4d2f8e383a,female,70,0 763 | b1737997c933d33d,female,71,0 764 | 021b5394e68a5767,female,89,0 765 | cdd5f352a317e54b,male,42,0 766 | 6c66bcab22e0d6ca,female,79,0 767 | e3bb0b15f3566815,female,71,0 768 | 16cb06ca526fbadf,male,70,0 769 | 04c40b4d11b13c96,female,74,0 770 | 95ab08a59dabd99e,male,73,0 771 | 1410b958ca736b8d,male,83,0 772 | c387d0b0e9b62dfc,male,86,0 773 | 5ade79e8b90be549,female,95,0 774 | 6ef16007ae152b55,female,41,0 775 | da711385f7852993,female,81,0 776 | 90f3f8a7ed2077f0,male,85,0 777 | b4a1fde5bb7526c6,male,79,0 778 | a4e59df38debb7c7,male,77,0 779 | 2f9712543e5548fa,male,76,0 780 | eb281011ea458f4d,female,78,0 781 | 6261a284ca83bbde,female,86,0 782 | 78547d9f154174d2,male,69,0 783 | 6f1acac3981c3130,female,73,0 784 | be90a941fdb2d3f3,male,62,0 785 | 2137ead25276417f,female,83,0 786 | fbce028fb49c91dd,female,80,0 787 | 9c148ca517164b57,male,78,0 788 | 327c0ce1ce5b46fc,female,63,0 789 | 167d93c8a8189eca,female,81,0 790 | e12d587100b48a16,female,80,0 791 | b08b1ccdfe0f5c93,female,59,0 792 | a7fd7ac593546994,male,80,0 793 | eb3714febe0a14fd,female,71,0 794 | 1c525568c5fae088,female,86,0 795 | 3860b331d2bb012d,male,84,0 796 | de90633a17aab44b,male,77,0 797 | 3f30b6843f0982e2,male,84,0 798 | fd2c1906432b3334,female,55,0 799 | f9cac6e471feac4f,male,87,0 800 | a3b0c4791f55ac56,male,69,0 801 | adfe5b9d0a2a9fbf,female,47,0 802 | 726f5b53b6ce62b4,male,23,0 803 | 9658f2e28ab7204b,female,81,0 804 | b861af1e88e03b4c,female,33,0 805 | 36c240fa7f2ee1dc,male,72,0 806 | ba865b13442978f1,female,95,0 807 | 9575d422eba7d09f,male,72,0 808 | a4f7d94732dc7485,male,65,0 809 | 2f63831f1d8e9c98,female,77,0 810 | 0e3388f2ccb95cf3,female,93,0 811 | 24a86c1d2b01810f,male,84,0 812 | 5eca022bf1b47880,male,74,0 813 | dfb0a47bfbd9ecc8,female,91,0 814 | 7301c5e823009f1a,male,75,0 815 | 163df3e38ad9a73e,male,88,0 816 | b53c1a376bdaabae,female,75,0 817 | 3759a6c786e8d4be,male,69,0 818 | 274b02368f1db1ba,female,84,0 819 | ad104659fe7e1cb3,female,81,0 820 | 3c9fc5b480f263ff,female,106,0 821 | 9afe5a75fda48135,female,72,0 822 | a32ffc90d2258589,female,70,0 823 | bbb06977855a629c,male,86,0 824 | 4e0febec89a366d8,female,75,0 825 | c5e130bf7328f177,female,46,0 826 | 3dcf850994cac3ce,female,85,0 827 | 379c7a9de9e6cd71,male,71,0 828 | c656c3ec8c0200f7,male,75,0 829 | c6bb90b8382b4770,female,71,0 830 | bb3c6349442bf3f0,female,71,0 831 | 213ed574a2f6095d,male,53,0 832 | f8aad3b3b34c9ad2,female,92,0 833 | 099cfa580b42a9a1,male,94,0 834 | 901cc5a5302097a5,male,77,0 835 | cbf9c2fbd2fd08ee,female,73,0 836 | caa75a6aa0798f28,female,78,0 837 | 9a135d6aed5aab09,female,92,0 838 | fbd64417455a4a9b,male,72,0 839 | e8241cce390bc61e,female,79,0 840 | 0965126508ee36d1,female,62,0 841 | a9df9ce35478680e,female,59,0 842 | 9969c05a1d846db3,male,57,0 843 | ac5f388539c6ccdf,male,91,0 844 | 65c5deeebb269180,female,60,0 845 | c635fd467e9f676d,male,84,0 846 | 35242529a9271b96,male,57,0 847 | ef3705e484d2d8f4,female,84,0 848 | 14cbe79747f6ed70,male,86,0 849 | cdd760c1606dc3f6,female,76,0 850 | 1d676f07a3459fb2,male,71,0 851 | e4221554fd3bc2a1,male,95,0 852 | 05329ad0f8238e71,male,55,0 853 | d8a2a2031abcd596,female,72,0 854 | b09899b15ecb3da3,male,42,0 855 | 2bbb3754562c5e35,female,88,0 856 | 62673e484106bf9e,female,57,0 857 | be019ff030bf6b7f,female,76,0 858 | b8b7b6de59f5e614,female,61,0 859 | 70cc4fc2cce98592,male,82,0 860 | 76c0140e771df889,female,68,0 861 | c2617dfa76603376,male,83,0 862 | 6ad9021cecebd510,female,73,0 863 | 9ae4597c0a44586a,male,67,0 864 | 3eb5bb7f2c396ae7,male,87,0 865 | 1b75581b57b36a8e,male,98,0 866 | da7dda37752ae1a8,female,74,0 867 | 4afc3e1ad919a202,female,88,0 868 | 95874a58c961f375,female,78,0 869 | 79c65abedfee6164,male,95,0 870 | 292a6eaae1a0119c,female,79,0 871 | 56341c25f5eb3a34,male,81,0 872 | b54250d91fc5fb98,female,77,0 873 | abd3ddde085e994d,male,82,0 874 | 1ad80041eb104ffb,male,77,0 875 | 7600564907d6d6b0,female,46,0 876 | a24e4c39a711c5ae,female,79,0 877 | cadb8531041cb675,male,59,0 878 | 043d9ef996065dfc,male,68,0 879 | 32ed69b03d64da6a,female,59,0 880 | 911552a8af077d05,male,70,0 881 | 941d1c27d899a75c,female,70,0 882 | 6513eaff3d2109be,male,84,0 883 | 9bf5c12c1b29a50f,female,71,0 884 | bc7affec5edc8b86,male,62,0 885 | 852d002810a3a143,female,80,0 886 | 6e77b1d9dfcbbb2a,female,89,0 887 | 23961c0b98d7d847,female,70,0 888 | b3ed2d854e041be2,female,69,0 889 | 0f842251d601ca42,female,73,0 890 | 53e1d4fc7ce368a6,male,86,0 891 | b28a2d5e02919d53,female,64,0 892 | 314f48dbf0f1451f,male,74,0 893 | 50804291f2e2ff33,male,42,0 894 | 9436f49d5bafbe47,female,74,0 895 | 920dbcfed75d14de,female,52,0 896 | 27d10123d8cd0212,female,76,0 897 | fd2bc0ab290d6589,female,78,0 898 | 93530b66dbfffc66,male,74,0 899 | 79f3574169bd020c,female,73,0 900 | 43a9e5aacab8f8c7,female,80,0 901 | b2faa2ad244bf215,female,73,0 902 | 258544904e5d7df5,male,67,0 903 | f2d099cbae1daaf5,male,32,0 904 | 7b28221b4f12f343,male,75,0 905 | 2186f6154cca5411,female,72,0 906 | 2ccc971fd8e7e4e1,female,71,0 907 | 51682aaa0c402341,male,67,0 908 | b000bdf5d8fc3777,male,87,0 909 | 66a539a7c759b366,female,80,0 910 | 78c2ceff1a051dff,female,77,0 911 | d9043929f59f95a3,female,71,0 912 | bbf920bb4e0d6233,male,71,0 913 | e147d741416157d0,female,91,0 914 | d77534ad86daa49c,male,73,0 915 | a22238552d243f71,female,84,0 916 | 40731d7929ea2eea,female,73,0 917 | a5bf48b6e05092a1,male,75,0 918 | f047b38d09beee81,male,78,0 919 | 32b97b272b2261ca,female,62,0 920 | 2a455526a75a2124,male,91,0 921 | 7028f34084269a19,female,68,0 922 | b438f73ccb9ded0d,male,90,0 923 | e4dbede7c0f3ede7,male,73,0 924 | 7d68cbc6bb8cc981,female,71,0 925 | 59a496d34ccbe345,female,71,0 926 | 7820166866f9d012,female,75,0 927 | 127bf97629155e4f,male,63,0 928 | 299e3b0c121db4a3,female,66,0 929 | 455292c3ee624a53,male,67,0 930 | 89dbfab37c0951dc,male,82,0 931 | 6baee37d0023186a,male,50,0 932 | b83178f7742e00bc,female,70,0 933 | 21f340191c28b826,male,75,0 934 | 86d8584f8feeb62f,male,95,0 935 | 71b8aafe41a1d6b3,male,78,0 936 | 3a853e95429cac12,male,75,0 937 | f89efa8be0fd8c40,female,79,0 938 | 6336613b16392b44,male,86,0 939 | d8a86ed32572c299,male,80,0 940 | eaed0a21b9945238,female,80,0 941 | 251107baac283b06,female,70,0 942 | 7ec836001aee12cb,female,72,0 943 | 0736c82b9ca4de69,female,104,0 944 | a957b127a3651490,female,72,0 945 | 3fc8ad1a80d1fb62,female,74,0 946 | bc0519b63cdb736f,female,57,0 947 | 964f96cacc9156cf,male,83,0 948 | be965d11da0167f7,male,77,0 949 | e18e79ca0150544c,female,84,0 950 | 6c66bcab22e0d6cb,female,79,0 951 | 68b022a27fe5e909,female,69,0 952 | a467087990f4fdcb,female,71,0 953 | b298d65333725c06,male,86,0 954 | c3a2a14555493090,male,99,0 955 | 46b92e0e1a2613ac,female,40,0 956 | c6b1fb5eea5fbe12,male,73,0 957 | a37bd903317c77c4,male,75,0 958 | 94a5094c60b42030,female,99,0 959 | 0a59d772a053885e,female,81,0 960 | 4ba7dc7b38c65a86,female,76,0 961 | cc261358d2861ced,female,76,0 962 | 9da36b2e9958f399,female,95,0 963 | 4510a28f627a0820,male,68,0 964 | 8aee7f420b09ede6,female,97,0 965 | ba6ed0b132ee0123,male,70,0 966 | 34dca8f42f55b5e5,male,75,0 967 | 380b09e1c04137b4,female,70,0 968 | d9e597adffd8ebf0,female,79,0 969 | ac2454995f2d3987,female,77,0 970 | 45730a74ecf57ca2,female,89,0 971 | 50ea05c3d325511c,female,103,0 972 | 73af299a74a40d09,female,74,0 973 | 2bdcad63d8042da4,male,64,0 974 | 6098c5d5ec6fcf41,female,85,0 975 | d53ce2a85365d6f1,male,74,0 976 | 9b327c13ca2b2e68,female,86,0 977 | ac7db8d6144e2b2c,female,77,0 978 | 647607af4d0bb2fd,female,88,0 979 | b5463844e4e516b5,male,76,0 980 | 775ffc1f3d1a350d,female,63,0 981 | 07d22d82649b90fa,female,72,0 982 | edb896c4d8886777,female,85,0 983 | 9a3aee9495fe8899,male,83,0 984 | bdda8d0f6db6315d,male,71,0 985 | d30cf6961590b064,female,70,0 986 | b5a686c19922fa6a,female,71,0 987 | 8625d80e2f802072,male,69,0 988 | 4f048fa9d31b11a0,female,68,0 989 | 3cc0a4a67e1060ee,male,68,0 990 | 1b72de2f9cc33551,female,85,0 991 | 01d7b65aede1c026,female,82,0 992 | a5d5efe79bb90020,male,88,0 993 | c2f23722bec13f54,female,81,0 994 | 449d8e6ed95ebc3f,male,52,0 995 | 372061b7942da287,male,88,0 996 | 8cd3a69367241901,male,60,0 997 | d2944797cca5aebd,male,69,0 998 | 93bd544b06cb617b,male,52,0 999 | baf2fc8c88cb7fb2,male,78,0 1000 | e17e981aaa7b7f0a,female,105,0 1001 | 97453efe3bdedc6e,female,96,0 1002 | -------------------------------------------------------------------------------- /examples/demographics.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/examples/demographics.xlsx -------------------------------------------------------------------------------- /img/roc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/closedloop-ai/cv19index/fb9ed4996b94024b4606ec68628ddfcfbe02f2c6/img/roc.png -------------------------------------------------------------------------------- /run_cv19index.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | 3 | import cv19index.predict 4 | 5 | if __name__ == '__main__': 6 | cv19index.predict.main() 7 | -------------------------------------------------------------------------------- /run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pytest cv19index/ -s --log-level=DEBUG --ignore=python --junitxml=pytest.xml || true -------------------------------------------------------------------------------- /sagemaker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN apt-get update 4 | RUN apt-get --yes upgrade 5 | RUN apt-get --yes install python3 python3-pip 6 | 7 | RUN mkdir -p /opt/cv19index/ 8 | COPY sagemaker/docker-requirements.txt /opt/cv19index/docker-requirements.txt 9 | # Provides a cache stage with pandas and xgboost installed 10 | RUN pip3 install -r /opt/cv19index/docker-requirements.txt 11 | 12 | COPY . /opt/cv19index/ 13 | # This exposes a serve command for sagemaker 14 | RUN pip3 install /opt/cv19index/ 15 | -------------------------------------------------------------------------------- /sagemaker/docker-requirements.txt: -------------------------------------------------------------------------------- 1 | numpy==1.17.4 2 | pandas==0.23.4 3 | setuptools==40.2.0 4 | shap==0.33 5 | xgboost==1.0.1 6 | flask==1.1.1 -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import pathlib 2 | from setuptools import find_packages 3 | from distutils.core import setup 4 | 5 | HERE = pathlib.Path(__file__).parent 6 | 7 | README = (HERE / "README.md").read_text("utf-8") 8 | 9 | setup( 10 | name="cv19index", 11 | version="1.1.4", 12 | description="COVID-19 Vulnerability Index", 13 | long_description=README, 14 | long_description_content_type="text/markdown", 15 | url="https://cv19index.com", 16 | author="Dave Decaprio", 17 | author_email="dave.decaprio@closedloop.ai", 18 | license="BSD", 19 | classifiers=[ 20 | "Development Status :: 4 - Beta", 21 | "Intended Audience :: Healthcare Industry", 22 | "Intended Audience :: Science/Research", 23 | "Intended Audience :: Developers", 24 | "Natural Language :: English", 25 | "Framework :: Jupyter", 26 | "License :: OSI Approved :: BSD License", 27 | "Programming Language :: Python :: 3.6", 28 | "Programming Language :: Python :: 3.7", 29 | "Programming Language :: Python :: 3.8", 30 | ], 31 | packages=find_packages(), 32 | include_package_data=False, 33 | zip_safe=False, 34 | package_data={ 35 | "cv19index": [ 36 | "resources/logistic_regression/lr.p", 37 | "resources/xgboost/input.csv.schema.json", 38 | "resources/xgboost/model.pickle", 39 | "resources/xgboost_all_ages/input.csv.schema.json", 40 | "resources/xgboost_all_ages/model.pickle", 41 | "resources/ccsrEdges.txt", 42 | "resources/ccsrNodes.txt", 43 | "resources/demographics.schema.json", 44 | "resources/claims.schema.json", 45 | ] 46 | }, 47 | entry_points={ 48 | "console_scripts": [ 49 | "cv19index=cv19index.predict:main", 50 | # serve is required to be exposed by the sagemaker API. 51 | "serve=cv19index.server:sagemaker_serve", 52 | ] 53 | }, 54 | install_requires=[ 55 | "numpy>=1.17.4", 56 | "pandas>=0.23.4", 57 | "setuptools>=40.2.0", 58 | "shap>=0.33", 59 | "xgboost>=1.0.1", 60 | "flask>=1.1.1", 61 | "regex>=2020.2.20", 62 | "xlrd >= 0.9.0" 63 | ], 64 | ) 65 | -------------------------------------------------------------------------------- /testData/claims_no_inp.csv: -------------------------------------------------------------------------------- 1 | personId,claimId,admitDate,dischargeDate,erVisit,inpatient,dx1,dx2,dx3,dx4,dx5,dx6,dx7,dx8,dx9,dx10,dx11,dx12,dx13,dx14,dx15 2 | 001ef63fe5cb0cc5,0ec3e339e26050e9,2017-03-16,,FALSE,FALSE,Z640,,,,,,,,,,,,,, 3 | 001ef63fe5cb0cc5,0ec3e339e26050e9,2017-03-16,,FALSE,FALSE,Z572,,,,,,,,,,,,,, 4 | 001ef63fe5cb0cc5,0ec3e339e26050e9,2017-03-16,,FALSE,FALSE,Z48813,,,,,,,,,,,,,, 5 | 001ef63fe5cb0cc5,0ec3e339e26050e9,2017-03-16,,FALSE,FALSE,Z4801,,,,,,,,,,,,,, 6 | 001ef63fe5cb0cc5,02786fae4db3074c,2017-03-16,,FALSE,FALSE,I69133,,,,,,,,,,,,,, 7 | 001ef63fe5cb0cc5,02786fae4db3074c,2017-03-16,,FALSE,FALSE,C601,,,,,,,,,,,,,, 8 | -------------------------------------------------------------------------------- /testData/demographics_one_person.csv: -------------------------------------------------------------------------------- 1 | personId,gender,age,extraColumnsAreIgnored 2 | 001ef63fe5cb0cc5,male,84,0 3 | --------------------------------------------------------------------------------