opensafely-core / opensafely-core/opencodelists
Server error when converting a BNF codelists in some situations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 60
- Forks
- 16
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 17
Description
Why are we doing this?
There are situations where attempting to convert a BNF codelist to DM+D results in a 500 server error. If an identical dmd codelist already exists the code should display a banner to the end user with a link to the dmd file. However the code that attempts to get the link fails if there are multiple identical slugs (which can happen as they're only unique to a user or an org).
How will we know when it's done?
The conversion no longer returns an error but instead displays the banner linking back to the existing dmd codelist
What are we doing?
This line fails if there are multiple identical slugs:
Instead we should scope it to the user or org, similar (but not identical) to this code here:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in codelists/views/version_dmd_convert.py at the failing line, then compare the scoping approach in codelists/actions.py around lines 760-763. Update the lookup so duplicate slugs are scoped to the relevant user or organisation. Done means conversion no longer returns a 500 error and displays a banner linking to the existing DM+D codelist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100