Skip to content

Commit

Permalink
bug fix eliminating Record field in Actions, make ViewCollection not …
Browse files Browse the repository at this point in the history
…list
  • Loading branch information
dorisjlee committed Jun 17, 2020
1 parent b7bf294 commit 7a46ba8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lux/action/Enhance.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def enhance(ldf):
filters = utils.getFilterSpecs(ldf.context)
output = []
# Collect variables that already exist in the context
context = utils.getAttrsSpecs(ldf.context)
context = list(filter(lambda x: x.value=="" and x.attribute!="Record", ldf.context))
# context = [spec for spec in context if isinstance(spec.attribute,str)]
existingVars = [spec.attribute for spec in context]
# if we too many column attributes, return no views.
Expand Down
4 changes: 1 addition & 3 deletions lux/action/Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ def filter(ldf):
#creates new data objects with new filters
for i in range(0, len(uniqueValues)):
if uniqueValues[i] not in filterValues:
#create new Data Object
newSpec = columnSpec.copy()
newFilter = lux.Spec(attribute = row.attribute, value = uniqueValues[i])
newSpec.append(newFilter)
tempView = View(newSpec)
completedFilters.append(row.attribute)
output.append(tempView)
#if Row is not specified, create filters using unique values from all categorical variables in the dataset
else:
else: #if no existing filters, create filters using unique values from all categorical variables in the dataset
categoricalVars = []
for col in list(ldf.columns):
# if cardinality is not too high, and attribute is not one of the X,Y (specified) column
Expand Down
2 changes: 1 addition & 1 deletion lux/action/Generalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def generalize(ldf):
"description":"Remove one attribute or filter to observe a more general trend."}
output = []
excludedColumns = []
columnSpec = utils.getAttrsSpecs(ldf.context)
columnSpec = list(filter(lambda x: x.value=="" and x.attribute!="Record", ldf.context))
rowSpecs = utils.getFilterSpecs(ldf.context)
# if we do no have enough column attributes or too many, return no views.
if(len(columnSpec)<2 or len(columnSpec)>4):
Expand Down
2 changes: 1 addition & 1 deletion lux/view/ViewCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def load(self, ldf) -> ViewCollection:
for view in self.collection:
view.specLst = Parser.parse(view.specLst)
Validator.validateSpec(view.specLst,ldf)
vc = Compiler.compile(ldf,ldf.context,self.collection,enumerateCollection=False)
vc = Compiler.compile(ldf,ldf.context,self,enumerateCollection=False)
else:
self.specLst = Parser.parse(self.specLst)
Validator.validateSpec(self.specLst,ldf)
Expand Down

0 comments on commit 7a46ba8

Please sign in to comment.