TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker or making a Paypal contribution here: paypal.me/SupportTMC

CPO Search Application

Discussion in 'Model S: Ordering, Production, Delivery' started by Skotty, Feb 10, 2016.

  1. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    Greetings everyone.

    I'm almost finished with my own version of a CPO Search application. How it works in general is that you feed it a source of CPO inventory information and a list of your own search filters, and it will rank potential matches and tell you how the matches are different from the last time you ran the search. There is no user interface currently; it's meant to run more as either a console application or a scheduled task.

    This all started because I will be looking for a CPO Model S soon; I have a whole bunch of preferences and I was encouraged by what the ev-cpo.com website is already doing and wanted to expand on it in my own way.

    I wrote the application in Java. It is written to be as generic as possible, and at it's core is a search engine that can be used for anything, not just CPO Model S searches. I'm thinking of releasing it online somewhere open source; maybe at SourceForge or something. It's pretty much complete, but just needs some testing and verification.

    Here is sort of a visualization of how the application is structured:

    cpo-search-app-visualization.png

    If you are a Java programmer, you can define your own filter sources, candidate sources, and result destinations to suit your needs. Or, whether you are a Java programmer or not, you can use the ones already bundled with the application.

    Right now, I have the following bundled with the application:

    Filter Sources:
    CSVFilterSource -- this one loads your search filters from a CSV text file. I've included a sample filters file with the application.

    Candidate Sources:
    CSVCandidateSource -- this one loads candidates to search from a CSV text file. Where such file comes from is up to the user.
    EVCPOOfflineHtmlCandidateSource -- this one, you go visit the ev-cpo.com website, download the page as HTML Only, point the application to your downloaded file through the properties file, and it will parse the Model S inventory from the downloaded page (currently only does the US inventory, but I'll expand on that later probably). It can handle both subscribed user inventory list and unsubscribed user inventory list (though subscribed is better as it gives you more attributes to filter on).

    Result Destinations:
    ConsoleResultDestination -- this one just prints search results to the screen.
    MailResultDestination -- this one sends you an email with the search results.

    There are plenty more possibilities for how filters, candidates, and destinations could be set up. This is just a starting point. A source that allows automated downloads of information would be ideal, but that requires finding a suitable source and getting approval from the source providers.

    I'll post another update to this thread when I have it online. I plan on it being all open source. I just need to finish testing and find an online home for the source and binaries.
     
  2. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    #2 Skotty, Feb 10, 2016
    Last edited: Feb 10, 2016
    Example filters file content:


    # Valid values for fieldName and fieldType are:
    # vin (String), cpoInv (String), location (String), trim (String), aptp (String),
    # dualMotor (Boolean), rearFacingSeats (Boolean), coldWeatherPackage (Boolean),
    # soundStudio (Boolean), superchargerEnabled (Boolean), smartAirSuspension (Boolean),
    # dualChargers (Boolean), color (String), roof (String), wheels (String),
    # interior (String), year (Integer), miles (Integer), price (Integer)
    #
    # Valid values for matchType are:
    # * String: STARTS_WITH, ENDS_WITH, EQUALS, CONTAINS
    # * Integer: LESS_THAN, GREATER_THAN, EQUALS
    # * Boolean: EQUALS
    #
    # Valid values for weight are:
    # required, excluded, low, medium, high, maximum, [floating point number between 0 and 1]
    #
    # Match value can be:
    # * String: any string, can be wrapped in quotes (value will be case insensitive)
    # * Integer: a whole number
    # * Boolean: true, false


    threshold, 0.75
    trim, String, STARTS_WITH, S85, required
    location, String, EQUALS, San Francisco
    location, String, STARTS_WITH, San Diego
    interior, String, CONTAINS, Nappa, HIGH
    interior, String, CONTAINS, Black, excluded
    roof, String, EQUALS, Pano, required
    color, String, CONTAINS, Red, excluded
    color, String, CONTAINS, White
    color, String, CONTAINS, Brown, LOW
    wheels, String, STARTS_WITH, 21
    price, Integer, LESS_THAN, 80000, required
    price, Integer, LESS_THAN, 70000
    miles, Integer, LESS_THAN, 40000, required
    soundStudio, Boolean, EQUALS, true, HIGH
    dualChargers, Boolean, EQUALS, true


    - - - Updated - - -

    Example output:

    CPO Model S Search
    Threshold for match is set at 75%

    Changes Since Last Report:

    CHANGED :
    Old: 86% CPOModelS [vin=P44487, url=http://www.teslamotors.com//models/preowned/P44487, cpoInv=CPO, location=San Francisco, trim=S85, aptp=TP, dualMotor=false, rearFacingSeats=false, coldWeatherPackage=false, soundStudio=true, superchargerEnabled=true, smartAirSuspension=true, dualChargers=true, color=Grey Metallic, roof=Pano, wheels=21-Silver, interior=Tan Nappa, year=2014, miles=19799, price=71200, dateAdded=Fri Dec 18 12:21:00 CST 2015]
    New: 87% CPOModelS [vin=P44487, url=http://www.teslamotors.com//models/preowned/P44487, cpoInv=CPO, location=San Francisco, trim=S85, aptp=TP, dualMotor=false, rearFacingSeats=false, coldWeatherPackage=false, soundStudio=true, superchargerEnabled=true, smartAirSuspension=true, dualChargers=true, color=Grey Metallic, roof=Pano, wheels=21-Silver, interior=Tan Nappa, year=2014, miles=19799, price=71200, dateAdded=Fri Dec 18 12:21:00 CST 2015]

    CHANGED :
    Old: 77% CPOModelS [vin=P27889, url=http://www.teslamotors.com//models/preowned/P27889, cpoInv=CPO, location=Los Angeles, trim=S85, aptp=TP, dualMotor=false, rearFacingSeats=false, coldWeatherPackage=false, soundStudio=true, superchargerEnabled=true, smartAirSuspension=true, dualChargers=true, color=Dark Blue Metallic, roof=Pano, wheels=21-Silver, interior=Tan Nappa, year=2013, miles=23077, price=69300, dateAdded=Tue Jan 12 14:00:00 CST 2016]
    New: 78% CPOModelS [vin=P27889, url=http://www.teslamotors.com//models/preowned/P27889, cpoInv=CPO, location=Los Angeles, trim=S85, aptp=TP, dualMotor=false, rearFacingSeats=false, coldWeatherPackage=false, soundStudio=true, superchargerEnabled=true, smartAirSuspension=true, dualChargers=true, color=Dark Blue Metallic, roof=Pano, wheels=21-Silver, interior=Tan Nappa, year=2013, miles=23077, price=69300, dateAdded=Tue Jan 12 14:00:00 CST 2016]

    CHANGED :
    Old: 77% CPOModelS [vin=P44872, url=http://www.teslamotors.com//models/preowned/P44872, cpoInv=CPO, location=New York, trim=S85, aptp=TP, dualMotor=false, rearFacingSeats=false, coldWeatherPackage=true, soundStudio=true, superchargerEnabled=true, smartAirSuspension=false, dualChargers=false, color=White Solid, roof=Pano, wheels=21-Grey, interior=Tan Nappa, year=2014, miles=14561, price=69600, dateAdded=Thu Dec 17 19:40:00 CST 2015]
    New: 78% CPOModelS [vin=P44872, url=http://www.teslamotors.com//models/preowned/P44872, cpoInv=CPO, location=New York, trim=S85, aptp=TP, dualMotor=false, rearFacingSeats=false, coldWeatherPackage=true, soundStudio=true, superchargerEnabled=true, smartAirSuspension=false, dualChargers=false, color=White Solid, roof=Pano, wheels=21-Grey, interior=Tan Nappa, year=2014, miles=14561, price=69600, dateAdded=Thu Dec 17 19:40:00 CST 2015]

    REMOVED :
    73% CPOModelS [vin=P41856, url=http://www.teslamotors.com//models/preowned/P41856, cpoInv=CPO, location=Los Angeles, trim=S85, aptp=TP, dualMotor=false, rearFacingSeats=false, coldWeatherPackage=true, soundStudio=true, superchargerEnabled=true, smartAirSuspension=true, dualChargers=true, color=Brown Metallic, roof=Pano, wheels=19-Cyclone, interior=Tan Nappa, year=2014, miles=16435, price=73000, dateAdded=Thu Dec 17 00:40:00 CST 2015]



    Current Candidates:

    87% 85 kWh Model S P44487 | Tesla Motors
    78% 85 kWh Model S P27889 | Tesla Motors
    78% 85 kWh Model S P44872 | Tesla Motors


    Current Filters:

    roof EQUALS "Pano" [requirement]
    wheels STARTS_WITH "21" [weight of 0.5]
    dualChargers is true [weight of 0.5]
    soundStudio is true [weight of 0.75]
    trim STARTS_WITH "S85" [requirement]
    color CONTAINS "Red" [exclusion]
    color CONTAINS "White" [weight of 0.5]
    color CONTAINS "Brown" [weight of 0.25]
    price LESS_THAN 80000 [requirement]
    price LESS_THAN 70000 [weight of 0.5]
    location EQUALS "San Francisco" [weight of 0.5]
    location STARTS_WITH "San Diego" [weight of 0.5]
    interior CONTAINS "Nappa" [weight of 0.75]
    interior CONTAINS "Black" [exclusion]
    miles LESS_THAN 40000 [requirement]
     
  3. MsElectric

    MsElectric Active Member

    Joined:
    Oct 11, 2014
    Messages:
    1,611
    Location:
    New York
    Wow. Great job! Can't wait to play with it online.
     
  4. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    #4 Skotty, Feb 10, 2016
    Last edited: Feb 10, 2016
    Had a set back today. I was trying to get it hosted on CodePlex, but I had to choose a repository type that CodePlex supports. Decided to try Git, since it's all the rage, and somehow it managed to delete all of my source code out of Eclipse yet not put any of it in the repository. Thankfully, I had a backup in my home Subversion repository, though I did lose several hours worth of work. I had it cleaned up a bit, test cases added, and updated to build with Maven. Lost all of that. Unfortunately, I stay very busy, and I'm not sure when I'll have several hours of free time to redo it, but I'll get to it when I can.

    Plus Hank just released an update to ev-cpo that increases the power of his alert system, which is great, but it reduces any advantage my own search engine might have had. Not complaining, but it's another discouragement from pushing on with opening my application up to the public. I already have a version of my app running for myself. Maybe I'll wait to see if any others are interested.
     
  5. MsElectric

    MsElectric Active Member

    Joined:
    Oct 11, 2014
    Messages:
    1,611
    Location:
    New York
    Does your codebase maintain a repository of available CPO cars with a definable polling period?

    How hard would it be to port it to .NET/C#? :)
     
  6. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    It does not maintain a history of available cars. For now, the only history it stores is the results of the last search, so that it can report on any differences on the next search.

    It would probably not be too hard to port it to .NET/C#. It is very clean code IMO. I'm very happy with how the code came out.
     
  7. HankLloydRight

    HankLloydRight Fluxing

    Joined:
    Jan 18, 2014
    Messages:
    5,769
    Location:
    Connecticut
    Man, I've been there, done that, and have the t-shirt, too. ;) And after losing several hours or days of work, when you go back to re-do it, it's never as elegant or satisfying as it was the first time. Sometimes you can't just recreate a work of art, even though you just did it hours or days before.

    I'm sorry for the discouragement... but it was just timing. I had been working on those enhancements for the last several days (it was the top requested feature addition I was getting), and I was just finishing it up when you posted your toolset. But I don't think I'll ever be adding a weighted system to EV-CPO, so that's still an interesting feature.
     
  8. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    Thanks, Hank. Your enhancements are great!

    I went ahead and hosted my application online. XanderCat OFE - Home

    It's mostly there, but it's not yet ready for a non-developer to use. I'll get a user friendly release set up in a few more days.
     
  9. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    I've added a release of the CPO Search app on the distribution site. I still consider it Beta, but it's there. Also, I still need to add documentation to the site, but I did put some info in the release notes for the download that should help, should anyone want to try it.

    Later on I'll create a separate release of just the Object Filter Engine and Search Utility, should anyone want the generic form of it. Though technically, you can just use the jar from the demo release; it just contains some extra classes and a manifest to make the CPO Search demo run.
     
  10. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
  11. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    Just in case anyone is actively playing with this, there is a small bug in the CSVCandidateSource. The CPO Search app doesn't use CSVCandidateSource, so probably won't affect anyone. But if anyone is playing around and tries using the CSVCandidateSource, it probably will not work correctly as is. I have a fix for it already completed, but the CodePlex Git repositories are down right now, so not sure when I can commit it and get an updated release out there. Again, however, probably no one here cares though.
     
  12. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    Just talking to myself here mostly, but the bugs previously noted are fixed in the latest release 1.0.1.
     
  13. Logan Abbott

    Logan Abbott New Member

    Joined:
    Feb 25, 2016
    Messages:
    1
    Location:
    Los Angeles, USA
    Looks great! We'd love to host it for you on SourceForge.
     
  14. Skotty

    Skotty 2014 Model S P85

    Joined:
    Jun 27, 2013
    Messages:
    1,440
    Location:
    Kansas City, MO
    Just released XanderCat OFE version 1.2, which add some new stuff including statistics collection. There is no CSV support for statistics collection, so you won't be able to do much with statistics unless you are a Java developer. HOWEVER, the packaged CPO Model S Search Application demo is already set up with some interesting statistics for CPO listings, so you might find those of interest.

    XanderCat OFE - Home
     

Share This Page