Skip to content

Conversation

@rw251
Copy link
Contributor

@rw251 rw251 commented Jan 23, 2026

The recent RSI iteration was on how people upload CSVs and whether the default of excluding all missing descendants was contributing to low quality codelists. This PR is the final interface following a few rounds of user testing.

  1. Selecting a CSV on the create codelist page, triggers an async request to a new csv-descendants-preview endpoint
  2. This analyses the CSV and:
    • detects the coding system
    • detects if there are header rows
    • detects the column containing the clinical codes
    • finds any codes, not in the CSV, but where they have an ancestor code in the CSV
  3. The user is then presented with the results
  4. If there are "missing" children, the user is shown which codes are missing, and a choice to exclude them all (the current default), or to leave them unresolved and decide on the next screen (the builder page). The default is to choose case by case as this is the safer option

The benefits are:

  • More user friendly:
    • the user no longer needs to specify if there is a header row because it's detected automatically
    • the user no longer needs to have the clinical codes in the first column because we detect the column
    • various checks are done as soon as the user selects the CSV and warnings/errors can be displayed before they submit the page by clicking Create
  • Makes it harder for a user to accidentally create a codelist with missing children, while still retaining the option to create a CSV codelist in the previous way (by excluding all missing children)

Selected screenshots

1. Removed the "does your file have a header" radio. Updated help message to explain what will happen:
image

2. Display preview of CSV along with what was detected:
image

3. Check if detected coding system clashes with selected coding system:
image

4. Existing errors with CSVs can now be shown immediately. Previously this warning would only appear after page submission:
image

5. If there are missing children, we explain the options, and show which codes are missing:
image

6. Excluding missing child codes has a visual indicator in the list of missing codes:
image

rw251 added 8 commits January 22, 2026 12:16
- detects the header row(s)
- detects the coding system
- detects the column containing clinical codes
When passed a CSV file it:
- detects the coding system, column containing the clinical codes, and the header row(s) if included
- finds all the "missing" descendant concepts, that is any code not in the CSV, but where an ancestor code is in the CSV
-  displays the number of header rows (or "no header row" if none found)
- displays the detected coding system, and a warning if the selected coding system differs
- displays the column number containing the clinical codes
- displays up to the top 5 rows, and a final "xxx more rows"  row if applicable
Given we can now autodetect the header we don't need to ask the user if there is one
- If checked the behaviour is the same as it used to be (i.e. child codes not in the CSV are explicitly excluded)
- if unchecked, it causes all the child codes to be "unresolved" and require review on the builder screen
It's useful to the user to see in advance which child codes are missing from their CSV to help them decide whether to exclude them all
If the uploaded CSV has issues, then we know clicking create will just stay on the page and display the same error, so if we're already displaying the problem with the CSV then disable the button.
Uploads a CSV with and without checking the "exclude child codes" box.
@mikerkelly mikerkelly added enhancement New feature or request csv CSV handling labels Jan 27, 2026
@rw251
Copy link
Contributor Author

rw251 commented Jan 28, 2026

The following issues can likely be closed when this change is merged:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

csv CSV handling enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants