Skip to main content

A Python package to convert tabular data and metadata into CDISC Dataset-JSON v1.1 format.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

📄 README.md

Project: dsjson

A lightweight Python package to convert clinical tabular datasets (e.g., SDTM/ADaM) and metadata into CDISC Dataset-JSON v1.1 format. It supports multiple metadata input formats including CSV, Excel, JSON, and XML (planned).

PyPI License: MIT PyPI - Python Version

🔧 Features

  • Converts DataFrame + column metadata to Dataset-JSON v1.1
  • Supports CSV, Excel, JSON for metadata
  • Auto-generates datasetJSONCreationDateTime
  • Enforces required top-level metadata
  • Extract Variable Label from Specification
  • Converts extracted Variable Labels into column metadata

📦 Installation

pip install dsjson

🚀 Quick Start

from dsjson import load_metadata, to_dataset_json, extract_labels, make_column_metedata
import pandas as pd

my_excel_path = r"specification path"

# Load data
rows = pd.read_csv("examples/vs.csv")

# Extract variables from specification and convereted that to column metadata
variable_labels = extract_labels(spec_path=my_excel_path, sheet_name="DM", variable_name_col="Variable Name", variable_label_col="Variable Label")
columns = make_column_metadata(df=data_df, variable_labels=variable_labels, domain="DM")

# this can be used where we already have column metadata already defined in a file - if you make column metadata as per above code, then this is not required
columns = load_metadata("examples/columns_vs.csv", file_type="csv")

# Create Dataset-JSON
ds = to_dataset_json(
    data_df=rows,
    columns_df=columns,
    name="VS",
    label="Vital Signs",
    itemGroupOID="IG.VS",
    originator="My CRO",
    sourceSystem_name="Python",
    sourceSystem_version="3.10",
    fileOID="F.VS.001",
    studyOID="S.1234"
)

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

dsjson-1.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

dsjson-1.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file dsjson-1.2.tar.gz.

File metadata

  • Download URL: dsjson-1.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for dsjson-1.2.tar.gz
Algorithm Hash digest
SHA256 31e29114e7298c7441244dabadc5255c69e1230c400ad837202db4c57b764322
MD5 4bba4c13edea29c2d0fa1e7f0c9d1ad5
BLAKE2b-256 29480e957f2f615b870b97a6c542142bf018dac139bb6805931bf1bab8a4e954

See more details on using hashes here.

File details

Details for the file dsjson-1.2-py3-none-any.whl.

File metadata

  • Download URL: dsjson-1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for dsjson-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 420c38a53afa076e6db79df27e61c36b32b3d61699b731164404510c7461d617
MD5 f2692dfb6797a01feb0e69260b6c9d32
BLAKE2b-256 02a830ec46056cfbc414e668770782a2cbbb45dcd936741362b0af035c049725

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