Skip to content

Instantly share code, notes, and snippets.

@alnutile
Created March 30, 2017 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alnutile/372a6dd6956c8a6302a218ed49215e31 to your computer and use it in GitHub Desktop.
Save alnutile/372a6dd6956c8a6302a218ed49215e31 to your computer and use it in GitHub Desktop.

ADR 001: Cloning Segments Skateboard Level (Proposed)

Status

Context

Given the complexity of segmenting data sets, users may wish to clone existing segments in order to speed up the reporting process.

And we have a short time line / budget.

And we want to deliver a simple / skateboard level feature of this workflow.

And Matt is new to the domain.

Decision

NOTE: we are using bullets for tables nothing else :)

We will be cloning all data from original Segment and relations other than:

  • global reports

We will remove all relative data if the user decides to upload a file.

Regarding Level One

Remove all of these tables:

  • affinities_import_columns
  • alignments
  • buckets
  • concentration_curve_level_one_reports
  • concentration_curve_reports
  • import_data_columns
  • import_datas (re-import these)
  • market_potentials
  • product_market_potential_results
  • portfolios

We remove these since all the data is altered. Later on we can find matching columns/attributes but right now is keeping it simple

Alter Tables

  • axes null settings
  • products lines, bucket

We remove these since they are no longer valid and need to be run again

Export and Scoring

/columns-update/

If they did not change any files but change here

  • find related concentration curves for those changed attributes, delete and run again

If they change a Level one File

  • I think we erased all of these during the upload
  • So now takes their settings and run fresh [1]

Note [1] This page shows all previous settings since we save those in the Import, IF THIS IS TRUE, then you need to still run these all again since it is new data. Maybe the best way for both of these is to search for existing CC for that attribute and if they exist ignore since you know the file was not updated if they do NOT exist the run since you know it is change

Regarding Level Two

When a user first clone this file we need to copy this data

  • imports
  • import_data
  • concentration_curve_reports -- see its file_name

When a user uploads a replacement we need to alter this Level Two data

  • related by file_name concentration_curve_reports
  • affinities_import_columns [1]
  • alignments [1]
  • concentration_curve_reports -- see its file_name
  • import_datas (re-import these)
  • portfolios
  • axes [2]
  • products lines, bucket

Note [1] Do we really need to alter this ever?

[2] files and settings columns find the original file_name key and update that to

  1. have the new filename key and file_name, file_type

Good fixtures tests/fixtures/axis_files.json and tests/fixtures/axis_settings_example.json

Example

  "data_mapping_settings": {
    "level_1_10_records": {
      "id": "level_1_10_records",
      "columns": {

level_1_10_records and it might become

  "data_mapping_settings": {
    "foo_new_file": {
      "id": "foo_new_file",
      "columns": {

Also these

    "file_name": "Level 1 10 Records",
    "file_type": "xls",

Might be

    "file_name": "Foo Name",
    "file_type": "xlsx",

Regarding Master

When a user first clone this file we need to copy this data

  • imports
  • import_data

When a user uploads a replacement we need to alter this Master data

  • import_datas (re-import these)
  • prospecting might have to be run again [1]

Note [1] Prospecting happens after column settings app/Listeners/JobManagerDispatcher.php:754

Consequences

More coming soon...

We can deliver a skateboard solution that provides the user a way to Clone and quickly run a new report with the same data. Or alter it and update the least amount of steps necessary to make a new report around the new data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment