Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Create a script to generate dummy data #2147

Closed
wants to merge 0 commits into from
Closed

Create a script to generate dummy data #2147

wants to merge 0 commits into from

Conversation

blestab
Copy link
Contributor

@blestab blestab commented Jun 21, 2020

Fixes #2122 .

Changes proposed in this pull request:

  • Add mocker-data-generator plugin for dummy data generation
  • Add a new script into ./util that uses the mocker-data-generator plugin to create dummy data
    NB: script name: generatePatients, accepts one argument i.e. number of patients records to generate

Newly added dependencies with Bundlephobia links:

@gitpod-io
Copy link

gitpod-io bot commented Jun 21, 2020

@vercel
Copy link

vercel bot commented Jun 21, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/55x7ih8jv
✅ Preview: https://hospitalrun-frontend-git-fork-blestab-master.hospitalrun.vercel.app

@blestab
Copy link
Contributor Author

blestab commented Jun 21, 2020

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:
I haven't written tests yet and also still have issues with the dummy data generation whereby i ask for say 5 patients, but currently I always end up with less than 5 patients in the repository. At first i though i wasn't detecting correctly when the last patient has been added to the repository before navigating to the patients listing route, but when i temporarily disabled the rerouting, i am still not getting all 5 dummy patients to be saved into the local repository.

@ghost
Copy link

ghost commented Jun 21, 2020

@blestab Hello! Thank you for reaching out. I have an update.

  1. There's been a recent development in adding a more official login system at the entry to the site. So we no longer need to add a temporary login/logout feature from the Account navbar item.

  2. There's still a need for dummy data. I suggest that a script will be created so that we will be able to think about how to utilize the generated data later.

@vercel vercel bot temporarily deployed to Preview June 22, 2020 15:58 Inactive
@vercel vercel bot temporarily deployed to Preview June 22, 2020 16:09 Inactive
@vercel vercel bot temporarily deployed to Preview June 22, 2020 16:24 Inactive
@vercel vercel bot requested a deployment to Preview June 22, 2020 16:43 Abandoned
@vercel
Copy link

vercel bot commented Jun 22, 2020

Deployment failed with the following error:

Resource is limited - try again after in 15 minutes (more than 32, code: "api-deployments-free-builds-per-hour").

@matteovivona matteovivona requested review from a user and jackcmeyer June 22, 2020 16:47
@vercel vercel bot requested a deployment to Preview June 22, 2020 16:51 Abandoned
@vercel
Copy link

vercel bot commented Jun 22, 2020

Deployment failed with the following error:

Resource is limited - try again after in 6 minutes (more than 32, code: "api-deployments-free-builds-per-hour").

@blestab
Copy link
Contributor Author

blestab commented Jun 22, 2020

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:

`

         {
              patients:[array of Patients],
              allergies: [array of Allergies],
              appointments: [array of Appointments]
              diagnoses:[array of Diagnoses],
              notes: [array of Notes],
              carePlans: [array of CarePlans],
              relatedPersons: [array of RelatedPersons]
          }

`

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?

@vercel
Copy link

vercel bot commented Jun 23, 2020

Deployment failed with the following error:

Resource is limited - try again after in 1 hour (more than 100, code: "api-deployments-free-per-day").

@ghost
Copy link

ghost commented Jun 23, 2020

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?

@blestab Sounds great. Updated #2122. Thank you 👍

@vercel vercel bot requested a deployment to Preview June 23, 2020 08:29 Abandoned
@vercel
Copy link

vercel bot commented Jun 23, 2020

Deployment failed with the following error:

Resource is limited - try again after in 6 hours (more than 100, code: "api-deployments-free-per-day").

@vercel vercel bot requested a deployment to Preview June 23, 2020 10:00 Abandoned
@vercel
Copy link

vercel bot commented Jun 23, 2020

Deployment failed with the following error:

Resource is limited - try again after in 4 hours (more than 100, code: "api-deployments-free-per-day").

@blestab blestab changed the title feat: add "Login as Test" functionality with Dummy Data Create a script to generate dummy data Jun 24, 2020
@blestab
Copy link
Contributor Author

blestab commented Jun 24, 2020

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.

Copy link
Member

@jackcmeyer jackcmeyer left a 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.

Copy link
Member

@jackcmeyer jackcmeyer left a 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.

@blestab
Copy link
Contributor Author

blestab commented Jun 25, 2020

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.

Great! thanks Jack. Should i go ahead and implement this next step yet or do we want to flesh it out a bit more?

We'll need to make sure that the patient that is generated from the mock generator matches the object schema created from the frontend.

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.
NB: The script doesn't generate Labs or Incidents yet but we can easily add these in if desired.

@fox1t
Copy link
Member

fox1t commented Jun 25, 2020

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.

@ghost
Copy link

ghost commented Jun 25, 2020

@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.

ghost
ghost previously approved these changes Jun 25, 2020
@blestab
Copy link
Contributor Author

blestab commented Jun 25, 2020

Awesome! Thanks Kumiko

@fox1t
Copy link
Member

fox1t commented Jun 26, 2020

@kumikokashii perfect!
@blestab thanks for your contribution!

@fox1t
Copy link
Member

fox1t commented Jun 26, 2020

@jackcmeyer can we merge this?

@blestab
Copy link
Contributor Author

blestab commented Jun 26, 2020

@kumikokashii perfect!
@blestab thanks for your contribution!

My pleasure, looking forward to contribute more now that i have a better understanding of the solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a script to generate dummy data
3 participants