# View: ChartMetric_UUID_Lookup

**View Name:** chartmetric_uuid_lookup
**Table Source:** `Derived from: Art_Relations_Prod_Art_Relations.Country, Prod.Nr_Contribution, Prod.Nr_Contribution_Contributed_To_Nr_Sound_Recording, Prod.Nr_Contribution_Type, Prod.Nr_Contributor + 3 more`
**File Path:** `views/ChartMetric_UUID_Lookup.view.lkml`

## Overview

- **File Size:** 5045 bytes
- **Lines of Code:** 198
- **Dimensions:** 24
- **Measures:** 1
- **Dimension Groups:** 1
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `NR_ID` | string |
| `Primary_Artist_Displayed_As` | string |
| `Contributor_ID` | string |
| `Contributor_Name` | string |
| `Stage_Name` | string |
| `Contributor_Type` | string |
| `Song_Name` | string |
| `Recording_Version` | string |
| `ISRC` | string |
| `Number_of_Primary_Performers` | string |
| `Valid` | string |
| `CM_Track_ID` | string |
| `CM_Track_Title` | string |
| `CM_ISRC` | string |
| `CM_Album_Name` | string |
| `CM_Artist_Name` | string |
| `CM_Duration` | number |
| `play_year` | string |
| `play_date` | string |
| `Radio_Station` | string |
| `Country_Code` | string |
| `Country_Name` | string |
| `CM_Track_Duration` | string |
| `Play_ID` | string |

## Measures

| Name | Type |
|------|------|
| `Play_Count` | count_distinct |

## Dimension Groups

| Name | Type |
|------|------|
| `CM_Timestamp` | time |

## SQL Comments

- cmts.ACR_CHANNEL,

## Derived Table

```sql
sql:
      select
      sr.id "NR ID",
    sr.main_artist Primary_Artist_Displayed_As,
    cont.nr_contributor_id Contributor_ID,
    nrbutor.name Contributor_Name,
    nrbution.performance_name Stage_Name,
    cont.contribution_type Contributor_Type,
    sr.recording_title Song_Name,
    sr.version Recording_Version,
    sr.isrc ISRC,
    sr.total_featured_performers Number_of_Primary_Performers,
    nrbution.valid AS Valid,
    nrbution.id Contribution_ID,
   nrbution.node_label,
cmts.ID Play_ID,
cmts.ACR_TRACK CM_Track_ID,
--cmts.ACR_CHANNEL,
cmts.PLAYED_DURATION CM_Duration,
cmts.TIMESTP CM_Timestamp,
to_varchar(cmts.TIMESTP,'yyyy/mm/dd') as play_date,
to_varchar(cmts.timestp,'yyyy') as play_year,
cmt.TRACK_NAME CM_Track_Title,
cmt.ISRC CM_ISRC,
cmt.ALBUM_NAME CM_Album_Name,
cmt.ARTIST_NAME CM_Artist_Name,
cmt.DURATION CM_Track_Duration,
cmc.NAME Radio_Station,
cmc.CODE2 Country_Code,
cy2.name Country_Name
from FACTS.prod.nr_contribution nrbution
inner join FACTS.prod.nr_contribution_type cont on nrbution.id = cont.nr_contribution_id  and cont.is_deleted not like true
inner join FACTS.prod.nr_contributor nrbutor on cont.nr_contributor_id = nrbutor.id
inner join FACTS.prod.nr_contribution_contributed_to_nr_sound_recording nsr on nrbution.id = nsr.nr_contribution_id
inner join FACTS.prod.performance_nr_sound_recording sr on nsr.nr_sound_recording_id = sr.id  and sr.is_deleted not like true
left join orchard_app_reporting_v2.art_relations_prod_art_relations.country mc ON sr.country_of_master = mc.country_code
left join orchard_app_reporting_v2.art_relations_prod_art_relations.country cc ON nrbution.country_of_performance = cc.country_code
left join orchard_app_reporting_v2.art_relations_prod_art_relations.country cl ON sr.country_of_label = cl.country_code
left join table(flatten (input => sr.countries_of_recording, outer => TRUE)) cr
left join orchard_app_reporting_v2.art_relations_prod_art_relations.country cy on cy.country_code=cr.value
left join CHARTMETRIC.RAW_DATA.ACR_TRACK cmt on sr.isrc = cmt.ISRC
left join CHARTMETRIC.RAW_DATA.ACR_TRACK_STAT cmts on cmt.id = cmts.acr_track
left join CHARTMETRIC.RAW_DATA.ACR_CHANNEL cmc on cmts.ACR_CHANNEL = cmc.id
left join orchard_app_reporting_v2.art_relations_prod_art_relations.country cy2 on cmc.CODE2 = cy2.country_code
group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27;;
```

