Question Groups Surveys PPI (Flexibile data capture)
Introduction
The functionality in mifos named 'Question groups' provides flexibility in capturing infromation from users of an MFIs services. In mifos 'Question groups' can be associated with its core concepts (loans, savings, clients, groups etc) and also can be used to capture certain information in some of the core workflows in mifos e.g. submit loan application.
The purpose of this page is to map the functionality of question groups to the parts in the code base that are repsonsible for executing it. see specs for details on question group functionality.
High-level View
The code for Question groups is mostly contained in the questionnaire and serviceInterfaces Functional Modules.
The packages of the questionnaire functionality are broken down as follows:
org.mifos.platform.questionnaire.service
NOTE: see !QuestionnaireServiceFacade in serviceInterefaces module and its implementation class QuestionnaireServiceFacadeImpl in appdomain module
org.mifos.platform.questionnaire.ui
Contains UI specific classes and representation of question group domain concepts.
org.mifos.platform.questionnaire.persistence
Data Access code for questionnaire functionality.
NOTE: This differs in operation from the rest of the application data access code. See how there are only 'interface' DAOs defined and no implementation. The name of the DAO method is used to map to a named query in the corresponding .hbm.xml file for the entity in question. e.g. see QuestionEntity.hbm.xml (QuestionEntity.retrieveAll) and the DAO interface method QuestionDao.retrieveAll
org.mifos.platform.questionnaire.domain
Vertical Slice examples
View Questions
Admin --> (Manage Questions) View Questions
In this example, the UI/MVC code detect user click on view questions and delegates to service facade to get all questions, this delegates to a another service which uses a DAO to retrieve all questions and map the domain entity into a specific data object for returning to the UI. (QuestionEntity --> QuestionDetail)
Create Question
Here, the UI/MVC code detects form submit for creating new question and delegates to service facade which delegates to another service to create all questions submitted. This first does validation on the data, then maps the data object from the UI into a domain entity (QuestionDetail --> QuestionEntity) and persists the QuestionEntity into the database (table="questions") using saveOrUpdate method of GenericDAO class.