Skip to content

Instantly share code, notes, and snippets.

@jekkos
Last active August 29, 2015 14:01
Show Gist options
  • Save jekkos/6d9c44e535e254654a28 to your computer and use it in GitHub Desktop.
Save jekkos/6d9c44e535e254654a28 to your computer and use it in GitHub Desktop.
analysis - sales record linking regex
(1) query for analyses with comments and without article id grouped by day (double array)
(2) get sales and sales items records with sale_time = day( creationDate), sorted by creation date
(3) loop over analyses records, grouped by day
(4) var freetext = execute regex to fetch article from analysis comments (\w+\W?\s?)*?(maat|m)?\s?(\d{1,},?\d?)
(5) loop over sales and sale items, assigning a score for each analysis
* check if sale_time is after creationDate
* check if brand = group (1) of regex
* check if name = group (2) of regex
* check if size = group (3) of regex
* add additional score based on the difference between sale_time and createionDate
what is the best match between the fetched item and the available set of items?
comparison between different variables defining a 'score'
depending on the score you can resolve items and pick out at the end (just find maximum per item)
what with equal scores?? => impossible as creation date will serve as discriminator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment