Skip to content

Commit

Permalink
Merge pull request #477 from georgetown-cset/475-filter-null-parents
Browse files Browse the repository at this point in the history
Filter null parents
  • Loading branch information
brianlove authored Jul 9, 2024
2 parents 792fe24 + 606a0b6 commit 365bf6d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion company_linkage/parat_scripts/aggregate_organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def get_parents(self):
organizations = query_job.result()
for organization in organizations:
for par in organization.parent:
if par["parent_id"] and par["parent_id"] != organization["CSET_id"]:
null_parent = not (par["parent_id"] and par["parent_name"])
if not null_parent and (par["parent_id"] != organization["CSET_id"]):
self.parent_names[par["parent_id"]] = par["parent_name"]
self.full_aggregate_child_to_parent[organization["CSET_id"]].append(par["parent_id"])
# we don't want to create a child-to-parent link if our child shouldn't be rolled up
Expand Down
8 changes: 4 additions & 4 deletions web/gui-v2/src/components/ListView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ describe("ListView", () => {
);

// Filter by China and verify that the count updates
expect(screen.getByText('Viewing 683 companies')).toBeVisible();
expect(screen.getByText('Viewing 691 companies')).toBeVisible();
const regionHeader = screen.getByRole('columnheader', { name: /country/i });
await user.click(getByRole(regionHeader, 'button', { name: /open/i }));
const menu = screen.getByRole('listbox');
await user.click(getByText(menu, 'China'));
expect(screen.getByText('Viewing 43 of 683 companies')).toBeVisible();
expect(screen.getByText('Viewing 43 of 691 companies')).toBeVisible();

// Reset the filters and verify that the count updates
await user.click(screen.getByRole('button', { name: /reset filters/i }));
expect(screen.getByText('Viewing 683 companies')).toBeVisible();
expect(screen.getByText('Viewing 691 companies')).toBeVisible();
}, 20000);


Expand All @@ -49,7 +49,7 @@ describe("ListView", () => {
await user.click(getByRole(companyHeader, 'combobox'));
const menu = screen.getByRole('listbox');
await user.click(getByText(menu, 'S&P 500'));
expect(screen.getByText('Viewing 496 of 683 companies')).toBeVisible();
expect(screen.getByText('Viewing 500 of 691 companies')).toBeVisible();
}, 20000);


Expand Down
2 changes: 1 addition & 1 deletion web/gui-v2/src/data/companies.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/gui-v2/src/static_data/data.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/gui-v2/src/static_data/overall_data.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/raw_data/sectors.jsonl

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions web/scripts/retrieve_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
METRIC_LISTS = [ARTICLE_METRICS, PATENT_METRICS, OTHER_METRICS]

_curr_time = datetime.now()
CURRENT_YEAR = _curr_time.year if _curr_time.month > 6 else _curr_time.year - 1
CURRENT_YEAR = _curr_time.year - 1
ARTICLE_OFFSET = 2
PATENT_OFFSET = 3
GROWTH_INTERVAL = 3
Expand Down Expand Up @@ -314,7 +314,7 @@ def clean_parent(parents: list, lowercase_to_orig_cname: dict) -> str:
return None
cleaned_parents = [clean_company_name(parent["parent_name"], lowercase_to_orig_cname)+
(" (Acquired)" if parent["parent_acquisition"] else "")
for parent in parents]
for parent in parents if parent["parent_name"]]
return ", ".join(cleaned_parents)


Expand Down

0 comments on commit 365bf6d

Please sign in to comment.