|pypi| |downloads|
edc-analytics
-------------
Build analytic tables from EDC data
Read your data into a dataframe, for example an EDC screening table:
.. code-block:: python
qs_screening = SubjectScreening.objects.all()
df = read_frame(qs_screening)
Convert all numerics to ``pandas`` numerics:
.. code-block:: python
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
.. code-block:: python
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``.
.. code-block:: python
table_df = pd.concat(
[gender_tbl.table_df, age_tbl.table_df, bp_table.table_df]
)
Show just the first 5 columns:
.. code-block:: python
table_df.iloc[:, :5]
Like any dataframe, you can export to csv:
.. code-block:: python
path = "my/path/to/csv/folder/table_df.csv"
table_df.to_csv(path_or_buf=path, encoding="utf-8", index=0, sep="|")
.. |pypi| image:: https://img.shields.io/pypi/v/edc-analytics.svg
:target: https://pypi.python.org/pypi/edc-analytics
.. |downloads| image:: https://pepy.tech/badge/edc-analytics
:target: https://pepy.tech/project/edc-analytics
Raw data
{
"_id": null,
"home_page": "https://github.com/clinicedc/edc-analytics",
"name": "edc-analytics",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "django analytics pandas data collection clinicedc clinical trials",
"author": "Erik van Widenfelt",
"author_email": "ew2789@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d0/0e/0cbdcad57af395af62110ff2859b5dd64fd4f118a901b8f37885756691f3/edc_analytics-0.1.4.tar.gz",
"platform": null,
"description": "|pypi| |downloads|\n\n\nedc-analytics\n-------------\n\nBuild analytic tables from EDC data\n\n\nRead your data into a dataframe, for example an EDC screening table:\n\n.. code-block:: python\n\n qs_screening = SubjectScreening.objects.all()\n df = read_frame(qs_screening)\n\n\nConvert all numerics to ``pandas`` numerics:\n\n.. code-block:: python\n\n cols = [\n \"age_in_years\",\n \"dia_blood_pressure_avg\",\n \"fbg_value\",\n \"hba1c_value\",\n \"ogtt_value\",\n \"sys_blood_pressure_avg\",\n ]\n df[cols] = df[cols].apply(pd.to_numeric)\n\n\nPass the dataframe to each ``Table`` class\n\n.. code-block:: python\n\n gender_tbl = GenderTable(main_df=df)\n age_tbl = AgeTable(main_df=df)\n bp_table = BpTable(main_df=df)\n\n\nIn the ``Table`` instance,\n\n* ``data_df`` is the supporting dataframe\n* ``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\"].\n\nFrom 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``.\n\n.. code-block:: python\n\n table_df = pd.concat(\n [gender_tbl.table_df, age_tbl.table_df, bp_table.table_df]\n )\n\nShow just the first 5 columns:\n\n.. code-block:: python\n\n table_df.iloc[:, :5]\n\n\nLike any dataframe, you can export to csv:\n\n.. code-block:: python\n\n path = \"my/path/to/csv/folder/table_df.csv\"\n table_df.to_csv(path_or_buf=path, encoding=\"utf-8\", index=0, sep=\"|\")\n\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/edc-analytics.svg\n :target: https://pypi.python.org/pypi/edc-analytics\n\n.. |downloads| image:: https://pepy.tech/badge/edc-analytics\n :target: https://pepy.tech/project/edc-analytics\n",
"bugtrack_url": null,
"license": "GPL license, see LICENSE",
"summary": "Build analytical tables for clinicedc/edc projects",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/clinicedc/edc-analytics"
},
"split_keywords": [
"django",
"analytics",
"pandas",
"data",
"collection",
"clinicedc",
"clinical",
"trials"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1b754d9c749953bb840afe3ff4ae2c2477c7ae64c75c246ad6af53a2607f9c7e",
"md5": "989c5793941b12c64c215b0bacd35dd1",
"sha256": "ec769c082d2fac7fab159024b174eed56aca4a54d69c3f5d47f2a1906f7e316f"
},
"downloads": -1,
"filename": "edc_analytics-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "989c5793941b12c64c215b0bacd35dd1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 31529,
"upload_time": "2024-11-20T22:54:52",
"upload_time_iso_8601": "2024-11-20T22:54:52.724130Z",
"url": "https://files.pythonhosted.org/packages/1b/75/4d9c749953bb840afe3ff4ae2c2477c7ae64c75c246ad6af53a2607f9c7e/edc_analytics-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d00e0cbdcad57af395af62110ff2859b5dd64fd4f118a901b8f37885756691f3",
"md5": "f2a23339add10753a633242b6998b23a",
"sha256": "bc450f42becf58d407b8d47eb3796daaf08b1496ebfca7f0e4c0d72a3e6c1d8a"
},
"downloads": -1,
"filename": "edc_analytics-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "f2a23339add10753a633242b6998b23a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 27453,
"upload_time": "2024-11-20T22:54:53",
"upload_time_iso_8601": "2024-11-20T22:54:53.679022Z",
"url": "https://files.pythonhosted.org/packages/d0/0e/0cbdcad57af395af62110ff2859b5dd64fd4f118a901b8f37885756691f3/edc_analytics-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 22:54:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "clinicedc",
"github_project": "edc-analytics",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "edc-analytics"
}