<commit_before><?php

require_once 'MuinaismuistotImportSettings.php';

class MuinaismuistotImport {
	protected $settings;
	protected $pdo;

	public function __construct() {
		$this->settings = new MuinaismuistotImportSettings();
		$this->initDatabase();
	}

	protected function initDatabase() {
		$this->pdo = new PDO(
			'mysql:host=' . $this->settings->DB_SERVER . ';dbname=' . $this->settings->DB_NAME,
			$this->settings->DB_USERNAME,
			$this->settings->DB_PASSWORD
		);
		$this->pdo->exec('SET SQL_MODE=ANSI_QUOTES');
		$this->pdo->exec("SET NAMES '" . $this->settings->DB_CHARSET . "'");
		$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	}

	public function start($step) {
		switch ($step) {
		    case 1:
		        //Create temp work table
		    	$this->dropOldTables();
				$this->dropAndCreateMuinaismuistopisteWorkTable();
				$this->printMessage('Next: Import data from CSV');
		        break;
		    case 2:
		        //Import data from CSV
				$this->importCSVToMuinaismuistopisteWork();
				$this->printMessage('Next: Tyyppi');
		        break;
		    case 3:
		        //Tyyppi
				$this->createAndPopoulateTyyppiTable();
				$this->updateTyyppiToID();
				$this->printMessage('Next: Alatyyppi');
		        break;
		    case 4:
		        //Alatyyppi
				$this->createAndPopoulateAlatyyppiTable();
				$this->updateAlatyyppiToID();
				$this->printMessage('Next: Laji');
		        break;
		    case 5:
		        //Laji
				$this->createAndPopoulateLajiTable();
				$this->updateLajiToID();
				$this->printMessage('Next: Kunta');
		        break;
		    case 6:
		        //Kunta
				$this->createAndPopoulateKuntaTable();
				$this->updateKuntaToID();
				$this->printMessage('Next: Tuhoutunut ja Vedenalainen');
		        break;
		    case 7:
		        //Tuhoutunut and vedenalainen
				$this->updateTuhoutunutToBoolean();
				$this->updateVedenalainenToBoolean();
				$this->printMessage('Next: Create final table');
		        break;
		    case 8:
		        //Create final table
				$this->dropAndCreateMuinaismuistopisteFinalTable();
				$this->printMessage('Next: Copy data from work table to final');
		        break;
		    case 9:
		        //Final result
				$this->copyMuinaismuistopisteFromWorkToFinal();
				$this->printMessage('Next: Ajoitus');
		    case 10:
		        //Ajoitus
				$this->createAjoituTable();
				$this->insertDataToAjoitus();
				$this->createMuinaisjaannospisteAjoitusTable();
				$this->insertDataToMuinaisjaannospisteAjoitus();<commit_msg>Added missing break from switch<commit_after><?php

require_once 'MuinaismuistotImportSettings.php';

class MuinaismuistotImport {
	protected $settings;
	protected $pdo;

	public function __construct() {
		$this->settings = new MuinaismuistotImportSettings();
		$this->initDatabase();
	}

	protected function initDatabase() {
		$this->pdo = new PDO(
			'mysql:host=' . $this->settings->DB_SERVER . ';dbname=' . $this->settings->DB_NAME,
			$this->settings->DB_USERNAME,
			$this->settings->DB_PASSWORD
		);
		$this->pdo->exec('SET SQL_MODE=ANSI_QUOTES');
		$this->pdo->exec("SET NAMES '" . $this->settings->DB_CHARSET . "'");
		$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	}

	public function start($step) {
		switch ($step) {
		    case 1:
		        //Create temp work table
		    	$this->dropOldTables();
				$this->dropAndCreateMuinaismuistopisteWorkTable();
				$this->printMessage('Next: Import data from CSV');
		        break;
		    case 2:
		        //Import data from CSV
				$this->importCSVToMuinaismuistopisteWork();
				$this->printMessage('Next: Tyyppi');
		        break;
		    case 3:
		        //Tyyppi
				$this->createAndPopoulateTyyppiTable();
				$this->updateTyyppiToID();
				$this->printMessage('Next: Alatyyppi');
		        break;
		    case 4:
		        //Alatyyppi
				$this->createAndPopoulateAlatyyppiTable();
				$this->updateAlatyyppiToID();
				$this->printMessage('Next: Laji');
		        break;
		    case 5:
		        //Laji
				$this->createAndPopoulateLajiTable();
				$this->updateLajiToID();
				$this->printMessage('Next: Kunta');
		        break;
		    case 6:
		        //Kunta
				$this->createAndPopoulateKuntaTable();
				$this->updateKuntaToID();
				$this->printMessage('Next: Tuhoutunut ja Vedenalainen');
		        break;
		    case 7:
		        //Tuhoutunut and vedenalainen
				$this->updateTuhoutunutToBoolean();
				$this->updateVedenalainenToBoolean();
				$this->printMessage('Next: Create final table');
		        break;
		    case 8:
		        //Create final table
				$this->dropAndCreateMuinaismuistopisteFinalTable();
				$this->printMessage('Next: Copy data from work table to final');
		        break;
		    case 9:
		        //Final result
				$this->copyMuinaismuistopisteFromWorkToFinal();
				$this->printMessage('Next: Ajoitus');
				break;
		    case 10:
		        //Ajoitus
				$this->createAjoituTable();
				$this->insertDataToAjoitus();
				$this->createMuinaisjaannospisteAjoitusTable();
				$this->insertDataToMuinaisjaannospisteAjoitus();
{'fraction_non_alphanumeric': 0.14325341787200316, 'fraction_numerical': 0.004359025163463444, 'mean_word_length': 3.0384, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1062455', 'n_tokens_mistral': 2042, 'n_tokens_neox': 1682, 'n_words': 282}