def setUp(self): # initialize subnational/Country ci = CountryImport() ci.update_polygon() ci.update_alt_name() # creating dummy objects for testing self.dummy_file_source = factory.FileSourceFactory( name='dummy_file_source') self.dummy_geolocation = factory.GeolocationFactory(tag='Albania', iso2='al', iso3='alb', object_id=4, content_type_id=15, type='country') self.dummy_file = factory.FileFactory( title="Region", description="test", contains_subnational_data=True, organisation="test", maintainer="test", date_of_dataset="2009-01-01", methodology="test", define_methodology="test", update_frequency="test", comments="test", accessibility="p", data_quality="test", number_of_rows=1, file_types="csv", location=self.dummy_geolocation, source=self.dummy_file_source, file=os.path.abspath("samples/multiple_ind_cat.csv"))
def setUp(self): ci = CountryImport() ci.update_polygon() ci.update_alt_name() self.dummy_file_source = factory.FileSourceFactory(name='hello') self.dummy_geolocation = factory.GeolocationFactory(tag='Austrlia', iso2='au', iso3='aus', object_id=4, content_type_id=15, type='country') self.dummy_file = factory.FileFactory( title="test", description="test", contains_subnational_data=True, organisation="test", maintainer="test", date_of_dataset="2009-01-01", methodology="test", define_methodology="test", update_frequency="test", comments="test", accessibility="p", data_quality="test", number_of_rows=1, file_types="csv", location=self.dummy_geolocation, source=self.dummy_file_source, file=os.path.abspath('samples/two_mesure_values_num_date.csv'))
def setUp(self): self.dummy_file_source = factory.FileSourceFactory( name='dummy_file_source') alb = factory.CountryFactory(name='Albania', iso2='al', iso3='alb') self.dummy_geolocation = factory.GeolocationFactory(tag='Albania', iso2='al', iso3='alb', object_id=alb.id, content_type_id=15, type='country') self.dummy_file = factory.FileFactory( title="test", description="test", contains_subnational_data=True, organisation="test", maintainer="test", date_of_dataset="2009-01-01", methodology="test", define_methodology="test", update_frequency="test", comments="test", accessibility="p", data_quality="test", number_of_rows=1, file_types="csv", location=self.dummy_geolocation, source=self.dummy_file_source, file=os.path.abspath("samples/point_based.csv"))
def setUp(self): # initialize Region ri = RegionImport() ri.update_region_center() # creating dummy objects for testing self.dummy_file_source = factory.FileSourceFactory( name='dummy_file_source') region = factory.RegionFactory(name='central asia') self.dummy_geolocation = factory.GeolocationFactory( tag='central asia', object_id=region.id, content_type_id=19, type='region') self.dummy_file = factory.FileFactory( title="Region", description="test", contains_subnational_data=True, organisation="test", maintainer="test", date_of_dataset="2009-01-01", methodology="test", define_methodology="test", update_frequency="test", comments="test", accessibility="p", data_quality="test", number_of_rows=1, file_types="csv", location=self.dummy_geolocation, source=self.dummy_file_source, file=os.path.abspath("samples/region.csv"))
def setUp(self): # Dummy objects self.dummy_file_source = factory.FileSourceFactory( name='dummy_file_source') self.dummy_geolocation = factory.GeolocationFactory(tag='Albania', iso2='al', iso3='alb', object_id=4, content_type_id=15, type='country')
def setUp(self): self.dummy_file_source = factory.FileSourceFactory( name='dummy_file_source' ) self.dummy_geolocation = factory.GeolocationFactory( tag='Albania', iso2='al', iso3='alb', object_id=4, content_type_id=15, type='country' ) self.dummy_file = factory.FileFactory( title="test", description="test", contains_subnational_data=True, organisation="test", maintainer="test", date_of_dataset="2009-01-01", methodology="test", define_methodology="test", update_frequency="test", comments="test", accessibility="p", data_quality="test", number_of_rows=1, file_types="csv", location=self.dummy_geolocation, source=self.dummy_file_source, file=os.path.abspath("samples/point_based.csv") ) file_id = self.dummy_file.id EXTRA_INFORMATION = { 'empty_entries': { 'empty_indicator': 'Test pointbased', 'empty_geolocation': { 'value': '', 'type': ''}, 'empty_filter': 'Default', 'empty_value_format': { 'value format': 'Numeric'}, 'empty_date': '2016'}, 'multi_mapped': { 'column_heading': {}, 'column_values': {}, }, 'point_based_info': { 'coord': { 'lat': 'Lat location 1', 'lon': 'Long location 1'}, 'subnational': '', 'country': '', 'type': '', }} input_json = { 'metadata_id': file_id, 'mapping_dict': { 'indicator': [], 'filters': [], 'geolocation': ["Lat location 1", "Long location 1"], 'date': [], 'value_format': [], 'value': ["new infections"], 'comment': [], }, "filter_headings": {"filters": "filters"}, 'extra_information': EXTRA_INFORMATION } input_json_str = json.dumps(input_json) query_input = {"input": {"data": input_json_str}} query = """ mutation mapping($input: MappingMutationInput!) { mapping(input: $input) { id data } }""" schema.execute(query, variable_values=query_input)
def setUp(self): ci = CountryImport() ci.update_polygon() ci.update_alt_name() self.dummy_file_source = factory.FileSourceFactory( name='dummy_file_source' ) self.dummy_geolocation = factory.GeolocationFactory( tag='Albania', iso2='al', iso3='alb', object_id=4, content_type_id=15, type='country' ) self.dummy_file = factory.FileFactory( title="test", description="test", contains_subnational_data=True, organisation="test", maintainer="test", date_of_dataset="2009-01-01", methodology="test", define_methodology="test", update_frequency="test", comments="test", accessibility="p", data_quality="test", number_of_rows=1, file_types="csv", location=self.dummy_geolocation, source=self.dummy_file_source, file=os.path.abspath("samples/AIDSinfotest.csv") ) file_id = self.dummy_file.id input_json = { 'metadata_id': file_id, 'mapping_dict': { "indicator": ["Indicator"], "value_format": ["Unit"], "geolocation": ["Area"], "value": ["Data Value"], "date": ["Time Period"], "comment": ["Source"], "filters": ["Subgroup"] }, 'filter_headings': {"Subgroup": "Subgroup"}, } input_json_str = json.dumps(input_json) query_input = {"input": {"data": input_json_str}} query = """ mutation mapping($input: MappingMutationInput!) { mapping(input: $input) { id data } }""" schema.execute(query, variable_values=query_input)
def setUp(self): ci = CountryImport() ci.update_polygon() ci.update_alt_name() self.dummy_file_source = factory.FileSourceFactory( name='dummy_file_source') self.dummy_geolocation = factory.GeolocationFactory(tag='Albania', iso2='al', iso3='alb', object_id=4, content_type_id=15, type='country') self.dummy_file = factory.FileFactory( title="test", description="test", contains_subnational_data=True, organisation="test", maintainer="test", date_of_dataset="2009-01-01", methodology="test", define_methodology="test", update_frequency="test", comments="test", accessibility="p", data_quality="test", number_of_rows=1, file_types="csv", location=self.dummy_geolocation, source=self.dummy_file_source, file=os.path.abspath("samples/AIDSinfotest.csv")) file_id = self.dummy_file.id input_json = { 'metadata_id': file_id, 'filter_headings': { "Subgroup": "Subgroup" }, "extra_information": { "empty_entries": { "empty_indicator": '', "empty_geolocation": { "value": '', "type": '' }, "empty_filter": '', "empty_value_format": {}, "empty_date": '' }, "multi_mapped": { "column_heading": {}, "column_values": {} }, "point_based_info": { "coord": { "lat": '', "lon": '' }, "subnational": '', "country": '', "type": '' } }, 'mapping_dict': { "indicator": ["Indicator"], "value_format": ["Unit"], "geolocation": ["Area"], "value": ["Data Value"], "date": ["Time Period"], "comment": ["Source"], "filters": ["Subgroup"] } } begin_mapping(input_json)