From 6447e445e270760f888533c72dc3c4814ab44275 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Sat, 17 Feb 2018 13:57:14 -0500 Subject: [PATCH] add sample scenario --- sample/data.csv | 40 +++++++++++++++++++++++++++++++ sample/definition.md | 56 ++++++++++++++++++++++++++++++++++++++++++++ sample/mapping.md | 37 +++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 sample/data.csv create mode 100644 sample/definition.md create mode 100644 sample/mapping.md diff --git a/sample/data.csv b/sample/data.csv new file mode 100644 index 0000000..997ecee --- /dev/null +++ b/sample/data.csv @@ -0,0 +1,40 @@ +Trans. Date,Post Date,Description,Amount,Category +01/02/2018,01/02/2018,"GOOGLE *YOUTUBE VIDEOS G.CO/HELPPAY#CAP0H07TXV",4.26,"Services" +01/02/2018,01/02/2018,"MICROSOFT *ONEDRIVE 800-642-7676 WA",4.26,"Services" +01/03/2018,01/03/2018,"CLE CLINIC PT PMTS 216-445-6249 OHAK2C57F2F0B3",200.00,"Medical Services" +01/04/2018,01/04/2018,"AT&T *PAYMENT 800-288-2020 TX",57.14,"Services" +01/04/2018,01/07/2018,"WWW.KOHLS.COM #0873 MIDDLETOWN OH",-7.90,"Payments and Credits" +01/05/2018,01/07/2018,"PIZZA HUT 007946 STOW OH",9.24,"Restaurants" +01/05/2018,01/07/2018,"SUBWAY 00044289255 STOW OH",10.25,"Restaurants" +01/06/2018,01/07/2018,"ACME NO. 17 STOW OH",103.98,"Supermarkets" +01/06/2018,01/07/2018,"DISCOUNT DRUG MART 32 STOW OH",1.69,"Merchandise" +01/06/2018,01/07/2018,"DISCOUNT DRUG MART 32 STOW OH",2.19,"Merchandise" +01/09/2018,01/09/2018,"CIRCLE K 05416 STOW OH00947R",3.94,"Gasoline" +01/09/2018,01/09/2018,"CIRCLE K 05416 STOW OH00915R",52.99,"Gasoline" +01/13/2018,01/13/2018,"AUTOZONE #0722 STOW OH",85.36,"Automotive" +01/13/2018,01/13/2018,"DISCOUNT DRUG MART 32 STOW OH",26.68,"Merchandise" +01/13/2018,01/13/2018,"EL CAMPESINO STOW OH",6.50,"Restaurants" +01/13/2018,01/13/2018,"TARGET STOW OH",197.90,"Merchandise" +01/14/2018,01/14/2018,"DISCOUNT DRUG MART 32 STOW OH",13.48,"Merchandise" +01/15/2018,01/15/2018,"TARGET.COM * 800-591-3869 MN",22.41,"Merchandise" +01/16/2018,01/16/2018,"BUFFALO WILD WINGS KENT KENT OH",63.22,"Restaurants" +01/16/2018,01/16/2018,"PARTA - KCG KENT OH",4.00,"Government Services" +01/16/2018,01/16/2018,"REMEMBERNHU 402-935-7733 IA",60.00,"Services" +01/16/2018,01/16/2018,"TARGET.COM * 800-591-3869 MN",44.81,"Merchandise" +01/16/2018,01/16/2018,"TREE CITY COFFEE & PASTR KENT OH",17.75,"Restaurants" +01/17/2018,01/17/2018,"BESTBUYCOM805526794885 888-BESTBUY MN",343.72,"Merchandise" +01/19/2018,01/19/2018,"DISCOUNT DRUG MART 32 STOW OH",5.98,"Merchandise" +01/19/2018,01/19/2018,"U-HAUL OF KENT-STOW KENT OH",15.88,"Travel/ Entertainment" +01/19/2018,01/19/2018,"WALMART GROCERY 800-966-6546 AR",5.99,"Supermarkets" +01/19/2018,01/19/2018,"WALMART GROCERY 800-966-6546 AR",17.16,"Supermarkets" +01/19/2018,01/19/2018,"WALMART GROCERY 800-966-6546 AR",500.97,"Supermarkets" +01/20/2018,01/20/2018,"GOOGLE *GOOGLE PLAY G.CO/HELPPAY#CAP0HFFS7W",2.12,"Services" +01/20/2018,01/20/2018,"LOWE'S OF STOW, OH. STOW OH",256.48,"Home Improvement" +01/23/2018,01/23/2018,"CASHBACK BONUS REDEMPTION PYMT/STMT CRDT",-32.20,"Awards and Rebate Credits" +01/23/2018,01/23/2018,"INTERNET PAYMENT - THANK YOU",-2394.51,"Payments and Credits" +01/27/2018,01/27/2018,"GIANT-EAGLE #4096 STOW OH",67.81,"Supermarkets" +01/27/2018,01/27/2018,"OFFICEMAX/OFFICE DEPOT63 STOW OH",21.06,"Merchandise" +01/27/2018,01/27/2018,"TARGET STOW OH",71.00,"Merchandise" +01/29/2018,01/29/2018,"NETFLIX.COM NETFLIX.COM CA19899514437",14.93,"Services" +01/30/2018,01/30/2018,"SQ *TWISTED MELTZ KENT OH0002305843011416898511",16.87,"Restaurants" +01/30/2018,01/30/2018,"TARGET STOW OH",49.37,"Merchandise" diff --git a/sample/definition.md b/sample/definition.md new file mode 100644 index 0000000..d41fbf0 --- /dev/null +++ b/sample/definition.md @@ -0,0 +1,56 @@ +setup source definition +-------------------------------------- + + { + "name": "DCARD", + "type": "csv", + "schema": [ + { + "key": "Trans. Date", + "type": "date" + }, + { + "key": "Post Date", + "type": "date" + }, + { + "key": "Description", + "type": "text" + }, + { + "key": "Amount", + "type": "numeric" + }, + { + "key": "Category", + "type": "text" + } + ], + "unique_constraint": { + "type": "key", + "fields": [ + "{Post Date}", + "{Trans. Date}", + "{Description}" + ] + } + } + +sample data +------------------------------------ + + +| Trans. Date | Post Date | Description | Amount | Category | +| ----------- | --------- | ---------------------------------------------- | ------ | -------------------- | +| 1/2/2018 | 1/2/2018 | GOOGLE *YOUTUBE VIDEOS G.CO/HELPPAY#CAP0H07TXV | 4.26 | Services | +| 1/2/2018 | 1/2/2018 | MICROSOFT *ONEDRIVE 800-642-7676 WA | 4.26 | Services | +| 1/3/2018 | 1/3/2018 | CLE CLINIC PT PMTS 216-445-6249 OHAK2C57F2F0B3 | 200 | Medical Services | +| 1/4/2018 | 1/4/2018 | AT&T *PAYMENT 800-288-2020 TX | 57.14 | Services | +| 1/4/2018 | 1/7/2018 | WWW.KOHLS.COM #0873 MIDDLETOWN OH | -7.9 | Payments and Credits | +| 1/5/2018 | 1/7/2018 | PIZZA HUT 007946 STOW OH | 9.24 | Restaurants | +| 1/5/2018 | 1/7/2018 | SUBWAY 00044289255 STOW OH | 10.25 | Restaurants | +| 1/6/2018 | 1/7/2018 | ACME NO. 17 STOW OH | 103.98 | Supermarkets | +| 1/6/2018 | 1/7/2018 | DISCOUNT DRUG MART 32 STOW OH | 1.69 | Merchandise | +| 1/6/2018 | 1/7/2018 | DISCOUNT DRUG MART 32 STOW OH | 2.19 | Merchandise | +| 1/9/2018 | 1/9/2018 | CIRCLE K 05416 STOW OH00947R | 3.94 | Gasoline | +| 1/9/2018 | 1/9/2018 | CIRCLE K 05416 STOW OH00915R | 52.99 | Gasoline | diff --git a/sample/mapping.md b/sample/mapping.md new file mode 100644 index 0000000..5999f92 --- /dev/null +++ b/sample/mapping.md @@ -0,0 +1,37 @@ +map definition +---------------------------------------------------------- + + { + "defn": [ + { + "key": "{Description}", + "map": "y", + "flag": "", + "field": "f20", + "regex": ".{1,20}", + "retain": "y" + } + ], + "name": "First 20", + "where": [ + { + } + ], + "function": "extract", + "description": "pull first 20 characters from description for mapping" + } + +assign values to the result of the regex +----------------------------------------------------- + + +| retval | map | +| ------------------------------- | ----------------------------------------------------------------------------------- | +| {"f20": "BIG LOTS #00453 STOW"} | {"party": "Big Lots", "reason": "Home Supplies"} | +| {"f20": "1794MOTHERHOOD #1794"} | {"party": "Motherhood", "reason": "Clothes"} | +| {"f20": "3 PALMS HUDSON OH"} | {"city": "Hudson", "party": "3 Palms", "reason": "Restaurante", "province": "Ohio"} | +| {"f20": "36241 7-ELEVEN STOW "} | {"city": "Stow", "party": "7-Eleven", "reason": "Gasoline", "province": "Ohio"} | +| {"f20": "7-ELEVEN 36241 STOW "} | {"city": "Stow", "party": "7-Eleven", "reason": "Gasoline", "province": "Ohio"} | +| {"f20": "98626 - 200 PUBLIC S"} | {"party": "Public Square Parking Garage", "reason": "Recreation"} | +| {"f20": "ACE HARDWARE HUDSON "} | {"party": "Ace Hardware", "reason": "Home Maintenance"} | +| {"f20": "ACH CAFE AND STARBUC"} | {"party": "Starbucks", "reason": "Restaurante"} |