# This package is used to add data to cosmos db, which is required during onboarding of a client or adding a new vendor to the 8am system.



VendBuilder:

This class is used to build items during onboarding which are required for a vendor in the 8am Web App system. The items provide a starting data framework from which a vendor can begin to use the 8am Web Application. There items that are required for a vendor during onbarding are as follows: 

[company, vendorList, vendorProfileState, vendorPaymentState, vendorDocumentsState, vendorRequirementsState, vendorStepperState, vendorAdditionalRequirement, vendorSafetyStats]. The items are built using templates from the database. The templates are used to build the items in a consistent manner. The items are built using the following functions:

The items are built using templates from the database. The templates are used to build the items in a consistent manner. The items are built using the following functions:


VendBuilder.format():

This function is used to add the "type" value to a cosmos db item from an item of type "template" from the database. You can inspect the templates using query "SELECT * FROM c WHERE c.type = 'template'". The function will add the "type" value to the item and return it. In addition this function will remove the "itemType" value from the item.

If the item passed as an argument to this function is not of type "company", "vendorId" and "vendorName" values will be added to the item. These values are used to identify the vendor company that the item belongs to.



VendBuilder.generate_sign_up_code():

This function is used to generate a sign up code for a company. The sign up code is the combination of a random US county with a 4 digit integer, this function will return the sign up code as a sstring. This sign up code can be distributed from a company that exists in our system to a user that wants to sign up to the company. The user will use the sign up code to sign up to the company.



VendBuilder.build_company():

This function is used to build a company item for the database. This function will retrieve the company template from the database and use it to build the company item. The company item will be returned as a dictionary. The company item will have the "type" value set to "company" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName. The company item will also have the "signUpCode" value set to the sign up code generated by the function "VendBuilder.generate_sign_up_code()". The company item will also have the "companyName" value set to the company's name.



VendBuilder.build_profile_state():

This function is used to build a profile state item for the database. This function will retrieve the profile state template from the database and use it to build the profile state item. The profile state item will be returned as a dictionary. The profile state item will have the "type" value set to "vendorProfileState" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName. This item is used to manage the state of the profile step (step 1) within the qualifications process of the 8am Web App.



VendBuilder.build_payment_state():

This function is used to build a payment state item for the database. This function will retrieve the payment state template from the database and use it to build the payment state item. The payment state item will be returned as a dictionary. The payment state item will have the "type" value set to "vendorPaymentState" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName. This item is used to manage the state of the payment step (step 2) within the qualifications process of the 8am Web App.



VendBuilder.build_documents_state():

This function is used to build a documents state item for the database. This function will retrieve the documents state template from the database and use it to build the documents state item. The documents state item will be returned as a dictionary. The documents state item will have the "type" value set to "vendorDocumentsState" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName. This item is used to manage the state of the documents step (step 3) within the qualifications process of the 8am Web App.



VendBuilder.build_requirements_state():

This function is used to build a requirements state item for the database. This function will retrieve the requirements state template from the database and use it to build the requirements state item. The requirements state item will be returned as a dictionary. The requirements state item will have the "type" value set to "vendorRequirementsState" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName. This item is used to manage the state of the requirements step (step 4) within the qualifications process of the 8am Web App.



VendBuilder.build_stepper_state():

This function is used to build a stepper state item for the database. This function will retrieve the stepper state template from the database and use it to build the stepper state item. The stepper state item will be returned as a dictionary. The stepper state item will have the "type" value set to "vendorStepperState" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName. This item is used to manage the state of the stepper within the qualifications process of the 8am Web App. By stepper we mean the state of the steps within the qualifications process (along the top of the design) that govern which steps can be navigated to, which steps are completed, etc.



VenddBuilder.build_additional_requirements():

This function is used to build an additional requirements item for the database. This function will retrieve the additionalRequirement items from the data base and use it to build the vendorAdditionalRequirement items for a given vendor. The defaultDocumentIdList item is set manually to a list containing the document id of the "ABSA Certificate" document. As of this time of writing this document, the ABSA Certificate is the only additional requirement that is required for all vendors during onboarding. The vendorAdditionalRequirement item will be returned as a dictionary. The vendorAdditionalRequirement item will have the "type" value set to "vendorAdditionalRequirement" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName.



VendBuilder.build_safety_stats():

This function is used to build a safety stats item for the database. This function will retrieve the safety stats template from the database and use it to build the safety stats item. The safety stats item will be returned as a dictionary. The safety stats item will have the "type" value set to "vendorSafetyStats" and the "vendorId" and "vendorName" values set to the company's vendorId and vendorName. This item is used to manage the safety statistics of the vendor company.






EmpBuilder:

This class is used to build items during onboarding which are required for an employer in the 8am Web App system. The items provide a starting data framework from which an employer can begin to use the 8am Web Application. There items that are required for an employee during onbarding are as follows: 

[company, tags, employerDocConfig]. The items are built using templates from the database. The templates are used to build the items in a consistent manner. The items are built using the following functions:



EmpBuilder.format():

This function is used to add the "type" value to a cosmos db item from an item of type "template" from the database. You can inspect the templates using query "SELECT * FROM c WHERE c.type = 'template'". The function will add the "type" value to the item and return it. In addition this function will remove the "itemType" value from the item.



EmpBuilder.generate_sign_up_code():

This function is used to generate a sign up code for a company. The sign up code is the combination of a random US county with a 4 digit integer, this function will return the sign up code as a sstring. This sign up code can be distributed from a company that exists in our system to a user that wants to sign up to the company. The user will use the sign up code to sign up to the company.



EmpBuilder.build_company():

This function is used to build a company item for the database. This function will retrieve the company template from the database and use it to build the company item. The company item will be returned as a dictionary. The company item will have the "type" value set to "company". The company item will also have the "signUpCode" value set to the sign up code generated by the function "EmpBuilder.generate_sign_up_code()". The company item will also have the "companyName" value set to the company's name.



EmpBuilder.build_tags():

This function is used to build a tags item for the database. This function will retrieve the tags template from the database and use it to build the tags item. The tags item will be returned as a dictionary. The tags item will have the "type" value set to "tags". This item is used to manage the tags of the company. The tags are used to categorize the company in the 8am Web App system.



EmpBuilder.build_employer_doc_config():

This function is used to build an employer document configuration item for the database. This function will retrieve the employer document configuration template from the database and use it to build the employer document configuration item. The employer document configuration item will be returned as a dictionary. The employer document configuration item will have the "type" value set to "employerDocConfig". This item is used to manage the document configuration of the employer in the 8am Web App system. More specifically, this item is used to manage the documents that are required for the employer during onboarding, which are set from the profile step of qualifications.






CommonBuilder:

This class is used to build items during onboarding which are required for both vendors and employers in the 8am Web App system. The items provide a starting data framework from which a vendor or employer can begin to use the 8am Web Application. The items that are required for both vendors and employers during onbarding are as follows:

[vendorList]. The items are built using templates from the database. The templates are used to build the items in a consistent manner. The items are built using the following functions:



CommonBuilder.build_vendor_list():

This function is used to build a vendorList item for the database. This function will retrieve the vendor list template from the database and use it to build the vendor list item. The vendor list item will be returned as a dictionary. The vendor list item will have the "type" value set to "vendorList". This item is used to manage the list of vendors in the 8am Web App system. This list will be used to store the vendor ids of the vendors in the 8am Web App system, as well as the employer ids and employer names for which a vendor works for. The vendorList items exists as a connection between company items, specifically accountType employer -> accountType vendor.