Skip to content

[refactor] Clean Arch + Typescript (1st iteration)#345

Merged
adrianq merged 23 commits intorefactor/reduce-disaggregationsfrom
refactor/clean-arch-basic
Apr 1, 2026
Merged

[refactor] Clean Arch + Typescript (1st iteration)#345
adrianq merged 23 commits intorefactor/reduce-disaggregationsfrom
refactor/clean-arch-basic

Conversation

@tokland
Copy link
Copy Markdown
Contributor

@tokland tokland commented Mar 3, 2026

📌 References

📝 Implementation

This is the full list of objectives+tasks. We won't be doing all of them in this PR.

  • Remove Legacy code (load/save old campaigns).
  • Clean Arch:
    • Full refactor to clean arch.
    • models/campaign.ts: this file should eventually be domain/entities/campaign.ts without any references to db: DbD2. This will require extracting logic to repositories and use cases.
    • All calls from the React views should go through use cases in the composition root.
    • CompositionRoot
    • SaveCampaignUseCase
    • DeleteCampaignUseCase
    • GetCampaignUseCase
    • HasCampaignDataUseCase
    • Notifications: domain repository + DHIS2 implementation
    • GetCampaignListUseCase
    • GetPopulationUseCase
    • SavePopulationUseCase
    • ...
  • Typescript:
    • Convert all Javascript files to Typescript (initial status: 17 .js files, 10 .jsx files):
    • src/components/app/App.tsx
    • src/index.js
    • src/models/datasets.js
    • src/models/dashboard-items.js
    • src/components/steps/antigen-selection/AntigenSelectionStep.jsx
    • src/components/steps/organisation-units/OrganisationUnitsStep.jsx
    • src/components/steps/save/SaveStep.jsx
    • src/components/steps/general-info/GeneralInfoStep.jsx
    • src/components/dashboard/Dashboard.jsx
    • src/components/campaign-wizard/CampaignWizard.jsx
    • src/components/shared/PageHeader.jsx
    • src/components/data-entry/DataEntry.jsx
    • src/components/wizard/ExitWizardButton.jsx
    • src/components/spinner/Spinner.jsx
    • Global: Review all usages of "any"
    • ...
  • General:
    • Add linting for unused arguments.
    • Add ts-prune package (+ yarn script lint:unused).
    • Prune code (use ts-prune)
    • Remove CustomForm infrastructure (we will be using standard Data Entry app).
    • Refactor d2: D2 (provided by deprecated "d2" package, used with manual typing) by api: D2Api (d2-api, fully typed). Recent code already uses d2-api.
    • AntigensDisaggregation has become overly complex as requirements evolved. It should be simplified and refactored to better follow Clean Architecture, removing DHIS2-specific details like COCs. Part of the complexity comes from the agnostrict treatment of data elements and disaggregations. But some of them (DE: dose administered, mainly; categories: age group, doses) should be part of the domain, as it's something the domain should know about.

@tokland tokland marked this pull request as ready for review March 9, 2026 12:56
@adrianq adrianq merged commit 09b8bb2 into refactor/reduce-disaggregations Apr 1, 2026
@tokland
Copy link
Copy Markdown
Contributor Author

tokland commented Apr 13, 2026

2nd iteration continues here: #348

@tokland tokland mentioned this pull request Apr 13, 2026
42 tasks
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.

2 participants