-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Component: Data GeneratorIssue/PR that addresses DataGenerator methodsIssue/PR that addresses DataGenerator methodsgood first issueGood for newcomersGood for newcomershacktoberfestIssues suitable for hacktoberfestIssues suitable for hacktoberfest
Description
Code generation logic is duplicated across multiple generator files. This creates maintenance issues and inconsistent behavior.
Files affected:
healthchain/data_generators/conditiongenerators.py
- Other generator files with similar patterns
Current TODO:
# TODO: Factor out the code generation logic to a central place
Problem:
Code generation for FHIR coding systems (creating code/system/display objects) is repeated in multiple generators. This leads to:
- Code duplication
- Inconsistent coding patterns
- Harder to maintain and extend
Goal:
Create centralized code generation utilities that can be reused across all generators.
Acceptance Criteria:
- Identify all places where code generation logic is duplicated
- Create shared utility functions (suggest:
healthchain/data_generators/coding_utils.py
) - Refactor existing generators to use shared utilities
- Ensure all existing tests still pass
- Code should support common coding systems (ICD-10, SNOMED CT, LOINC, etc.)
Suggested approach:
# healthchain/data_generators/coding_utils.py
def create_coding(
code: str,
system: str,
display: Optional[str] = None,
version: Optional[str] = None
) -> dict:
"""Create a standardized FHIR Coding object."""
coding = {
"system": system,
"code": code,
}
if display:
coding["display"] = display
if version:
coding["version"] = version
return coding
# Common system URIs as constants
SNOMED_CT_URI = "http://snomed.info/sct"
ICD10_URI = "http://hl7.org/fhir/sid/icd-10"
LOINC_URI = "http://loinc.org"
Resources:
- Review
healthchain/data_generators/basegenerators.py
for existing patterns - FHIR Coding data type
- Search codebase for repeated code generation patterns
Metadata
Metadata
Assignees
Labels
Component: Data GeneratorIssue/PR that addresses DataGenerator methodsIssue/PR that addresses DataGenerator methodsgood first issueGood for newcomersGood for newcomershacktoberfestIssues suitable for hacktoberfestIssues suitable for hacktoberfest
Type
Projects
Status
Todo