Skip to content

Commit

Permalink
fixed failing test due to circular import in Compiler class, need to …
Browse files Browse the repository at this point in the history
…restructure Compiler and merge with DataObj; changes to doc build file
  • Loading branch information
dorisjlee committed Jan 28, 2020
1 parent 9c53bd4 commit 5be6ac8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
<h2 align="center">A Python API for Intelligent Visual Discovery</h2>

<p align="center">
<a href="https://travis-ci.org/lux-org/lux"><img alt="Build Status" src="https://travis-ci.org/lux-org/lux.svg?branch=master" align="center"></a>
<a href="https://travis-ci.org/lux-org/lux">
<img alt="Build Status" src="https://travis-ci.org/lux-org/lux.svg?branch=master" align="center">
</a>
<a href='https://lux-api.readthedocs.io/en/latest/?badge=latest'>
<img src='https://readthedocs.org/projects/lux-api/badge/?version=latest' alt='Documentation Status' />
</a>
</p>

Lux is a Python library that makes data science easier by automating certain aspects of the data exploration process. Lux is designed to facilitate faster experimentation with data, even when the user does not have a clear idea of what they are looking for.
Expand Down
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

master_doc = 'index'
33 changes: 16 additions & 17 deletions lux/compiler/Compiler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import lux
from lux.dataObj.Row import Row
from lux.dataObj.Column import Column
from lux.dataset.Dataset import Dataset
Expand All @@ -11,18 +10,18 @@ def __init__(self):
def __repr__(self):
return f"<Compiler>"

def expandUnderspecified(self, dobj : lux.dataObj.DataObj):
def expandUnderspecified(self, dobj):
"""
Given a underspecified DataObject, populate the dataType and dataModel information accordingly
Parameters
----------
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
Underspecified DataObj input
Returns
-------
expandedDobj : lux.dataObj.DataObj
expandedDobj : lux.dataObj.dataObj.DataObj
DataObj with dataType and dataModel information
"""
# Automatic type conversion (only for single attributes not lists of attributes)
Expand All @@ -42,19 +41,19 @@ def expandUnderspecified(self, dobj : lux.dataObj.DataObj):
expandedDobj.dataset = applyDataTransformations(expandedDobj.dataset, fAttribute=rcObj.fAttribute, fVal = rcObj.fVal)
expandedDobj.title = f"{rcObj.fAttribute}={rcObj.fVal}"
return expandedDobj
def enumerateCollection(self, dobj: lux.dataObj.DataObj):
def enumerateCollection(self, dobj):
"""
Given a partial specification, enumerate items in the collection via populateOption,
then call the recursive generateCollection to iterate over the resulting list combinations.
Parameters
----------
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
Input DataObject
Returns
-------
collection: lux.dataObj.DataObjectCollection
collection: lux.dataObj.dataObj.DataObjectCollection
Resulting DataObjectCollection
"""
# Get all the column and row object, assign the attribute names to variables
Expand All @@ -74,13 +73,13 @@ def enumerateCollection(self, dobj: lux.dataObj.DataObj):
collection = self.generateCollection(colAttrs, rowList, dobj)
return collection
@staticmethod
def populateOptions(dobj: lux.dataObj.DataObj, rowCol):
def populateOptions(dobj, rowCol):
"""
Given a row or column object, return the list of available values that satisfies the dataType or dataModel constraints
Parameters
----------
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
[description]
rowCol : Row or Column Object
Input row or column object with wildcard or list
Expand Down Expand Up @@ -121,15 +120,15 @@ def populateOptions(dobj: lux.dataObj.DataObj, rowCol):
rcOptions.append(rcCopy)
return rcOptions

def generateCollection(self, colAttrs: List[Row], rowList: List[Column], dobj: lux.dataObj.DataObj): # [[colA,colB],[colC,colD]] -> [[colA,colC],[colA,colD],[colB,colC],[colB,colD]]
def generateCollection(self, colAttrs: List[Row], rowList: List[Column], dobj): # [[colA,colB],[colC,colD]] -> [[colA,colC],[colA,colD],[colB,colC],[colB,colD]]
"""
Generates combinations for visualization collection given a list of row and column values
Parameters
----------
colAttrs : List
List of
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
Partial DataObj input
Returns
Expand Down Expand Up @@ -163,19 +162,19 @@ def combine(colAttrs, accum):
return DataObjCollection(collection)

@classmethod
def determineEncoding(cls, dobj: lux.dataObj.DataObj):
def determineEncoding(cls, dobj):
'''
Populates DataObject with the appropriate mark type and channel information based on ShowMe logic
Currently support up to 3 dimensions or measures
Parameters
----------
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
DataObj input
Returns
-------
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
output DataObj with `mark` and `channel` specified
Notes
Expand Down Expand Up @@ -287,20 +286,20 @@ def lineOrBar(dimension, measure):
return dobj

@staticmethod
def enforceSpecifiedChannel(dobj:lux.dataObj.DataObj, autoChannel: Dict[str,str]):
def enforceSpecifiedChannel(dobj, autoChannel: Dict[str,str]):
"""
Enforces that the channels specified in the DataObj by users overrides the showMe autoChannels
Parameters
----------
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
Input DataObject without channel specification
autoChannel : Dict[str,str]
Key-value pair in the form [channel: attributeName] specifying the showMe recommended channel location
Returns
-------
dobj : lux.dataObj.DataObj
dobj : lux.dataObj.dataObj.DataObj
Input DataObject with channel specification combining both original and autoChannel specification
Raises
Expand Down

0 comments on commit 5be6ac8

Please sign in to comment.