CONVERTIBLE PREFERRED STOCK WARRANTS (Details) - USD ($)
$ / shares in Units, $ in Thousands
3 Months Ended 6 Months Ended
Jan. 31, 2017
Jan. 31, 2017
Nov. 01, 2016
Jul. 31, 2016
Class of Warrant or Right [Line Items]        
Number of Shares (in shares) 824,094 824,094    
Fair value $ 0 $ 0 $ 30,812 $ 9,679
Series A Warrants, Issued December 2009        
Class of Warrant or Right [Line Items]        
Contractual Term (in years)   10 years    
Number of Shares (in shares) 683,644 683,644    
Exercise Price per Share (in dollars per share) $ 0.234 $ 0.234    
Fair value     25,883 8,259
Series A Warrants, Issued May 2010        
Class of Warrant or Right [Line Items]        
Contractual Term (in years)   10 years    
Number of Shares (in shares) 85,450 85,450    
Exercise Price per Share (in dollars per share) $ 0.234 $ 0.234    
Fair value     3,235 1,032
Series D Warrants, Issued November 2013        
Class of Warrant or Right [Line Items]        
Contractual Term (in years)   10 years    
Number of Shares (in shares) 10,000 10,000    
Exercise Price per Share (in dollars per share) $ 7.289 $ 7.289    
Fair value     308 77
Series D Warrants, Issued December 2013        
Class of Warrant or Right [Line Items]        
Contractual Term (in years)   7 years    
Number of Shares (in shares) 45,000 45,000    
Exercise Price per Share (in dollars per share) $ 7.289 $ 7.289    
Fair value     $ 1,386 $ 311
Common Class B Warrant        
Class of Warrant or Right [Line Items]        
Number of Shares (in shares) 51,270 51,270    
Number of warrants exercised (in shares) 717,824 772,824    
Exercise of warrants (in shares) 711,935 758,464