@@ -0,0 +1,1627 @@
+from django.core.exceptions import ObjectDoesNotExist%0Afrom django.db import IntegrityError%0A%0Afrom source_data.models import *%0Afrom datapoints.models import Office%0A%0Adef pivot_and_insert_src_datapoints(df,document_id,column_mappings):%0A%0A    header = %5Bcol for col in df%5D%0A    source_datapoints = %5B%5D%0A%0A    source_id = Source.objects.get(source_name='data entry').id%0A%0A    for row_number,(row) in enumerate(df.values):%0A%0A        batch = %5B%5D%0A%0A        region_code = row%5Bheader.index(column_mappings%5B'region_code_col'%5D)%5D%0A        campaign_string = row%5Bheader.index(column_mappings%5B'campaign_col'%5D)%5D%0A        to_process_status = ProcessStatus.objects.get(status_text='TO_PROCESS').id%0A%0A        for cell_no,(column_header) in enumerate(header):%0A%0A            indicator_string = header%5Bcell_no%5D%0A%0A            row_guid =  'doc_id: ' + str(document_id) + ' row_no: ' + %5C%0A                str(row_number) + ' cell_no: ' + str(cell_no)%0A%0A            sdp_dict = %7B%0A                'source_guid':row_guid,%0A                'guid':row_guid,%0A                'indicator_string': indicator_string,%0A                'region_code':region_code,%0A                'campaign_string':campaign_string,%0A                'cell_value':row%5Bcell_no%5D,%0A                'row_number':row_number,%0A                'source_id':source_id,%0A                'document_id':document_id,%0A                'status_id':to_process_status%0A            %7D%0A%0A            sdp = SourceDataPoint(**sdp_dict)%0A%0A            batch.append(sdp)%0A%0A        SourceDataPoint.objects.bulk_create(batch)%0A%0A%0A    sdps = SourceDataPoint.objects.filter(document_id=document_id)%0A    return sdps%0A    # return source_datapoints%0A

add back shared_utils.py in order to fix import error on document_index