<commit_before>package ru.r2cloud.cloud;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ru.r2cloud.SpectogramService;
import ru.r2cloud.model.ObservationResult;
import ru.r2cloud.satellite.ObservationResultDao;
import ru.r2cloud.util.Configuration;

public class R2CloudService {

	private static final Logger LOG = LoggerFactory.getLogger(R2CloudService.class);

	private final Configuration config;
	private final ObservationResultDao dao;
	private final R2CloudClient client;
	private final SpectogramService spectogramService;

	public R2CloudService(Configuration config, ObservationResultDao dao, R2CloudClient client, SpectogramService spectogramService) {
		this.config = config;
		this.dao = dao;
		this.client = client;
		this.spectogramService = spectogramService;
	}

	public void uploadObservation(String satelliteId, String observationId) {
		String apiKey = config.getProperty("r2cloud.apiKey");
		if (apiKey == null) {
			return;
		}
		LOG.info("uploading observation: " + observationId);
		ObservationResult observation = dao.find(satelliteId, observationId);
		if (observation == null) {
			LOG.info("observation not found");
			return;
		}
		Long id = client.saveMeta(observation);
		if (id == null) {
			return;
		}
		if (observation.getaPath() != null) {
			client.saveData(id, observation.getaPath());
		} else if (observation.getDataPath() != null) {
			client.saveData(id, observation.getDataPath());
		}
		if (config.getBoolean("r2cloud.syncSpectogram")) {
			if (observation.getSpectogramPath() == null) {
				File spectogram = spectogramService.create(observation.getWavPath());
				if (spectogram != null) {
					client.saveSpectogram(id, spectogram);
					if (!dao.saveSpectogram(satelliteId, observationId, spectogram)) {
						LOG.info("unable to save spectogram");
					}
				}
			} else {
				client.saveSpectogram(id, observation.getSpectogramPath());
			}<commit_msg>upload only raw data files for lrpt<commit_after>package ru.r2cloud.cloud;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ru.r2cloud.SpectogramService;
import ru.r2cloud.model.ObservationResult;
import ru.r2cloud.satellite.ObservationResultDao;
import ru.r2cloud.util.Configuration;

public class R2CloudService {

	private static final Logger LOG = LoggerFactory.getLogger(R2CloudService.class);

	private final Configuration config;
	private final ObservationResultDao dao;
	private final R2CloudClient client;
	private final SpectogramService spectogramService;

	public R2CloudService(Configuration config, ObservationResultDao dao, R2CloudClient client, SpectogramService spectogramService) {
		this.config = config;
		this.dao = dao;
		this.client = client;
		this.spectogramService = spectogramService;
	}

	public void uploadObservation(String satelliteId, String observationId) {
		String apiKey = config.getProperty("r2cloud.apiKey");
		if (apiKey == null) {
			return;
		}
		LOG.info("uploading observation: " + observationId);
		ObservationResult observation = dao.find(satelliteId, observationId);
		if (observation == null) {
			LOG.info("observation not found");
			return;
		}
		Long id = client.saveMeta(observation);
		if (id == null) {
			return;
		}
		if (observation.getDataPath() != null) {
			client.saveData(id, observation.getDataPath());
		} else if (observation.getaPath() != null) {
			client.saveData(id, observation.getaPath());
		}
		if (config.getBoolean("r2cloud.syncSpectogram")) {
			if (observation.getSpectogramPath() == null) {
				File spectogram = spectogramService.create(observation.getWavPath());
				if (spectogram != null) {
					client.saveSpectogram(id, spectogram);
					if (!dao.saveSpectogram(satelliteId, observationId, spectogram)) {
						LOG.info("unable to save spectogram");
					}
				}
			} else {
				client.saveSpectogram(id, observation.getSpectogramPath());
			}
{'fraction_non_alphanumeric': 0.11003070624360287, 'fraction_numerical': 0.007164790174002047, 'mean_word_length': 4.860569715142429, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6981163', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1203, 'n_words': 260}