Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(fakeData): KAM-331: Create fake-data package #7241

Merged
merged 52 commits into from
Feb 26, 2025

Conversation

tcodling
Copy link
Contributor

@tcodling tcodling commented Feb 19, 2025

Changes

As part of our testing project for creating a synthetic environment, we have decided to pull out the logic for populating a DB instance with data used in determinism testing into its own package fake-data. This will be used for both determinism testing and will be used in the future to populate the synthetic test environment + any other use case for generating fake data.

  • Create new package fake-data
  • Move over the functions for populating the DB for determinism testing from /scripts to the new package
  • Split up into functions that create various groups of linked data roughly in line with how they would be made realistically
    • Introduced some parameters with randomness

Determinism testing was done and passed in a pr branched off this with dummy migration #7264

Deploys

  • Deploy to Tamanu Internal

Remember to...

  • ...write or update tests
  • ...add UI screenshots and testing notes to the Linear issue
  • ...add any manual upgrade steps to the Linear issue
  • ...update the config reference, settings reference, or any relevant runbook(s)
  • ...call out additions or changes to config files for the deployment team to take note of

@tcodling tcodling changed the title KAM-331: Create data generation package refactor(fakeData): KAM-331: Create data generation package Feb 19, 2025
@tcodling tcodling changed the title refactor(fakeData): KAM-331: Create data generation package refactor(fakeDataGeneration): KAM-331: Create data generation package Feb 24, 2025
@tcodling tcodling changed the title refactor(fakeDataGeneration): KAM-331: Create data generation package refactor(fakeDataGeneration): KAM-331: Create fake-data package Feb 24, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All files in this directory are helper functions built out of the original logic in the old scripts/src/fake.ts

User,
} from '@tamanu/database';

export const generateImportData = async ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generate one of each import data types to be used for foreign key relationships when making clinical data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the fence if I should have this file with all import data, or split it up amongst the other files in this directory in new functions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see it either way or both but let's just have it all in here for now for simplicity.

Comment on lines +24 to +25
noteCount = chance.integer({ min: 1, max: 5 }),
diagnosisCount = chance.integer({ min: 1, max: 5 }),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done some simple randomness here but am a bit on the fence about how far I should take it

Do you think some relatively simple randomness like this is fine? Or do you think it is worth doing what we were talking about where you mentioned taking in a range or number and using that to generate the random number. Its easy enough to do but am a little worried about over-engineering 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah the way you've got it is fine. We can always make it customisable later if we feel like it.

@tcodling tcodling requested a review from passcod February 25, 2025 02:45
@tcodling tcodling merged commit 19742a8 into main Feb 26, 2025
118 checks passed
@tcodling tcodling deleted the kam-331-create-data-generation-package branch February 26, 2025 22:21
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