Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions stage5.3_fuller_application/pycasa/ui/image_folder_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def traits_view(self):
@observe("scan")
def scan_for_faces(self, event):
self.model.compute_num_faces()
self.all_data = self.model.data.copy()
self.all_data.update(self.model.data)

@observe("selected_years")
def update_years(self, event):
Expand All @@ -117,23 +117,25 @@ def _year_mask_default(self):
return pd.Series(np.ones(len(self.model.data), dtype=bool))

def _all_data_default(self):
# Enrich metadata with missing fields: date time, make
data = self.model.data.copy()

if DATETIME_COL not in data.columns:
data[DATETIME_COL] = np.nan

if MAKE_COL not in data.columns:
data[MAKE_COL] = np.nan

def parse_year(x):
return x.split(":")[0] if isinstance(x, str) else "unknown"
data[YEAR_KEY] = data[DATETIME_COL].apply(parse_year)

Comment on lines +129 to +132
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary to fix the bug but I accidentally included it in this commit. I'll let it be here because all missing columns are now added in one place so it's slightly easier to follow.

return data

def _filtered_data_default(self):
return self.all_data

def _all_years_default(self):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and filtered_data could be properties, but this is OK too.

def parse_year(x):
return x.split(":")[0] if isinstance(x, str) else "unknown"

self.all_data[YEAR_KEY] = self.all_data[DATETIME_COL].apply(parse_year)
return sorted(self.all_data[YEAR_KEY].unique().tolist())


Expand Down