-
Notifications
You must be signed in to change notification settings - Fork 25
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
A working API to automate the creation of questions #765
Conversation
…te the creation of questions for the tables subject types and Address
…sync created and waitforsync eliminated
…dress table automated
b7fccd3
to
77bee27
Compare
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.
DatabaseRepository - Create proper objects for what you return, not JsonNode.
DatabaseService - Don't return Strings if there are specific known values. Move them into enum values
DatabaseService (createQuestionForTable) - Push towards making smaller objects that describe your data instead of directly using ObjectNodes.
DatabaseService - Eventually, we will plug this in when there are changes in programs, subject types etc. Which means there needs to be methods to make changes for specific subject types
StringUtils.java - There is an S.java that is meant for String utilities
getDatabaseDetails is being called multiple times. This is a network call, and can potentially get slow. Try to optimize
Not sure of the purpose of the db migrations
application.properties changes need to be reverted
Need to check how this works.
int tableId = getTableIdByName("Subject Type");
When running first time, the subject type tables will be of the form "schema"."subjectTypeName", so how do the subject type tables get created?
…ore modifications will be done during the day
|
||
public enum TableType { | ||
INDIVIDUAL("Individual"), | ||
HOUSEHOLD("Household"), |
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.
Where is table type for "Encounter".?
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.
We have "ProgramEncounter" isn't it? 🤔
@PostMapping("/create-questions") | ||
public void createQuestions() throws Exception{ | ||
databaseService.createQuestionsForSubjectTypes(); | ||
databaseService.createQuestionsForProgramsAndEncounters(); |
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.
Define and invoke databaseService.createQuestionsForSubjectGeneralEncounterTypes()
b2604a0
to
688f0a7
Compare
d6dbf4a
to
e9ff297
Compare
…CreationService
0f4c727
to
de870a1
Compare
…Name and removed Primitive obsession
33aa261
to
87c122f
Compare
…al tables : Its now using AddressQuestionCreationService
09b9cb4
to
dbef075
Compare
@ombhardwajj Pretty happy with the overall design and functionality of the Automated Question Creation service on Metabase. Have specified list of code review comments from our code walkthrough session earlier:
|
…ed createQuestionForIndividualTable method , Deleted MetabaseJoin
@ombhardwajj another thought that occurred to me regarding this, in-case the Questions were previously created and we introduce a new SubjectType / EncounterType, etc.. if we retrigger the AutoQuestionCreationAPI "/create-questions", would it work as expected and create Question only for the new one and not try and recreate all of them.? |
…tabaseService 2) Replaced getSubjectTypeNames usage of int literals with constants depictiing columnsNames 3)Created common method called by createQuestionsForSubjectTypes() and createQuestionsForPrograms(), createQuestionsForProgramsEncounters() and createQuestionsForEncounters() with List entityNames 4)Added CollectionItem , Now before creating questions, the existing ones are filtered out
Hey @himeshr I've addressed all the concerns including duplication of questions. Please review the code 🙇 |
"createQuestionForTable( schema => !public is not used)" => This one is pending, but going ahead with merge as its a small inconsequential thing. |
What
A working API to automate the creation of questions for the all the tables of "subject types" and "Address" has been successfully built.
How does it work?