<commit_before>package models.reader

import javax.inject.Inject

import akka.actor.{Actor, Props}
import akka.event.LoggingReceive
import models.entity.DataImport
import models.reader.ManagerActor.{DataImportDone, DataImportOrder, FileAlreadyImported, StartDataImport}
import play.api.Logger
import play.api.libs.concurrent.InjectedActorSupport

object ManagerActor {


  def props = Props[ManagerActor]

  case class DataImportOrder(path: String)

  case class StartDataImport(path: String)

  case class FileAlreadyImported(dataImport: DataImport)

  case object DataImportDone

}

class ManagerActor @Inject()(val dataImportFactory: DataImportActor.Factory,
                             val valuesFactory: ValuesManagerActor.Factory) extends Actor with InjectedActorSupport {

  override def preStart(): Unit = {
    Logger.debug("Starting SAEP Data Import...")

    self ! DataImportOrder("C:\\Users\\Leonardo\\Desktop\\Perfil_eleitorado\\perfil_eleitorado_1998.txt")
  }

  override def receive = LoggingReceive {

    case DataImportOrder(path) => {
      val dataImportActor = injectedChild(dataImportFactory(), "data-import-actor$" + System.nanoTime())
      dataImportActor ! DataImportActor.CheckFileAlreadyImported(self, path)
    }

    case StartDataImport(path) => {
      val valuesManagerActor = injectedChild(valuesFactory(), "values-manager-actor-$" + System.nanoTime())
      valuesManagerActor ! ValuesManagerActor.ReadValuesFromFile(self, path)
    }

    case FileAlreadyImported(dataImport) => {
      Logger.debug("Nothing to do.")

    }

    case DataImportDone => {
      context.stop(self)<commit_msg>fix on Manager Actor<commit_after>package models.reader

import javax.inject.Inject

import akka.actor.{Actor, Props}
import akka.event.LoggingReceive
import models.entity.DataImport
import models.reader.ManagerActor.{DataImportDone, DataImportOrder, FileAlreadyImported, StartDataImport}
import play.api.Logger
import play.api.libs.concurrent.InjectedActorSupport

object ManagerActor {


  def props = Props[ManagerActor]

  case class DataImportOrder(path: String)

  case class StartDataImport(path: String)

  case class FileAlreadyImported(dataImport: DataImport)

  case object DataImportDone

}

class ManagerActor @Inject()(val dataImportFactory: DataImportActor.Factory,
                             val valuesFactory: ValuesManagerActor.Factory) extends Actor with InjectedActorSupport {

  override def preStart(): Unit = {
    Logger.debug("Starting SAEP Data Import...")

    // ex: self ! DataImportOrder("C:\\Users\\Leonardo\\Desktop\\Perfil_eleitorado\\perfil_eleitorado_1998.txt")
  }

  override def receive = LoggingReceive {

    case DataImportOrder(path) => {
      val dataImportActor = injectedChild(dataImportFactory(), "data-import-actor$" + System.nanoTime())
      dataImportActor ! DataImportActor.CheckFileAlreadyImported(self, path)
    }

    case StartDataImport(path) => {
      val valuesManagerActor = injectedChild(valuesFactory(), "values-manager-actor-$" + System.nanoTime())
      valuesManagerActor ! ValuesManagerActor.ReadValuesFromFile(self, path)
    }

    case FileAlreadyImported(dataImport) => {
      Logger.debug("Nothing to do.")

    }

    case DataImportDone => {
      context.stop(self)
{'fraction_non_alphanumeric': 0.09743433109346365, 'fraction_numerical': 0.002443494196701283, 'mean_word_length': 4.333876221498372, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3501388', 'n_tokens_mistral': 964, 'n_tokens_neox': 899, 'n_words': 191}