Ejemplo n.º 1
0
    def greenbutton_parsed_meters_confirmation(self, request):
        body = dict(request.data)
        file_id = body['file_id']
        org_id = body['organization_id']
        view_id = body['view_id']

        import_file = ImportFile.objects.get(pk=file_id)
        parser = reader.GreenButtonParser(import_file.local_file)
        raw_meter_data = list(parser.data)

        property_id = PropertyView.objects.get(pk=view_id).property_id
        meters_parser = MetersParser(org_id,
                                     raw_meter_data,
                                     source_type=Meter.GREENBUTTON,
                                     property_id=property_id)

        result = {}

        result["validated_type_units"] = meters_parser.validated_type_units()
        result["proposed_imports"] = meters_parser.proposed_imports()

        import_file.matching_results_data['property_id'] = property_id
        import_file.save()

        return result
Ejemplo n.º 2
0
    def parsed_meters_confirmation(self, request):
        body = dict(request.data)
        file_id = body['file_id']
        org_id = body['organization_id']

        import_file = ImportFile.objects.get(pk=file_id)
        parser = reader.MCMParser(import_file.local_file,
                                  sheet_name='Meter Entries')
        raw_meter_data = list(parser.data)

        meters_parser = MetersParser(org_id, raw_meter_data)

        result = {}

        result["validated_type_units"] = meters_parser.validated_type_units()
        result["proposed_imports"] = meters_parser.proposed_imports()
        result["unlinkable_pm_ids"] = meters_parser.unlinkable_pm_ids

        return result