<commit_before>package org.devgateway.ocvn.persistence.mongo.reader;

import org.devgateway.ocds.persistence.mongo.Gazetteer;
import org.devgateway.ocds.persistence.mongo.Location;
import org.devgateway.ocds.persistence.mongo.reader.RowImporter;
import org.devgateway.ocds.persistence.mongo.spring.ImportService;
import org.devgateway.ocvn.persistence.mongo.dao.VNLocation;
import org.devgateway.ocvn.persistence.mongo.repository.VNLocationRepository;
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;

import java.text.ParseException;

/**
 * Specific {@link RowImporter} for {@link Location}, in the custom Excel format
 * provided by Vietnam
 *
 * @author mihai
 * @see Location
 */
public class LocationRowImporter extends RowImporter<VNLocation, VNLocationRepository> {

    public LocationRowImporter(final VNLocationRepository locationRepository, final ImportService importService,
                               final int skipRows) {
        super(locationRepository, importService, skipRows);
    }

    @Override
    public void importRow(final String[] row) throws ParseException {

        VNLocation location = repository.findByDescription(row[0]);
        if (location != null) {
            throw new RuntimeException("Duplicate location name " + row[0]);
        }

        location = new VNLocation();

        location.setDescription(row[0]);
<commit_msg>OCVN-169 fixed identifier unspecified for location<commit_after>package org.devgateway.ocvn.persistence.mongo.reader;

import org.devgateway.ocds.persistence.mongo.Gazetteer;
import org.devgateway.ocds.persistence.mongo.Location;
import org.devgateway.ocds.persistence.mongo.reader.RowImporter;
import org.devgateway.ocds.persistence.mongo.spring.ImportService;
import org.devgateway.ocvn.persistence.mongo.dao.VNLocation;
import org.devgateway.ocvn.persistence.mongo.repository.VNLocationRepository;
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;

import java.text.ParseException;

/**
 * Specific {@link RowImporter} for {@link Location}, in the custom Excel format
 * provided by Vietnam
 *
 * @author mihai
 * @see Location
 */
public class LocationRowImporter extends RowImporter<VNLocation, VNLocationRepository> {

    public LocationRowImporter(final VNLocationRepository locationRepository, final ImportService importService,
                               final int skipRows) {
        super(locationRepository, importService, skipRows);
    }

    @Override
    public void importRow(final String[] row) throws ParseException {

        VNLocation location = repository.findByDescription(row[0]);
        if (location != null) {
            throw new RuntimeException("Duplicate location name " + row[0]);
        }

        location = new VNLocation();

        location.setId(row[3]);
        location.setDescription(row[0]);

{'fraction_non_alphanumeric': 0.09398099260823653, 'fraction_numerical': 0.0035198873636043647, 'mean_word_length': 4.120720720720721, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4639126', 'n_tokens_mistral': 809, 'n_tokens_neox': 798, 'n_words': 164}