Skip to content

Commit 98e7512

Browse files
Merge pull request #20 from Ritik574-coder/dbt_branch
docs: document schema and data quality notes for stg_employees in _stg__retail__models.yml
2 parents 2133826 + 4da35e9 commit 98e7512

1 file changed

Lines changed: 169 additions & 15 deletions

File tree

models/staging/_stg__retail__models.yml

Lines changed: 169 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ models:
132132
- name: address
133133
description: |
134134
Customer street address captured from source customer records. Source values
135-
contain inconsistent formatting, structural variations, and missing address information.
135+
contain inconsistent formatting, structural variations, and wrong address information.
136136
and This field contain leading and trailing whitespace.
137137
138138
- name: city
139139
description: |
140140
Customer city name captured from source customer records. Source values
141-
contain inconsistent formatting, structural variations, invalid digit
142-
groupings, incomplete address information, and malformed representations.
141+
contain inconsistent formatting, structural variations, incomplete address
142+
information, and malformed representations.
143143
City values were profiled, parsed, validated, and standardized into the
144144
canonical US format 'Anytown'. Records failing structural validation were
145145
flagged as invalid to ensure consistent customer address information and
@@ -182,20 +182,20 @@ models:
182182
- name: country
183183
description: |
184184
Customer country attribute standardized to common country names (for example,
185-
'United States'). Profiling detected mixed abbreviations ('US', 'USA', 'U.S.'),
185+
('United States'). Profiling detected mixed abbreviations ('US', 'USA', 'U.S.'),
186186
inconsistent casing, and missing values. The canonical value is used for
187187
regional analysis and currency assumptions.
188188
189189
- name: region
190190
description: |
191191
Higher-level regional classification derived from geographic attributes
192-
(for example, 'West', 'South', 'Midwest'). Region values were computed from
192+
(for example, 'West', 'South', 'Midwest', etc.). Region values were computed from
193193
standardized state information and used to support aggregated regional
194194
analysis. Records with unresolved state mappings may have null region values.
195195
196196
- name: customer_segment
197197
description: |
198-
Customer segmentation attribute (for example, 'Retail', 'Wholesale', 'Loyal').
198+
Customer segmentation attribute (for example, Bronze, Gold, Platinum, Silver).
199199
Profiling revealed inconsistent category labels and legacy codes; the
200200
transformation maps common variants to a small canonical set and preserves
201201
unknown values for later review.
@@ -211,7 +211,7 @@ models:
211211
description: |
212212
Operational indicator reflecting whether the customer account is currently
213213
active. Source values used heterogeneous boolean encodings (for example,
214-
'1', '0', 'Y', 'N', 'true', 'false'). Transformation normalizes values to
214+
'1', '0', 'Y', 'N', 'true', 'false', etc.). Transformation normalizes values to
215215
True / False / Unknown categories to support active-customer analyses.
216216
217217
- name: account_created_date
@@ -223,8 +223,8 @@ models:
223223
224224
- name: preferred_channel
225225
description: |
226-
Customer's preferred contact or marketing channel (for example, 'Email',
227-
'Phone', 'SMS', 'Direct Mail'). Profiling showed semantic drift and varied
226+
Customer's preferred contact or marketing channel (for example, APP, Catalog,
227+
in-store, Mobile App, Online, Web, etc.). Profiling showed semantic drift and varied
228228
abbreviations; mapping rules consolidate the dominant variants into a
229229
controlled vocabulary.
230230
@@ -260,18 +260,172 @@ models:
260260
recommended enforcing uniqueness at downstream stages.
261261
tests:
262262
- unique
263-
- not_null
263+
- not_null
264+
265+
- name: first_name
266+
description: |
267+
Customer first name captured from source customer records. This field
268+
contains inconsistent casing (mixed uppercase, lowercase, and title case),
269+
leading and trailing whitespace, and formatting discrepancies. Profiling
270+
identified no null values, ensuring complete coverage for this attribute.
271+
Standardization and whitespace trimming are required to establish a
272+
consistent format for downstream analytical reporting and personalization.
273+
274+
- name: last_name
275+
description: |
276+
Employee last name captured from source records. This field exhibits
277+
inconsistent casing, including mixed uppercase, lowercase, and title case
278+
representations, as well as leading and trailing whitespace. Profiling
279+
confirms there are no null values in this field. Standardizing the
280+
casing and removing whitespace is required to ensure reliable
281+
employee-level identification and reporting in downstream models.
282+
283+
- name: full_name
284+
description: |
285+
Employee full name derived from concatenated source records. This field
286+
contains inconsistent casing (mixed uppercase, lowercase, and title case)
287+
and significant leading and trailing whitespace. To ensure data
288+
consistency for reporting and directory services, this field is
289+
standardized through whitespace removal and title-case normalization.
290+
It serves as a primary display attribute, and its alignment with
291+
the individual `first_name` and `last_name` components is verified to
292+
ensure identity accuracy.
264293
265294
- name: email
266295
description: |
267-
Employee email address. Profiling found malformed domains, duplicate '@'
268-
symbols and case inconsistencies; defensive cleaning and structural
269-
validation were applied in later stages.
296+
Employee email address captured from source records. Profiling identified
297+
significant data quality challenges, including malformed domain structures,
298+
duplicate '@' symbols, and inconsistent casing (mixed uppercase and
299+
lowercase). To ensure data integrity, defensive cleaning—including
300+
case normalization, whitespace trimming, and structural pattern validation—is
301+
applied during downstream transformations to facilitate reliable internal
302+
communications and employee identification.
303+
304+
- name: phone
305+
description: |
306+
Employee contact phone number. Source data contains highly inconsistent
307+
formatting, including varied separators (dots, hyphens, parentheses) and
308+
missing area codes or digit groupings. To ensure reliable contact
309+
information, all values are parsed, validated, and normalized into the
310+
canonical US format '+1 (AAA) BBB-CCCC'. Records that fail to meet this
311+
structure are flagged as invalid to maintain high data quality for
312+
downstream reporting and operational use.
313+
314+
- name: job_title
315+
description: |
316+
Official employee job title. This field is highly standardized,
317+
featuring consistent title-case formatting with no leading or
318+
trailing whitespace. Data profiling confirms that these values are
319+
clean and ready for immediate use in organizational reporting,
320+
resource allocation, and workforce analytics without the need for
321+
further transformation.
322+
323+
- name: department
324+
description: |
325+
Organizational department classification. The values in this field are
326+
well-structured, adhering to consistent title-case formatting with
327+
no leading or trailing whitespace. The data is validated as clean,
328+
reliable, and ready for direct use in downstream workforce segmentation
329+
and departmental reporting.
330+
331+
- name: store_id
332+
description: |
333+
Unique identifier for the retail store where the employee is currently
334+
assigned. This field is consistently formatted and requires no
335+
cleansing or structural transformation. Please note that this column
336+
naturally contains duplicate values, as multiple employees are assigned
337+
to the same store location. It is suitable for use as a foreign key
338+
when joining with the stores dimension for operational or regional
339+
reporting[cite: 1].
340+
341+
- name: store_name
342+
description: |
343+
Official retail store display name. The data is well-structured and
344+
follows consistent title-case formatting, requiring no cleansing.
345+
The values incorporate store location and format identifiers (e.g.,
346+
'Flagship', 'Express', 'Pop-Up', 'Outlet', 'Standard'). As a
347+
standardized dimension, this field is reliable for store-level
348+
aggregation and performance comparison across different store tiers.
349+
350+
- name: store_city
351+
description: |
352+
The city location of the retail store where the employee is assigned.
353+
The data is presented in a clean, standardized format, utilizing
354+
consistent title-case capitalization with no leading or trailing
355+
whitespace. This field is reliable for geographic filtering and
356+
regional store-performance analysis without requiring further
357+
transformation.
270358
271359
- name: hire_date
272360
description: |
273-
Employee hire date normalized to ISO 8601. Profiling handled mixed date
274-
formats and ambiguous regional conventions using pattern-aware parsing.
361+
Employee hire date captured from source systems. The raw data exhibits
362+
significant complexity, including multiple date formats, varied
363+
regional conventions (e.g., month/day ordering), inconsistent
364+
separators, and full-text month naming variations. To ensure
365+
analytical integrity, these values have been parsed, validated, and
366+
normalized into the ISO 8601 format (YYYY-MM-DD). Ambiguous dates were
367+
resolved using pattern-based parsing and established business logic to
368+
support reliable downstream temporal analysis and workforce reporting.
369+
370+
- name: years_employed
371+
description: |
372+
Employee tenure represented as a numeric value. The current integer
373+
format fails to capture fractional periods, such as employees with
374+
partial-year experience (e.g., 6 years and 7 months). Additionally,
375+
profiling indicates that values for inactive employees are inconsistent
376+
or inaccurate. This column is being refactored to a decimal (float)
377+
format to ensure precision for tenure-based reporting, and validation
378+
logic is being implemented to correct calculations for both active and
379+
inactive personnel.
380+
381+
- name: annual_salary_usd
382+
description: |
383+
Annual base salary of the employee expressed in USD. The data is
384+
clean, consistently formatted as integers, and requires no structural
385+
transformation or cleansing. This field is validated for accuracy
386+
and is ready for immediate use in compensation analysis, budgeting,
387+
and workforce cost reporting.
388+
389+
- name: commission_rate_pct
390+
description: |
391+
Employee commission rate expressed as a percentage. The source data
392+
contains mixed numeric types (integers and decimals) due to
393+
inconsistent formatting across systems. To ensure mathematical
394+
accuracy for payroll and performance incentive calculations, this
395+
field is cast to a uniform decimal data type. No additional
396+
categorical or structural transformation is required; the focus
397+
is solely on maintaining precision for commission-based reporting.
398+
399+
- name: is_active
400+
description: |
401+
Operational status indicator reflecting whether an employee is currently
402+
active within the organization. The source data contains heterogeneous
403+
encodings, including boolean-like values ('1', 'Y', 'Yes'), negative
404+
indicators ('N', 'No'), and status descriptors ('Active', 'Terminated').
405+
To support consistent workforce analysis, this field is normalized to a
406+
standard boolean (True/False) format. All ambiguous or non-standard
407+
representations are mapped during transformation to ensure reliable
408+
reporting on headcount and active personnel.
409+
410+
- name: performance_rating
411+
description: |
412+
Employee performance appraisal rating. Profiling identified significant
413+
inconsistencies, including a mix of numeric grades (2-5), character
414+
grades (A-D), and descriptive text (e.g., 'Excellent', 'Average').
415+
Additionally, missing values are currently represented by nulls or
416+
inconsistent labels. This field requires a standardization mapping
417+
to a uniform scale, with 'Unknown' used as the canonical value for
418+
missing or invalid records to ensure reliable performance-based
419+
segmentation and talent analytics.
420+
421+
- name: manager_id
422+
description: |
423+
Identifier of the employee's direct supervisor. The data is largely
424+
consistent; however, this field contains null values for top-level
425+
management or executive roles, as these individuals do not report to
426+
another manager within the organizational hierarchy. This column is
427+
suitable for use in recursive queries or self-joins to map the
428+
reporting structure and organizational tree.
275429
276430
####################################################################################################
277431
#################################### STAGING INVENTORY INFORMATION #################################

0 commit comments

Comments
 (0)