AlexsLemonade / AlexsLemonade/refinebio

Use enums instead of strings in some model fields

Open
#2,773 0 comments 0 reactions 0 assignees View on GitHub
nice to have
Dominant language
Python
Stars
135
Forks
21
PR merge metrics
No merged PRs in 30d

Description

### Context

I just spent a long time tracking down an issue whose ultimate cause was one of the compendia tests having `sample.technology = "RNASEQ"` instead of `sample.technology = "RNA-SEQ"`.

### Problem or idea

Using strings for fields that only have a finite number of possible values can be error-prone, and it makes typos like the above hard to detect.

### Solution or next step

Switch to enums like we use in `ProcessorPipeline`. We would need to look into how Django deals with enums, because ideally we could make this change without a migration.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the existing ProcessorPipeline enum and the Django model fields that have finite values; the issue does not name specific models or tests. Research Django’s enum and migration behavior, then identify the affected fields and verify that their values reject typos while avoiding a migration if feasible.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, database
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.