-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Create a script to generate dummy data #2147
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/55x7ih8jv |
Hi @kumikokashii When you have a moment may you have a peekat this draft PR and let me know if i am on the right track with my approach. Instead of having hardcoded JSON documents with dummy data, i have employed the use of mocker-data-generator (https://bundlephobia.com/[email protected]) and defined the relevant models to drive the data generation. Still to do/figure out: |
@blestab Hello! Thank you for reaching out. I have an update.
|
Deployment failed with the following error:
|
Deployment failed with the following error:
|
Okay great, thanks @kumikokashii I will go ahead remove UI and state update related changes and only leave the dummy data generation which other components could then make use of the dummy data in any way desired? The generated data will be of the following form: `
` If the above sounds about right then maybe we can go ahead update the task description to reflect that we are only focusing on generating dummy data? |
Deployment failed with the following error:
|
Deployment failed with the following error:
|
Deployment failed with the following error:
|
Hi @kumikokashii I have applied the changes as discussed and updated the PR description to indicate the same. For an example of how to use this script, see the unit tests added for this. Let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the script! I think that we should/can take it one step further and enter this in CouchDB.
We can use CouchDB's REST API to enter documents into the database.
See: https://www.tutorialspoint.com/couchdb/couchdb_creating_a_document.htm for a nice example on how to create a document.
We'll need to make sure that the patient that is generated from the mock generator matches the object schema created from the frontend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can also move this to the /scripts
directory.
Great! thanks Jack. Should i go ahead and implement this next step yet or do we want to flesh it out a bit more?
Yes. So we have setup the mock-data-generator models based on the respective models (Patient, Appointment, Note, Diagnosis, Allergy, CarePlan and RelatedPerson) from the ./models folder. |
Hi. I am not sure that this is the correct place for mocking data. If we are going to mock CouchDB we need to add it to server repository. This is the correct moment to reorganize our stuff since soon the server part will be mandatory in order to work on FE repo. |
@blestab It's an awesome script! Great job 👍, and thank you 😊! We'll take it from here. The reason is that we are currently in a beginning phase with the database-related functionalities, and this is a good time to pause before changing this around further. @fox1t @jackcmeyer A ticket has been created to properly place this script in the server repo once ready. This assumes this PR will be merged. |
Awesome! Thanks Kumiko |
@kumikokashii perfect! |
@jackcmeyer can we merge this? |
My pleasure, looking forward to contribute more now that i have a better understanding of the solution. |
Fixes #2122 .
Changes proposed in this pull request:
NB: script name: generatePatients, accepts one argument i.e. number of patients records to generate
Newly added dependencies with Bundlephobia links: