Skip to content

Commit

Permalink
Merge pull request #45 from umeditor/update-eda-examples
Browse files Browse the repository at this point in the history
Update EDA examples csv data when creating records
  • Loading branch information
Aaron Crosman authored Apr 10, 2022
2 parents a1bec82 + 5d08d74 commit 24240c4
Show file tree
Hide file tree
Showing 9 changed files with 912 additions and 0 deletions.
74 changes: 74 additions & 0 deletions snowfakery_samples/EDA/Account_EDA.macro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
## EDA Account Example

# Requirments
# Install cci: See https://cumulusci.readthedocs.io/en/latest/get_started.html
# Install the fake_edu Faker: See https://pypi.org/project/faker-edu/

# To run this code against a fresh scratch org called ("qa"):
#
# cci flow run eda:trial_org --org qa
# cci task run generate_and_load_from_yaml -o generator_yaml snowfakery_samples/EDA/Account_EDA.recipe.yml -o num_records 300 -o num_records_tablename Acount --org qa

# Look at snowfakery_samples/salesforce/Account.recipe.yml for more examples.
# - include_file: standard_EDA_objs_recipe.yml

- plugin: faker_edu.Provider

- macro: eda_account_base
fields:
RecordType:
random_choice:
- Academic_Program
- Business_Organization
- Educational_Institution
- HH_Account
- Sports_Organization
- University_Department
Name:
if:
- choice:
when: ${{RecordType=='HH_Account'}}
pick:
fake: last_name
- choice:
when: ${{RecordType=='Educational_Institution'}}
pick:
fake: institution_name
- choice:
when: ${{RecordType=='University_Department'}}
pick:
fake: department_name
- choice:
pick:
fake: company
Phone:
fake: phone_number
#Parent Account
Website:
if:
- choice:
when: ${{RecordType!='HH_Account'}}
pick:
fake: url
BillingStreet:
fake: streetaddress
BillingCity:
fake: city
BillingState:
fake: state
BillingPostalCode:
fake: postalcode
BillingCountry:
fake: country
ShippingStreet:
fake: streetaddress
ShippingCity:
fake: city
ShippingState:
fake: state
ShippingPostalCode:
fake: postalcode
ShippingCountry:
fake: country
Description:
${{fake.Paragraph(nb_sentences=5)}}
18 changes: 18 additions & 0 deletions snowfakery_samples/EDA/Account_EDA.recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## EDA Account Example

# Requirments
# Install cci: See https://cumulusci.readthedocs.io/en/latest/get_started.html
# Install the fake_edu Faker: See https://pypi.org/project/faker-edu/

# To run this code against a fresh scratch org called ("qa"):
#
# cci flow run eda:trial_org --org qa
# cci task run generate_and_load_from_yaml -o generator_yaml snowfakery_samples/EDA/Account_EDA.recipe.yml -o num_records 300 -o num_records_tablename Account --org qa

# Look at snowfakery_samples/salesforce/Account.recipe.yml for more examples.
# - include_file: standard_EDA_objs_recipe.yml

- include_file: Account_EDA.macro.yml

- object: Account
include: eda_account_base
49 changes: 49 additions & 0 deletions snowfakery_samples/EDA/Affiliation_EDA.macro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## EDA Account Example

# Requirments
# Install cci: See https://cumulusci.readthedocs.io/en/latest/get_started.html
# Install the fake_edu Faker: See https://pypi.org/project/faker-edu/

# To run this code against a fresh scratch org called ("qa"):
#
# cci flow run eda:trial_org --org qa
# cci task run generate_and_load_from_yaml -o generator_yaml snowfakery_samples/EDA/Affiliation_EDA.recipe.yml -o num_records 300 -o num_records_tablename hed__Affiliation__c --org qa

# Look at snowfakery_samples/salesforce/Account.recipe.yml for more examples.
# - include_file: standard_EDA_objs_recipe.yml

- plugin: snowfakery.standard_plugins.Salesforce.SalesforceQuery

- macro: eda_affiliation_base
fields:
hed__Account__c:
SalesforceQuery.random_record:
from: Account
# Limit to Accounts that have a default EDA mapping
# Exclude Accounts with a RecordType ('Sample Account for Entitlements')
where: RecordTypeId != null AND RecordType.Name!='Administrative'
hed__Contact__c:
SalesforceQuery.random_record:
from: Contact
hed__Role__c:
random_choice:
- Student
- Prospect
- Applicant
- Faculty
- Employee
hed__Status__c:
random_choice:
- Current
- Former
hed__StartDate__c:
date_between:
start_date: -5y
end_date: -1d
#hed__EndDate__c:
#hed__Primary__c:
# random_choice:
# - ${{'Off'}}
# - ${{'On'}}
hed__Description__c:
${{fake.Paragraph(nb_sentences=5)}}
18 changes: 18 additions & 0 deletions snowfakery_samples/EDA/Affiliation_EDA.recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## EDA Account Example

# Requirments
# Install cci: See https://cumulusci.readthedocs.io/en/latest/get_started.html
# Install the fake_edu Faker: See https://pypi.org/project/faker-edu/

# To run this code against a fresh scratch org called ("qa"):
#
# cci flow run eda:trial_org --org qa
# cci task run generate_and_load_from_yaml -o generator_yaml snowfakery_samples/EDA/Affiliation_EDA.recipe.yml -o num_records 300 -o num_records_tablename hed__Affiliation__c --org qa

# Look at snowfakery_samples/salesforce/Account.recipe.yml for more examples.
# - include_file: standard_EDA_objs_recipe.yml

- include_file: Affiliation_EDA.macro.yml

- object: hed__Affiliation__c
include: eda_affiliation_base
104 changes: 104 additions & 0 deletions snowfakery_samples/EDA/ContactAffiliation_EDA.recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
## EDA Contacts Example

# Requirments
# Install cci: See https://cumulusci.readthedocs.io/en/latest/get_started.html
# Install the fake_edu Faker: See https://pypi.org/project/faker-edu/

# To run this code against a fresh scratch org called ("qa"):
#
# cci flow run eda:trial_org --org qa
# cci task run generate_and_load_from_yaml -o generator_yaml snowfakery_samples/EDA/ContactAffiliation_EDA.recipe.yml -o num_records 300 -o num_records_tablename Contact --org qa

# Look at snowfakery_samples/salesforce/Contact.recipe.yml for more examples.
# - include_file: standard_EDA_objs_recipe.yml

- plugin: faker_edu.Provider

- include_file: Contact_EDA.macro.yml
- include_file: Account_EDA.macro.yml
- include_file: Affiliation_EDA.macro.yml

- object: Account
nickname: Educational_Institution
fields:
RecordType: Educational_Institution
Name: institution_name

- object: Account
nickname: University_Department
fields:
RecordType: University_Department
ParentId:
reference: Educational_Institution
Name: department_name
friends:
- object: Account
nickname: Academic_Program
fields:
RecordType: Academic_Program
Name: "Academic Program"
ParentId:
reference: University_Department

- object: Account
nickname: Business_Organization
fields:
RecordType: Business_Organization
Name:
fake: company

- object: Account
nickname: Sports_Organization
fields:
__sports_organizations_from_csv:
Dataset.shuffle:
dataset: data/sports-organizations.csv
RecordType: Sports_Organization
Name: ${{__sports_organizations_from_csv.name}}

- object: Contact
include: eda_contact_base
friends:
- object: hed__Affiliation__c
include: eda_affiliation_base
fields:
hed__Account__c:
reference: Academic_Program
hed__Contact__c:
reference: Contact
hed__Primary__c: True

- object: hed__Affiliation__c
include: eda_affiliation_base
fields:
hed__Account__c:
reference: Business_Organization
hed__Contact__c:
reference: Contact
hed__Primary__c: True

- object: hed__Affiliation__c
include: eda_affiliation_base
fields:
hed__Account__c:
reference: Educational_Institution
hed__Contact__c:
reference: Contact
hed__Primary__c: True

- object: hed__Affiliation__c
include: eda_affiliation_base
fields:
hed__Account__c:
reference: Sports_Organization
hed__Contact__c:
reference: Contact
hed__Primary__c: True
- object: hed__Affiliation__c
include: eda_affiliation_base
fields:
hed__Account__c:
reference: University_Department
hed__Contact__c:
reference: Contact
hed__Primary__c: True
Loading

0 comments on commit 24240c4

Please sign in to comment.