Build analytical tables for clinicedc/edc projects
Project description
edc-analytics
Build analytic tables from EDC data
Read your data into a dataframe, for example an EDC screening table:
qs_screening = SubjectScreening.objects.all()
df = read_frame(qs_screening)
Convert all numerics to pandas numerics:
cols = [
"age_in_years",
"dia_blood_pressure_avg",
"fbg_value",
"hba1c_value",
"ogtt_value",
"sys_blood_pressure_avg",
]
df[cols] = df[cols].apply(pd.to_numeric)
Pass the dataframe to each Table class
gender_tbl = GenderTable(main_df=df)
age_tbl = AgeTable(main_df=df)
bp_table = BpTable(main_df=df)
In the Table instance,
data_df is the supporting dataframe
table_df is the dataframe to display. The table_df displays formatted data in the first 5 columns (“Characteristic”, “Statistic”, “F”, “M”, “All”). The table_df has additional columns that contain the statistics used for the statistics displayed in columns [“F”, “M”, “All”].
From above, gender_tbl.table_df is just a dataframe and can be combined with other table_df dataframes using pd.concat() to make a single table_df.
table_df = pd.concat(
[gender_tbl.table_df, age_tbl.table_df, bp_table.table_df]
)
Show just the first 5 columns:
table_df.iloc[:, :5]
Like any dataframe, you can export to csv:
path = "my/path/to/csv/folder/table_df.csv"
table_df.to_csv(path_or_buf=path, encoding="utf-8", index=0, sep="|")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file edc_analytics-0.1.3.tar.gz
.
File metadata
- Download URL: edc_analytics-0.1.3.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1861df43a7e6f7110170c2046ae30b96e5ed450a09cab645427b5dd2c0f38f5f |
|
MD5 | efe3b6d58f5ee7f9934acd9ea221b25a |
|
BLAKE2b-256 | 7446a872304e978a10b1b4e2430c88319d8afdf4200832555c64f5b9c5505518 |
File details
Details for the file edc_analytics-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: edc_analytics-0.1.3-py3-none-any.whl
- Upload date:
- Size: 31.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa9cd1c73e160aa5ec4b0a229e43d06a40b5e7995fd93e303366c009cce190bc |
|
MD5 | ae7b5577ce15d644d0a112c4e53f1d23 |
|
BLAKE2b-256 | 6d5f3f78d6ce9059ecd667a238d131e498206a23132698f6d6d06dc36c5ede07 |