The purpose of this study is to introduce software technologies and models and artificial intelligence algorithms to improve the weaknesses of CBT (Cognitive Behavior Therapy) method in psychotherapy. The presentation method for this purpose is the implementation of psychometric experiments in which the hidden human variables are inferred from the answers of tests. In this report, we describe the various models of Item Response Theory and measure the hidden components of ability and complementary parameters of the reality of the individuals situation. Psychometrics, selecting the appropriate model and estimating its parameters have been introduced and implemented using R language developed libraries. Due to the high flexibility of the Multi variant Rasch mixture Model, machine learning has been applied to this method of data modeling. BIC and CML were used to determine the number of hidden classes of the model and its parameters respectively, to obtain Measurement Invariance. The sensitivity of items to hidden attributes varies between groups (DIF), so methods for detecting it are introduced. This simulation is done based on the Verbal Aggression Dataset. We also analyze and compile a reference model based on this certificate based on the discovered patterns of software engineering. Other achievements of this study are related to providing a solution to explain the reengineering problems of the mind, by preparing an identity card for the clients by an ontology. Finally, applying the developed knowledge in the form of system thinking and recommended patterns in software engineering during the treatment process is pointed out.