Skip to content

Commit dcbc8e2

Browse files
committed
fixed #1
1 parent acaa80d commit dcbc8e2

File tree

3 files changed

+177
-22
lines changed

3 files changed

+177
-22
lines changed

README.md

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,72 @@
1+
# README
12

2-
# contoso
3-
4-
<!-- badges: start -->
5-
<!-- badges: end -->
6-
7-
Contoso is a synthetic dataset containing sample sales transaction data for the fictional "Contoso" company. It includes various supporting tables for business intelligence, such as customer, store, product, and currency exchange data.
83

9-
You can either load the datasets directly or use the function `create_contoso_duckdb()` to create a DuckDB database that contains the following tables:
10-
11-
- sales
12-
- customer
13-
- store
14-
- product
15-
- fx
16-
- date
17-
- order
18-
- orderrows
4+
# contoso
195

20-
This dataset is perfect for practicing time series analysis, financial modeling, or any business intelligence-related tasks.
6+
Contoso is a synthetic dataset containing sample sales transaction data
7+
for the fictional “Contoso” company. It includes various supporting
8+
tables for business intelligence, such as customer, store, product, and
9+
currency exchange data.
10+
11+
You can either load the datasets directly or use the function
12+
`create_contoso_duckdb()` to create a DuckDB database that contains the
13+
following tables:
14+
15+
- **sales**:
16+
- Contains information about sales transactions, including the total
17+
sales amount, customer, store, and product involved.
18+
- **customer**:
19+
- Contains details about customers, such as customer key, name,
20+
address, and demographic information.
21+
- **store**:
22+
- Contains information about stores, including store key, name,
23+
location, and related details.
24+
- **product**:
25+
- Contains information about products, such as product key, name,
26+
category, and price.
27+
- **fx**:
28+
- Contains foreign exchange rate data, mapping currency pairs to their
29+
exchange rates on specific dates.
30+
- **date**:
31+
- Contains date-related information, including date, week, month,
32+
quarter, and year for use in time-based analysis.
33+
- **order**:
34+
- Contains information about individual orders, including order key,
35+
customer key, order date, and store information.
36+
- **orderrows**:
37+
- Contains detailed line items for each order, including product key,
38+
quantity, and price for each item in the order.
39+
40+
The Contoso dataset is a fictional set of data created by Microsoft. It
41+
is commonly used for educational and demonstration purposes to showcase
42+
various features of data analysis, business intelligence tools, and data
43+
processing techniques
44+
45+
This dataset is perfect for practicing time series analysis, financial
46+
modeling, or any business intelligence-related tasks.
47+
48+
The data is sourced from the
49+
[sqlbi](https://github.com/sql-bi/Contoso-Data-Generator-V2-Data/releases/tag/ready-to-use-data)
50+
github site
51+
52+
## Dataset overview
53+
54+
![Contoso Overview](fig/contoso_schema.svg)
55+
56+
The relationship keys that join each of the tables are listed below.
57+
58+
| sales | customer | product | store | order | orderrows | fx |
59+
|---------------|--------------|-------------|-----------|--------------|-------------|---------------|
60+
| order_key | | | | order_key | order_key | |
61+
| customer_key | customer_key | | | customer_key | | |
62+
| store_key | | | store_key | store_key | | |
63+
| product_key | | product_key | | | product_key | |
64+
| currency_code | | | | | | from_currency |
2165

2266
## Installation
2367

24-
You can install the development version of contoso from [GitHub](https://github.com/) with:
68+
You can install the development version of contoso from
69+
[GitHub](https://github.com/alejandrohagan/contoso) with:
2570

2671
``` r
2772
# install.packages("pak")
@@ -40,11 +85,14 @@ contoso_db <- create_contoso_duckdb(dir = "temp")
4085

4186
# Access the sales dataset from the database
4287
sales_data <- contoso_db$sales
43-
4488
```
4589

4690
## Features
4791

48-
- Realistic Sales Data: Simulates a variety of sales transactions, customer details, store locations, and product information.
49-
- Multiple Data Tables: Supports multiple tables like sales, customers, store details, product catalog, exchange rates, and time-series information.
50-
- Easy-to-Use: Load and use data directly or create a full DuckDB database for seamless analysis with create_contoso_database().
92+
- Realistic Sales Data: Simulates a variety of sales transactions,
93+
customer details, store locations, and product information.
94+
- Multiple Data Tables: Supports multiple tables like sales, customers,
95+
store details, product catalog, exchange rates, and time-series
96+
information.
97+
- Easy-to-Use: Load and use data directly or create a full DuckDB
98+
database for seamless analysis with create_contoso_database().

README.qmd

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: "README"
3+
format: gfm
4+
---
5+
6+
# contoso
7+
8+
Contoso is a synthetic dataset containing sample sales transaction data for the fictional "Contoso" company. It includes various supporting tables for business intelligence, such as customer, store, product, and currency exchange data.
9+
10+
The package comes with the following datasets:
11+
12+
- **sales**:
13+
- Contains information about sales transactions, including the total sales amount, customer, store, and product involved.
14+
15+
- **customer**:
16+
- Contains details about customers, such as customer key, name, address, and demographic information.
17+
18+
- **store**:
19+
- Contains information about stores, including store key, name, location, and related details.
20+
21+
- **product**:
22+
- Contains information about products, such as product key, name, category, and price.
23+
24+
- **fx**:
25+
- Contains foreign exchange rate data, mapping currency pairs to their exchange rates on specific dates.
26+
27+
- **date**:
28+
- Contains date-related information, including date, week, month, quarter, and year for use in time-based analysis.
29+
30+
- **order**:
31+
- Contains information about individual orders, including order key, customer key, order date, and store information.
32+
33+
- **orderrows**:
34+
- Contains detailed line items for each order, including product key, quantity, and price for each item in the order.
35+
36+
37+
You can either load the datasets directly or use the function `create_contoso_duckdb()` to create a DuckDB that contains the following tables:
38+
39+
The Contoso dataset is a fictional set of data created by Microsoft. It is commonly used for educational and demonstration purposes to showcase various features of data analysis, business intelligence tools, and data processing techniques
40+
41+
This dataset is perfect for practicing time series analysis, financial modeling, or any business intelligence-related tasks.
42+
43+
The data is sourced from the [sqlbi](https://github.com/sql-bi/Contoso-Data-Generator-V2-Data/releases/tag/ready-to-use-data) github site
44+
45+
## Dataset overview
46+
47+
48+
![Contoso Overview](fig/contoso_schema.svg)
49+
50+
51+
The relationship keys that join each of the tables are listed below.
52+
53+
```{r}
54+
#| echo: false
55+
#| eval: true
56+
#| label: keys
57+
#| message: true
58+
#| error: false
59+
#| warning: false
60+
61+
tibble::tibble(
62+
sales=c("order_key", "customer_key","store_key","product_key","currency_code")
63+
,customer=c(NA,"customer_key",NA,NA,NA)
64+
,product=c(NA,NA,NA,"product_key",NA)
65+
,store=c(NA,NA,"store_key",NA,NA)
66+
,order=c("order_key","customer_key","store_key" ,NA,NA)
67+
,orderrows=c("order_key",NA,NA,"product_key",NA)
68+
,fx=c(NA,NA,NA,NA,"from_currency")
69+
) |>
70+
tidyr::replace_na(list(sales="",customer="",product="",store="",order="",orderrows="",fx="")) |>
71+
tinytable::tt()
72+
73+
```
74+
75+
## Installation
76+
77+
You can install the development version of contoso from [GitHub](https://github.com/alejandrohagan/contoso) with:
78+
79+
```{r}
80+
#| eval: false
81+
# install.packages("pak")
82+
pak::pak("alejandrohagan/contoso")
83+
```
84+
85+
## Example
86+
87+
This is a basic example which shows you how to solve a common problem:
88+
89+
```{r}
90+
#| eval: false
91+
#| label: create-contoso-duckdb
92+
93+
library(contoso)
94+
95+
# Create a DuckDB database containing Contoso datasets
96+
contoso_db <- create_contoso_duckdb(dir = "temp")
97+
98+
# Access the sales dataset from the database
99+
sales_data <- contoso_db$sales
100+
101+
```
102+
103+

0 commit comments

Comments
 (0)