python_code/data_scraping.py
def download_case(cluster_dict, file_number, parent_directory):
    # TODO
    """
    Download opinion and cluster files if they are missing.
    """
    with open(data_dir + r'/clusters/%s/%s.json' % (parent_directory, file_number), 'w') as fp:
        json.dump(cluster_dict, fp)

    opinion_url = cluster_dict['resource_uri'].replace('clusters', 'opinions')
    opinion_dict = helper_functions.url_to_dict(opinion_url)
    with open(data_dir + r'/opinions/%s/%s.json' % (parent_directory, file_number), 'w') as fp:
        json.dump(opinion_dict, fp)

    Download opinion and cluster files if they are missing.
    
Download opinion and cluster files if they are missing.
Download opinion and cluster files if they are missing .
def download_case(cluster_dict, file_number, parent_directory):
    with open(data_dir + r'/clusters/%s/%s.json' % (parent_directory, file_number), 'w') as fp:
        json.dump(cluster_dict, fp)
    opinion_url = cluster_dict['resource_uri'].replace('clusters', 'opinions')
    opinion_dict = helper_functions.url_to_dict(opinion_url)
    with open(data_dir + r'/opinions/%s/%s.json' % (parent_directory, file_number), 'w') as fp:
        json.dump(opinion_dict, fp)
def download_case ( cluster_dict , file_number , parent_directory ) : with open ( data_dir + r'/clusters/%s/%s.json' % ( parent_directory , file_number ) , 'w' ) as fp : json . dump ( cluster_dict , fp ) opinion_url = cluster_dict [ 'resource_uri' ] . replace ( 'clusters' , 'opinions' ) opinion_dict = helper_functions . url_to_dict ( opinion_url ) with open ( data_dir + r'/opinions/%s/%s.json' % ( parent_directory , file_number ) , 'w' ) as fp : json . dump ( opinion_dict , fp )
Download opinion and cluster files if they are missing.
Download opinion and cluster files if they are missing .
# TODO """
    Download opinion and cluster files if they are missing.
    """
cluster_dict
file_number
parent_directory