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

Faker #46

Merged
merged 18 commits into from
Apr 1, 2022
Merged

Faker #46

merged 18 commits into from
Apr 1, 2022

Conversation

NanoNero
Copy link
Contributor

@NanoNero NanoNero commented Feb 10, 2022

Contributes to #44

What did you do?

Add a script to populate a Cloudant database with randomly generated documents.
The script adds documents for 5 classes - attorney, client, case, charge, sentence.

Why did you do it?

How have you tested it?

Were docs updated if needed?

  • No
  • Yes
  • N/A

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new console logs
  • Fixes entire issue
  • Partial fix for issue

@upkarlidder upkarlidder self-requested a review February 11, 2022 02:04
Copy link
Member

@upkarlidder upkarlidder left a comment

Choose a reason for hiding this comment

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

Good work @NNerurkar 👍🏽

My general concern is that this is a python package and the rest of the program is written in Java. I think it's okay for now, but ideally this would be a java program that can be run as part of maven script to instantiate the project. @siranjujugi looking for your input here. I think it's okay for now as we don't have another way to generate realistic data. We might eventually want to do the same in a Java/mvn way.

  1. Code observations:
  • I see the accountID and the apiKEY are inside the code. Can we extract them to .env file. Or maybe you can reuse https://github.com/Call-for-Code-for-Racial-Justice/Open-Sentencing-Aggregator/blob/main/src/main/liberty/config/server.sample.env
  • I see time.sleep statements. I am wondering if you are doing that because the code is ansynchronous? If so, we should use async/await or something similar instead of waiting for a certain time. It seems very brittle to me.
  1. Can you please add some documentation around how to use this code to generate cases, etc? This can go back in the main README.md file for aggregator.
  • what is the purpose of this code?
  • example on how to run the code. What parameters are needed.
  • example run and output
  1. Additionally, can you please add some unit tests? Something I can think of testing:
  • check for mandatory parameters if any
  • check for error conditions
    • passing in null or None vlaues
    • passing in wrong data datatypes

FYI @demilolu @siranjujugi @sforsyth089

@upkarlidder
Copy link
Member

@NNerurkar pls also fix the DCO error by following the Details listed in the PR. Hopefully it's just two commands.

@sethb4
Copy link
Contributor

sethb4 commented Feb 25, 2022

Hi @NNerurkar, something I noticed in the demo is that the script is adding documents to databases with different names than is supported by the aggregator.

The "Create and deploy Aggregator application" section of the README.md mentions "two Cloudant databases are required: outcarcerate-attorney and outcarcerate-client".

I actually think having more databases is a superior data model than is currently implemented. However, the aggregator now adds cases, charges, and sentences as part of the attorney document. Changing the data model used by the aggregator would require a fair amount of work and be a separate ticket.

Running a few queries via the swagger UI after adding documents with faker should help to identify any discreprencies with the data model.

Signed-off-by: NanoNero <[email protected]>
Signed-off-by: NanoNero <[email protected]>
@upkarlidder upkarlidder changed the title Faker WIP - Faker Mar 4, 2022
@NanoNero NanoNero changed the title WIP - Faker Faker Mar 9, 2022
NanoNero added 4 commits March 9, 2022 20:05
Signed-off-by: NanoNero <[email protected]>
Signed-off-by: NanoNero <[email protected]>
Copy link
Member

@upkarlidder upkarlidder left a comment

Choose a reason for hiding this comment

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

Thank you for making all the changes @NanoNero

scripts/populate_db_README.md Outdated Show resolved Hide resolved
scripts/populate_db_README.md Show resolved Hide resolved
scripts/populate_db_README.md Outdated Show resolved Hide resolved
@upkarlidder upkarlidder merged commit 4877e25 into Call-for-Code-for-Racial-Justice:main Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

5 participants