# qa-asset-fingerprinter-setup-helper

Helper to generate cypher queries or awscli commands based on track and asset filename data. These commands can be helpful when trying to test fingerprinting in QA by making sure real assets are available in S3 and metadata is in an expected state in neo4j.


## Generate Input CSV

1. Run this query on ows-assets database with a set of track unique ids.
```
  SELECT
      au.track_unique_id AS track_unique_id,
      af.filename AS filename
  FROM ows_assets.asset_upload au
  JOIN ows_assets.asset_final af
  	  ON af.asset_upload_id = au.id
  	  AND af.asset_type IN ('WAV', 'FLAC')
  	  AND au.deleted = 0
      AND au.is_correction = 0
  WHERE 
      au.track_unique_id IN (<TUIDS>)
  ;
```
2. Save output as CSV file.

## Running Script
```
usage: generate_commands.py [-h] filename {s3_cp,neo4j_merge,neo4j_match,neo4j_delete}

positional arguments:
  filename              Input CSV data
  {s3_cp,neo4j_merge,neo4j_match,neo4j_delete}
                        Type of commands or queries to output

optional arguments:
  -h, --help            show this help message and exit
```
| Command  | Output |
| ------------- | ------------- |
| s3_cp  | awscli commands to copy prod mezz assets to qa mezz bucket  |
| neo4j_merge  | cypher to insert OrchardAsset nodes in neo4j  |
| neo4j_match  | cypher to show existing OrchardAsset nodes in neo4j  |
| neo4j_delete  | cypher to delete existing OrchardAsset nodes in neo4j  |