예제 #1
0
    high_cardinality=True,
    important_field=True)

customer_entity.add_attribute(name='Email',
                              description='The email of the customer',
                              column_name='email',
                              personal_data=True,
                              high_cardinality=True,
                              accessible_via_entity_link=False)

customer_entity.add_attribute(
    name='Duration since first order',
    description='The number of days since the first order was placed',
    type=Type.DURATION,
    column_name='duration_since_first_order',
    accessible_via_entity_link=False)

from .order import order_entity
from .product_category import product_category_entity

customer_entity.link_entity(
    target_entity=product_category_entity,
    fk_column='favourite_product_category_fk',
    prefix='Favourite product category',
    description=
    'The category of the most purchased product (by revenue) of the customer')

customer_entity.link_entity(target_entity=order_entity,
                            fk_column='first_order_fk',
                            prefix='First order')
예제 #2
0
order_entity.add_attribute(
    name='Payment approval date',
    description='The date when the customer\'s payment was approved by the seller',
    column_name='payment_approval_date',
    type=Type.DATE)

order_entity.add_attribute(
    name='Delivery date',
    description='The date when the order was delivered to the customer',
    column_name='delivery_date',
    important_field=True,
    type=Type.DATE)

order_entity.add_attribute(
    name='Delivery time in days',
    description='The number of days from placing the order to delivery to the customer',
    column_name='delivery_time_in_days',
    type=Type.DURATION)

order_entity.add_attribute(
    name='Days since first order',
    description='The number of days from the first order of the customer to the placement of this order',
    column_name='days_since_first_order',
    type=Type.DURATION)

from .customer import customer_entity

order_entity.link_entity(target_entity=customer_entity,
                         description='The customer who placed the order')
예제 #3
0
from mara_schema.entity import Entity
from mara_schema.attribute import Type

seller_entity = Entity(name='Seller',
                       description='Merchants that are selling products',
                       schema_name='ec_dim')

seller_entity.add_attribute(
    name='Seller ID',
    description='The ID of the seller as defined in the backend',
    column_name='seller_id',
    type=Type.ID,
    high_cardinality=True)

from .zip_code import zip_code_entity
from .order import order_entity

seller_entity.link_entity(target_entity=zip_code_entity,
                          prefix='',
                          fk_column='zip_code_fk',
                          description='The ZIP code info of the seller')
seller_entity.link_entity(
    target_entity=order_entity,
    fk_column='first_order_fk',
    prefix='First order',
    description='The first order fulfilled by the seller')
예제 #4
0
    column_name='lead_behaviour_profile',
    type=Type.ENUM)

lead_entity.add_attribute(
    name='Average stock',
    description='The average number of items per product the lead has available on stock. '
                'Provided by the lead on the sign up at a landing page or the first contact '
                'with a Sales Development Representative',
    column_name='average_stock',
    type=Type.ENUM)

lead_entity.add_attribute(
    name='Business type',
    description='The type of business the lead has: reseller, manufacturer, other, or unknown',
    column_name='business_type',
    type=Type.ENUM)

lead_entity.add_attribute(
    name='Days to closing the deal',
    description='The number of days it took from first contact with the lead '
                'to closing the deal by a Sales Representative and the lead becoming a seller',
    column_name='days_to_closing_deal',
    type=Type.DURATION
)

from .seller import seller_entity

lead_entity.link_entity(
    target_entity=seller_entity,
    description='The seller info of the lead who has a closed deal')
예제 #5
0
from mara_schema.entity import Entity
from mara_schema.attribute import Type

order_item_entity = Entity(
    name='Order item',
    description='Individual products sold as part of an order',
    schema_name='ec_dim',
    table_name='order_item')

order_item_entity.add_attribute(
    name='Order item ID',
    description='The ID of the order item in the backend',
    column_name='order_item_id',
    type=Type.ID,
    high_cardinality=True)

from .order import order_entity
from .product import product_entity
from .seller import seller_entity

order_item_entity.link_entity(target_entity=product_entity,
                              description="The product that was ordered")
order_item_entity.link_entity(
    target_entity=order_entity,
    description="The order that contains the order item",
    prefix='')
order_item_entity.link_entity(target_entity=seller_entity,
                              description='The seller who fulfills the order')
예제 #6
0
    column_name='days_since_last_order',
    accessible_via_entity_link=False)

customer_entity.add_attribute(
    name='Favourite product category',
    description='The category of the most purchased product (by revenue) of the customer',
    type=Type.ENUM,
    column_name='favourite_product_category',
    accessible_via_entity_link=False)

from .zip_code import zip_code_entity
from .order import order_entity

customer_entity.link_entity(
    target_entity=zip_code_entity,
    prefix='',
    fk_column='zip_code_fk',
    description='The ZIP code info of the customer')

customer_entity.link_entity(
    target_entity=order_entity,
    description='The first order made by the customer',
    fk_column='first_order_fk',
    prefix='First order')

customer_entity.link_entity(
    target_entity=order_entity,
    description='The last order made by the customer',
    fk_column='last_order_fk',
    prefix='Last order')
예제 #7
0
from mara_schema.entity import Entity, Type

product_entity = Entity(
    name='Product',
    description='Products that were at least once sold or once on stock',
    schema_name='dim')

product_entity.add_attribute(
    name='SKU',
    description='The ID of a product as defined in the PIM system',
    high_cardinality=True,
    column_name='sku',
    type=Type.ID)

from .product_category import product_category_entity

product_entity.link_entity(target_entity=product_category_entity)
예제 #8
0
from mara_schema.attribute import Type
from mara_schema.entity import Entity

order_item_entity = Entity(
    name='Order item',
    description='Individual products sold as part of an order',
    schema_name='dim')

order_item_entity.add_attribute(
    name='Order item ID',
    description='The ID of the order item in the backend',
    column_name='order_item_id',
    type=Type.ID,
    high_cardinality=True)

from .order import order_entity
from .product import product_entity

order_item_entity.link_entity(target_entity=order_entity, prefix='')
order_item_entity.link_entity(target_entity=product_entity)