Import Action (Command)

Get Started. It's Free
or sign up with your email address
Rocket clouds
Import Action (Command) by Mind Map: Import Action (Command)

1. (1) Import Main Vendors

1.1. (1) Import Vendors Vanlines

1.1.1. Description: Import main vendor and vendor contact with type "Van Lines" to table "vendors__vendors" and "vendors__contacts"

1.1.1.1. File Data Import: /public/vendorvanlines.xlsx

1.1.1.2. File Process Logic: /app/Console /Commands/VendorVanlines.php

1.1.1.3. Command excute: php artisan import-vendor:vanlines

1.2. (2) Import Vendors Broker

1.2.1. Description: Import main vendor and vendor contact with type "Realtor - Broker" and "Realtor - Agent" to table "vendors__vendors" and "vendors__contacts" and create view: activities__activities__view documents__documents__view vendors__vendors__view.

1.2.1.1. File Data Import: /public/vendorbroker.xlsx

1.2.1.2. File Process Logic: /app/Console /Commands/VendorBroker.php

1.2.1.3. Command excute: php artisan import-vendor:broker

1.3. (3) Import Main Vendors

1.3.1. Description: Import main vendor and vendor contact with all type to table "vendors__vendors" and "vendors__contacts"

1.3.1.1. File Data Import: /public/vendorvanlines.xlsx

1.3.1.2. File Process Logic: /app/Console /Commands/ImportVendorAndContactFromExcel.php config/import.php

1.3.1.3. Command excute: php artisan import:vendor_contact and php artisan import:vendor_contact 0

2. (4) Script Support Trigger Database (DevActionTriggerScript.php)

2.1. Necessary script to import data

2.1.1. Update Attachment info

2.1.1.1. Description: Have a folder have real file Attachment get from Orion and move to Source Code and process get file info and update data to media_file filter by attachment real_filename because real_filename in database is unique another file uploaded was changed name Command: php artisan import-attachment-update-filesize-filetype Note: Open file source and open param signature

2.1.2. Update Document info

2.1.2.1. Description: Have theree file attachment import and used it filter document record relation with transferee and update data uploaded_on and description Command: php artisan import-attachment-other-info Note: Open file source and open param signature

2.2. Helper Script

2.2.1. remove-transferee-data-import

2.2.1.1. Description: remove all transferee imported, this script so dangerous, only run in test env, but don't worry because i have run backup DB before. Command: php artisan remove-transferee-data-import

2.2.2. Change all passwords main user.

2.2.2.1. Description: In develop time since Phase 1. Nam Pham request change all password of main user to password with Nam like. This Script so dangerous too. Please not run it when Phase 1 closed (this scrip have not backup DB) Command: php artisan dev-action-trigger:change-all-passwords-user

2.2.3. Schedule Migration Process

2.2.3.1. Description: Run migrate command with step by step by Process of Symfony but this scrip meaningless because Trinh Le integrate it in arc:install Process. Command: php artisan schedule-migrate-transferee

2.2.4. Make fake attachment to

2.2.4.1. Description: On develop time I make 40k fake file from import file to test Import Attachment. Can you make it and push it to S3 Storage Amazon to test. (Unnecessary Script) Command: php artisan dev-action-trigger:make-attachment-file-test

2.2.5. Backup or Restore DB

2.2.5.1. Description: This script execute backup or restore DB on necessary case (but require postgres_client or pg_dump) and emit file to sourcode (/storage/file.tar) Command: php artisan arc-db:backup / php artisan arc-db:restore

3. (*) Database relative

3.1. ARC Originnal Table

3.1.1. Schema Attachment

3.1.1.1. media__files

3.1.1.2. documents__documents

3.1.2. Schema Transferee

3.1.2.1. client__clients

3.1.2.2. email__emails

3.1.2.3. address__addresses

3.1.2.4. phone__phones

3.1.2.5. transferee__transferees

3.1.2.6. transferee_other_info

3.1.3. Schema Transferee Services

3.1.3.1. home_purchase_service

3.1.3.2. home_sale_service

3.1.3.3. household_goods_service

3.1.3.4. mortgage_service

3.1.3.5. temporary_quarters_service

3.1.4. Schema Vendor

3.1.4.1. vendors_in_services

3.1.4.2. vendors__contacts

3.1.4.3. vendors__vendors

3.2. Import Mapping Table

3.2.1. transferee_attachment_temp

3.2.1.1. Have data transferee attachment formatted and error log with transferee attachment insert fail

3.2.2. migration__mapping

3.2.2.1. sync key column in excel file with key in source code

3.2.3. migration__vendor_config

3.2.3.1. Because data in file import inserted by hand and has invalid data, table have key words filter with find exact data main vendor contact. data have defined in: MigrationRFConfig::MIGRATION_TEMPORARY_QUARTER_SERVICE_VENDOR_DEFAULT MigrationRFConfig::MIGRATION_MORGAGE_SERVICE_VENDOR_DEFAULT MigrationRFConfig::MIGRATION_HHG_VENDOR_MAPPING_FILTER

3.2.4. migration__user_config

3.2.4.1. Because data in file import inserted by hand and has invalid data, table have key words filter with find exact data Main User. data have defined in: MigrationRFConfig::MIGRATION_MAPPING_USER

3.2.5. trans_data_import

3.2.5.1. Have data formatted and error log with transferee insert fail, is defined from MigrationRFConfig::MIGRATION_MAPPING_DATA

4. (3) Import Attachment Transferee

4.1. (1)Format Data Before Import

4.1.1. Description: Merge file excel import (attachment_transferee.csv, attachmentnote.csv, attachmentactivity.csv to once file and read file to insert to database relation transferee

4.1.2. Step process logic

4.1.2.1. Create table temp

4.1.2.2. Read File

4.1.2.3. Find transferee record and get transferee_id, transfeee created_date

4.1.2.4. set path file to insert with prefix "/assets/media/documents/" + $filename

4.1.2.5. insert to table temp

4.1.3. Command execute: php artisan import-transferee-attachment:excute

4.1.4. File Process Logic: app/Console/Commands/TransfereeImportAttachment.php, attachment_transferee.csv, attachmentnote.csv, attachmentactivity.csv

4.2. (2)Format Data Before Import

4.2.1. Description: get data from table temp and insert to table document

4.2.2. Step process logic

4.2.2.1. Insert data file to media_file with custom path and set storage = "s3" and another such as:extension, mimetype, filesize will be updated later.

4.2.2.2. insert to table document__documents with transferee, media_id and created_at, document_name with displayname

4.2.2.3. an then will be run trigger in another command to update file size, file type,...

4.2.3. Command execute: php artisan excute-transferee-attachment:run

4.2.4. File Process Logic: app/Console/Commands/TransfereeImportAttachment.php, attachment_transferee.csv, attachmentnote.csv, attachmentactivity.csv

5. (2) Import Transferee Data

5.1. (1)Format Data Before Import

5.1.1. Description: Import Data and format Data necessary to table temp and another table: vendors__vendors, vendors__contacts, client__clients, phone__phones, email__emails, address__address, ...

5.1.2. Step Process

5.1.2.1. Set up data mapping: MigrationRFConfig::MIGRATION_MAPPING_DATA MigrationRFConfig::MIGRATION_TEMPORARY_QUARTER_SERVICE_VENDOR_DEFAULT MigrationRFConfig::MIGRATION_MORGAGE_SERVICE_VENDOR_DEFAULT MigrationRFConfig::MIGRATION_MAPPING_USER to table: migration__mapping migration__vendor_config migration__user_config

5.1.2.2. Insert Vendor Contact Default and get form Config table migration__vendor_config to table vendors__vendors, vendors__contacts (requirement from BA Nam Pham)

5.1.2.3. Validate Data in table reference__reference to ensure data id reference exist in process import

5.1.2.4. Create table temp with config column in MigrationRFConfig::MIGRATION_TABLE_TEMP_COLUMN_CONFIG

5.1.2.5. Read file data, process logic, format data and insert data to table trans_data_import and another table

5.1.2.5.1. Format column name from table migration__mapping (Description: Map column key from excel file to config key in source code)

5.1.2.5.2. Format transferee common data

5.1.2.5.3. Format Data type Boolean and if data invalid with type then add this data to Transferee Additional Note or Service Additional Note

5.1.2.5.4. Format data Phone and if data invalid then add this data to Transferee Additional Note or Service Additional Note

5.1.2.5.5. Format data Emails and if data invalid then add this data to Transferee Additional Note or Service Additional Note

5.1.2.5.6. Format data with type is date and currency and percent and if data invalid then add this data to Transferee Additional Note or Service Additional Note

5.1.2.5.7. Format data Household Goods Service

5.1.2.5.8. Format data Home Sale Service

5.1.2.5.9. Format data Home Purchase Service

5.1.2.5.10. Format data Mortgage Service

5.1.2.5.11. Format data Temporary Quarters Service

5.1.2.5.12. Unset unnecessary data

5.1.2.6. Remove table data mapping

5.1.3. Data Import: /public/transferee-import.csv

5.1.4. File Process: /app/Console /Commands/ImportTransferees.php, Module/Reference/MigrationRFConfig.php

5.1.5. Command excute: php artisan import-trans:run

5.2. (2)Import Data to Database

5.2.1. Description: After step 2.1 was did and then get data formatted insert to table in database.

5.2.1.1. Insert Household Goods service data and Vendors in service to table: household_goods_service, vendors_in_services

5.2.2. Step process logic (so easy)

5.2.2.1. Insert transferee info to table: transferee__transferees, transferee_other_info, address__address, email__email, phone__phones,

5.2.2.2. Insert Home Purchase service data and Vendors in service to table: home_purchase_service, vendors_in_services

5.2.2.3. Insert Home Sale service data and Vendors in service to table: home_sale_service, vendors_in_services

5.2.2.4. Insert Mortgage service data and Vendors in service to table: mortgage_service, vendors_in_services

5.2.2.5. Insert Temporary Quarters service data and Vendors in service to table: temporary_quarters_service, vendors_in_services

5.2.3. Command execute: php artisan arc-migration:run

5.2.4. File Process Logic: app/Console/Commands/ExecuteTransferees.php, table trans_data_import with formatted data

6. Process Vendors In Service

6.1. Find Vendor in table vendors__vendors

6.2. Find Vendor Contact in table vendors__contacts with vendor found and update data contact info newest with current records

6.3. If not Found

6.3.1. Create vendors

6.3.2. Create vendors contact with vendor created and data: emails, phone, contact name...

7. Process Vendors In Service

7.1. switch case with condition if true then get main vendor contacts (added in step 1.3)

7.2. With vendor ignore in condition then find it in Vendor Default Contact (added in step 2.3

7.3. If not Found

7.3.1. Add data to Service Additional Note