Skip to content

doc: explicitly document that id_col defines the output column name#43

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-id-column-name-propagation
Draft

doc: explicitly document that id_col defines the output column name#43
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-id-column-name-propagation

Conversation

Copilot AI commented May 9, 2026

Copy link
Copy Markdown
Contributor

id_col in all three calculators acts as both an input column selector and an output schema contract — the returned DataFrame carries that exact column name — but this was never stated in any docstring or API reference, causing silent schema surprises in downstream pipelines.

Changes

  • Docstrings (comorbidity(), hfrs(), disability()): expanded id_col description to state explicitly that the value is used verbatim as the output column name; no renaming occurs.
  • docs/api.md: same note added to all three function entries; Returns bullets updated from "Patient ID (original column name)""Patient ID (column name matches id_col parameter)".
  • Test: added test_custom_id_col_name_preserved_in_output to assert that a non-default id_col (e.g. "PATIENT_ID") appears as the first column of the result.

Behaviour (unchanged)

df = pl.DataFrame({"PATIENT_ID": ["P001", "P001"], "ICD10_CODE": ["I21", "I50"]})
result = comorbidity(df, id_col="PATIENT_ID", code_col="ICD10_CODE")
assert result.columns[0] == "PATIENT_ID"  # always was true; now documented

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix unexpected ID column name propagation in comorbidity output doc: explicitly document that id_col defines the output column name May 9, 2026
Copilot AI requested a review from vvcb May 9, 2026 13:03
Copilot finished work on behalf of vvcb May 9, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected ID column name propagation in comorbidity() output (schema side‑effect not documented)

2 participants