def test_invalid_jh_dataset(self):
        env_helper = EnvHelper()
        covid_19_data_accessor = Covid19DataAccessor(env_helper)

        mock_jh = df1 = pd.DataFrame({
            'Not_Recovered': [1, 2, 3, 4, 5],
            'Not_Date': [
                '2010-01-01', '2010-01-02', '2010-01-03', '2010-01-04',
                '2010-01-04'
            ]
        })

        response = covid_19_data_accessor.validate_jh(mock_jh)
        expected = False
        assert response == expected
    def test_invalid_nyt_dataset(self):
        env_helper = EnvHelper()
        covid_19_data_accessor = Covid19DataAccessor(env_helper)

        mock_nyt = df1 = pd.DataFrame({
            'not_deaths': [1, 2, 3, 4, 5],
            'not_cases': [1, 2, 3, 4, 5],
            'not_date': [
                '2010-01-01', '2010-01-02', '2010-01-03', '2010-01-04',
                '2010-01-04'
            ]
        })

        response = covid_19_data_accessor.validate_nyt(mock_nyt)
        expected = False
        assert response == expected
Ejemplo n.º 3
0
import sys

sys.path.append('spotify_ml')

from services.spotify_service import SpotifyService
from helpers.env_helper import EnvHelper
import boto3
import json
import pandas as pd
import io
import gzip

session = boto3.Session()
spotify_service = SpotifyService()
env_helper = EnvHelper()


def lambda_handler(event, context):

    print("Getting New Music Friday analysis from Spotify")
    new_tracks_analysis_and_features = spotify_service.get_new_tracks_analysis_and_features(
    )

    print("Transforming data")
    transformed_data = []

    # header row
    header_row = [
        'track_id', 'danceability', 'energy', 'key', 'loudness', 'mode',
        'speechiness', 'acousticness', 'instrumentalness', 'liveness',
        'valence', 'tempo', 'num_samples', 'duration', 'end_of_fade_in',