Glider
Loading...
Searching...
No Matches
src.importer.UploadSales Namespace Reference

Functions

 upload_data_mongo (df)
 
 find_upc (upcs, df)
 
 find_irsc (isrc, df)
 
 delete_files_mongoDB (files)
 
 delete_duplicates ()
 
 upload_main (event, s3_session)
 

Constants

 collection_name = os.environ.get("COLLECTION")
 It's the mongo's collection name where sales reports will be storaged.
 
 mongo_conn = mongo_connection()
 
 collection = mongo_conn.mongo_conn_sales()
 It's the mongo's collection for sales storage.
 
 catalogue_collection = mongo_conn.mongo_conn_catalogue()
 It's the mongo's collection for catalogue storage.
 

Function Documentation

◆ delete_duplicates()

src.importer.UploadSales.delete_duplicates ( )
 Deletes all duplicated sales lines from database (in case of they exist) caused by parallel processing

Args:
    Nothing
Returns: 
    Nothing

Definition at line 102 of file UploadSales.py.

◆ delete_files_mongoDB()

src.importer.UploadSales.delete_files_mongoDB ( files)
 Deletes all files in the current batch from database (in case of they exist) to avoid overwriting

Args:
    files (list): A list which contains all filenames in the current batch splitted by formats
Returns: 
    files_delete (list): A list with filenames in the current batch

Definition at line 85 of file UploadSales.py.

Here is the caller graph for this function:

◆ find_irsc()

src.importer.UploadSales.find_irsc ( isrc,
df )
 Makes catalogue matching using isrc as key

Args:
    isrc (list): A list which contains all unique ISRCs in the current batch
    df (dataframe): Dataframe with sales matched by catalogue
Returns: Nothing

Definition at line 59 of file UploadSales.py.

Here is the call graph for this function:

◆ find_upc()

src.importer.UploadSales.find_upc ( upcs,
df )
 Makes catalogue matching using upc as key

Args:
    upcs (list): A list which contains all unique UPCs in the current batch
    df (dataframe): Dataframe with sales matched by catalogue
Returns: Nothing

Definition at line 35 of file UploadSales.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upload_data_mongo()

src.importer.UploadSales.upload_data_mongo ( df)
 Uploads batch lines to mongodb

Args:
    df (dataframe): Dataframe with sales matched by catalogue
Returns: Nothing

Definition at line 24 of file UploadSales.py.

Here is the caller graph for this function:

◆ upload_main()

src.importer.UploadSales.upload_main ( event,
s3_session )
 Orchestra every function and executes find_irsc function using multiprocessing 

Args:
    event (dict): Dictionary result of ProcessFiles.py
    s3_session: (boto3.session object): S3 session to connect to AWS bucket
Returns: Nothing

Definition at line 124 of file UploadSales.py.

Here is the call graph for this function:

Constant Documentation

◆ catalogue_collection

src.importer.UploadSales.catalogue_collection = mongo_conn.mongo_conn_catalogue()

It's the mongo's collection for catalogue storage.

Definition at line 21 of file UploadSales.py.

◆ collection

src.importer.UploadSales.collection = mongo_conn.mongo_conn_sales()

It's the mongo's collection for sales storage.

Definition at line 19 of file UploadSales.py.

◆ collection_name

src.importer.UploadSales.collection_name = os.environ.get("COLLECTION")

It's the mongo's collection name where sales reports will be storaged.

Definition at line 15 of file UploadSales.py.

◆ mongo_conn

src.importer.UploadSales.mongo_conn = mongo_connection()

Definition at line 16 of file UploadSales.py.