Example #1
0
def _save_raw_green_button_data(file_pk, *args, **kwargs):
    """
    Pulls identifying information out of the xml data, find_or_creates
    a building_snapshot for the data, parses and stores the timeseries
    meter data and associates it with the building snapshot.
    """

    import_file = ImportFile.objects.get(pk=file_pk)

    import_file.raw_save_done = True
    import_file.save()

    res = xml_importer.import_xml(import_file)

    prog_key = get_prog_key('save_raw_data', file_pk)
    cache.set(prog_key, 100)

    if res:
        return {'status': 'success'}

    return {'status': 'error', 'message': 'data failed to import'}
Example #2
0
def _save_raw_green_button_data(file_pk, *args, **kwargs):
    """
    Pulls identifying information out of the xml data, find_or_creates
    a building_snapshot for the data, parses and stores the timeseries
    meter data and associates it with the building snapshot.
    """

    import_file = ImportFile.objects.get(pk=file_pk)

    import_file.raw_save_done = True
    import_file.save()

    res = xml_importer.import_xml(import_file)

    prog_key = get_prog_key('save_raw_data', file_pk)
    set_cache(prog_key, 'success', 100)

    if res:
        return {'status': 'success', 'progress': 100}

    return {
        'status': 'error',
        'message': 'data failed to import'
    }
Example #3
0
 def test_import_xml(self):
     """
     Test of xml_importer.import_xml.
     """
     xml_importer.import_xml(self.import_file)
     self.assert_models_created()
Example #4
0
 def test_import_xml(self):
     """
     Test of xml_importer.import_xml.
     """
     xml_importer.import_xml(self.import_file)
     self.assert_models_created()