Skip to main content

Use pandas with clinicedc/edc projects

Project description

pypi actions codecov downloads

edc-pdutils

Use pandas with the Edc

To export Crf data, for example:

csv_path = '/Users/erikvw/Documents/ambition/export/'
date_format = '%Y-%m-%d'
sep = ','

class MyDfHandler(CrfDfHandler):
    visit_tbl = 'ambition_subject_subjectvisit'
    exclude_columns = ['form_as_json', 'survival_status','last_alive_date',
                       'screening_age_in_years', 'registration_datetime',
                       'subject_type']

class MyCsvCrfTablesExporter(CsvCrfTablesExporter):
    visit_columns = ['subject_visit_id']
    datetime_fields = ['randomization_datetime']
    df_handler_cls = MyDfHandler
    app_label = 'ambition_subject'
    export_folder = csv_path

sys.stdout.write('\n')
exporter = MyCsvCrfTablesExporter()
exporter.to_csv(date_format=date_format, delimiter=sep)

To export INLINE data for any CRF configured with an inline, for example:

class MyDfHandler(CrfDfHandler):
    visit_tbl = 'ambition_subject_subjectvisit'
    exclude_columns = ['form_as_json', 'survival_status','last_alive_date',
                       'screening_age_in_years', 'registration_datetime',
                       'subject_type']


class MyCsvCrfInlineTablesExporter(CsvCrfInlineTablesExporter):
    visit_columns = ['subject_visit_id']
    df_handler_cls = MyDfHandler
    app_label = 'ambition_subject'
    export_folder = csv_path
    exclude_inline_tables = [
        'ambition_subject_radiology_abnormal_results_reason',
        'ambition_subject_radiology_cxr_type']
sys.stdout.write('\n')
exporter = MyCsvCrfInlineTablesExporter()
exporter.to_csv(date_format=date_format, delimiter=sep)

Settings

EXPORT_FILENAME_TIMESTAMP_FORMAT: True/False (Default: False)

By default a timestamp of the current date is added as a suffix to CSV export filenames.

By default a timestamp of format %Y%m%d%H%M%S is added.

EXPORT_FILENAME_TIMESTAMP_FORMAT may be set to an empty string or a valid format for strftime.

If EXPORT_FILENAME_TIMESTAMP_FORMAT is set to an empty string, “”, a suffix is not added.

For example:

# default
registered_subject_20190203112555.csv

# EXPORT_FILENAME_TIMESTAMP_FORMAT = "%Y%m%d"
registered_subject_20190203.csv

# EXPORT_FILENAME_TIMESTAMP_FORMAT = ""
registered_subject.csv

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edc-pdutils-0.3.12.tar.gz (49.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

edc_pdutils-0.3.12-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

Details for the file edc-pdutils-0.3.12.tar.gz.

File metadata

  • Download URL: edc-pdutils-0.3.12.tar.gz
  • Upload date:
  • Size: 49.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for edc-pdutils-0.3.12.tar.gz
Algorithm Hash digest
SHA256 b27e92ca1d9c4df2fd992392c465c05eb9ba1ec758d2a2f9896349b37bbf4b76
MD5 7fce99d4f9044ad2cf0109aa8caf1070
BLAKE2b-256 5b5c998a24d7d7bc43a275a8d603aac05ab46c3db40277d0653f59237ec9d7fa

See more details on using hashes here.

File details

Details for the file edc_pdutils-0.3.12-py3-none-any.whl.

File metadata

  • Download URL: edc_pdutils-0.3.12-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for edc_pdutils-0.3.12-py3-none-any.whl
Algorithm Hash digest
SHA256 0b955823aed657f0dcf879101ef9f00657f19093fd66ae024e30dc8f63fb147a
MD5 91a21b0555eb6c7f5b963df70ab69760
BLAKE2b-256 61f08a8ef886df7481392a938ce702e3f35bc98b242996157b42c2e9c9fc2649

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page