-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored app and added some charts
- Loading branch information
Showing
3 changed files
with
133 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from datetime import datetime | ||
from typing import NamedTuple | ||
|
||
import pandas as pd | ||
|
||
|
||
class DatasetStats(NamedTuple): | ||
query: str | ||
min_opened_date: datetime | ||
max_opened_date: datetime | ||
|
||
|
||
class StatsForYear(NamedTuple): | ||
query: str | None | ||
number_of_changesets: int | None | ||
number_of_unique_users: int | None | ||
number_of_object_changes: int | None | ||
number_of_comments: int | None | ||
|
||
|
||
class DataFrameResult(NamedTuple): | ||
query: str | ||
df: pd.DataFrame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def get_delta(current_value: int, previous_value: int | None) -> str | None: | ||
if previous_value is None: | ||
return None | ||
return f"{(current_value - previous_value):+,d}" | ||
|
||
|
||
def stringify(path: str) -> str: | ||
return f"'{path}'" | ||
|
||
|
||
def paths_for_years(start_year: int, end_year: int, url_template: str) -> list[str]: | ||
return [stringify(url_template.format(year=year)) for year in range(start_year, end_year + 1)] |