Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e2ad2da
Added initial files structure
Ibraam-Nashaat Jun 5, 2025
7270b74
Modified env.py to deal with hypertables
Ibraam-Nashaat Jun 8, 2025
1ea5fac
Modified index creation in env.py
Ibraam-Nashaat Jun 8, 2025
63c6680
Cleaned the files and added comments
Ibraam-Nashaat Jun 12, 2025
caa7100
Added documentation files
Ibraam-Nashaat Jun 12, 2025
cf1ef6d
Added license file
Ibraam-Nashaat Jun 12, 2025
48b0df2
Added more documentation files
Ibraam-Nashaat Jun 12, 2025
dd4324c
Added .env file, removed root path and modified the documentation files
Ibraam-Nashaat Jun 13, 2025
f3af036
Removed .env file
Ibraam-Nashaat Jun 14, 2025
f70ef03
Added database models
Ibraam-Nashaat Jun 16, 2025
999663d
Added more database models
Ibraam-Nashaat Jun 16, 2025
d1af5ad
Completed hegemony cone endpoint
Ibraam-Nashaat Jun 19, 2025
f668e60
Fixed foreign keys errors in models
Ibraam-Nashaat Jun 19, 2025
5ff2a66
Added missing indexes to models
Ibraam-Nashaat Jun 19, 2025
4379d01
Merge remote-tracking branch 'upstream/main' into database-models
Ibraam-Nashaat Jun 19, 2025
975d2ee
Untracked migration files
Ibraam-Nashaat Jun 23, 2025
6ad10dd
Renamed to hegemony_cone.py and added alembic/versions to gitignore
Ibraam-Nashaat Jun 23, 2025
7e92667
Returned some id(primary key) of tables back from BigInteger to Integer
Ibraam-Nashaat Jun 25, 2025
1a4b713
Removed foreign key constraints from some models
Ibraam-Nashaat Jun 25, 2025
df9d065
Completed merge
Ibraam-Nashaat Jun 25, 2025
92c6428
Added networks-endpoint
Ibraam-Nashaat Jun 25, 2025
337759e
Merge branch 'InternetHealthReport:main' into networks-endpoint
Ibraam-Nashaat Jun 27, 2025
bb3e0d3
Added link-delay endpoint
Ibraam-Nashaat Jun 29, 2025
d5867d3
Merge remote-tracking branch 'upstream/main' into link-delay-endpoint
Ibraam-Nashaat Jul 3, 2025
58ef29b
Added link-forwarding endpoint
Ibraam-Nashaat Jul 3, 2025
bad1113
Added /network_delay/locaions endpoint
Ibraam-Nashaat Jul 3, 2025
2f6bfe3
Added /metis/atlas/deployment endpoint
Ibraam-Nashaat Jul 3, 2025
526f316
Added /network_delay endpoint
Ibraam-Nashaat Jul 9, 2025
f7e0068
Added /network_delay/alarms endpoint
Ibraam-Nashaat Jul 9, 2025
23949e1
Change _lte and _gte in controller to __lte and __gte
Ibraam-Nashaat Jul 9, 2025
9bf2ffc
Added /metis/atlas/selection endpoint
Ibraam-Nashaat Jul 9, 2025
74f8bea
Added link/delay/alarms endpoint
Ibraam-Nashaat Jul 14, 2025
f1aede6
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Jul 14, 2025
33a6a4c
Removed link endpoints
Ibraam-Nashaat Jul 14, 2025
6b17dfe
Added /tr-hegemony endpoint
Ibraam-Nashaat Jul 14, 2025
3c56730
Added /disco/events endpoint
Ibraam-Nashaat Jul 14, 2025
a62fda6
Added /hegemony/alarms endpoints
Ibraam-Nashaat Jul 14, 2025
d7cff0f
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Jul 15, 2025
e8eb6b9
Merge branch 'hegemony-alarms-endpoint' of github.com:Ibraam-Nashaat/…
Ibraam-Nashaat Jul 15, 2025
b96500d
Added /hegemony/countries endpoint
Ibraam-Nashaat Jul 15, 2025
8905a2d
Added /hegemony endpoint
Ibraam-Nashaat Jul 15, 2025
5233743
Added /hegemony/prefixes endpoint
Ibraam-Nashaat Jul 15, 2025
2d04bbe
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Jul 16, 2025
65cdd04
Merge branch 'hegemony-prefix-endpoint' of github.com:Ibraam-Nashaat/…
Ibraam-Nashaat Jul 16, 2025
0554319
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Jul 23, 2025
51e7cc9
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Jul 25, 2025
b321230
Added page size ti .env file
Ibraam-Nashaat Jul 25, 2025
8eefb6a
Return recent results in all endpoints when timebin fields are not pr…
Ibraam-Nashaat Aug 6, 2025
d418b75
Updated readme
Ibraam-Nashaat Aug 6, 2025
dc1b335
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Aug 19, 2025
a49e79b
Updated allowed CORS origins
Ibraam-Nashaat Aug 19, 2025
bcd8e8c
Increase version
Ibraam-Nashaat Aug 19, 2025
ba70b06
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Aug 25, 2025
f07135f
Added data-migration.md
Ibraam-Nashaat Aug 25, 2025
1a69bb9
Fixed main.py
Ibraam-Nashaat Aug 25, 2025
075d4b4
Modified data_migration.md
Ibraam-Nashaat Aug 25, 2025
c180ee1
Merge remote-tracking branch 'upstream/main'
Ibraam-Nashaat Sep 28, 2025
a0c3185
Optimized indexes and performed eager loading of data
Ibraam-Nashaat Oct 4, 2025
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
2 changes: 1 addition & 1 deletion alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def create_hypertable_ops(table_name, hypertable_meta, is_existing=False):

# Create hypertable SQL
hypertable_sql = (
f"SELECT create_hypertable('{table_name}', by_range('{time_col}', INTERVAL '{chunk_interval}'));"
f"SELECT create_hypertable('{table_name}', by_range('{time_col}', INTERVAL '{chunk_interval}'),create_default_indexes => false);"
)

upgrade_ops.append(ops.ExecuteSQLOp(hypertable_sql))
Expand Down
2 changes: 1 addition & 1 deletion models/atlas_delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AtlasDelay(Base):
__tablename__ = 'ihr_atlas_delay'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/atlas_delay_alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AtlasDelayAlarms(Base):
__tablename__ = 'ihr_atlas_delay_alarms'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/atlas_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AtlasLocation(Base):
__indexes__ = [
{
'name': 'ihr_atlas_location_af_name_type_idx',
'columns': ['af', 'name','type'],
'columns': ['af','type'],
},]
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(
Expand Down
2 changes: 1 addition & 1 deletion models/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Delay(Base):
__tablename__ = 'ihr_delay'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/delay_alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DelayAlarms(Base):
__tablename__ = 'ihr_delay_alarms'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__indexes__ = [
Expand Down
2 changes: 1 addition & 1 deletion models/forwarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Forwarding(Base):
__tablename__ = 'ihr_forwarding'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/forwarding_alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ForwardingAlarms(Base):
__tablename__ = 'ihr_forwarding_alarms'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__indexes__ = [
Expand Down
2 changes: 1 addition & 1 deletion models/hegemony.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Hegemony(Base):
__tablename__ = 'ihr_hegemony'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/hegemony_alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HegemonyAlarms(Base):
__tablename__ = 'ihr_hegemony_alarms'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/hegemony_cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class HegemonyCone(Base):
__tablename__ = 'ihr_hegemonycone'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__indexes__ = [
Expand Down
2 changes: 1 addition & 1 deletion models/hegemony_country.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HegemonyCountry(Base):
__tablename__ = 'ihr_hegemony_country'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/hegemony_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HegemonyPrefix(Base):
__tablename__ = 'ihr_hegemony_prefix'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/metis_atlas_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MetisAtlasDeployment(Base):
__tablename__ = 'ihr_metis_atlas_deployment'

__table_args__ = (
PrimaryKeyConstraint('id','timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/metis_atlas_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MetisAtlasSelection(Base):
__tablename__ = 'ihr_metis_atlas_selection'

__table_args__ = (
PrimaryKeyConstraint('id','timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
2 changes: 1 addition & 1 deletion models/tr_hegemony.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TRHegemony(Base):
__tablename__ = 'ihr_tr_hegemony'

__table_args__ = (
PrimaryKeyConstraint('id', 'timebin'),
PrimaryKeyConstraint('timebin','id'),
)

__hypertable__ = {
Expand Down
8 changes: 6 additions & 2 deletions repositories/atlas_delay_alarms_repository.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sqlalchemy.orm import Session, aliased
from sqlalchemy.orm import Session, aliased, contains_eager
from sqlalchemy import and_, or_
from models.atlas_delay_alarms import AtlasDelayAlarms
from datetime import datetime
Expand Down Expand Up @@ -37,7 +37,11 @@ def get_alarms(

query = db.query(AtlasDelayAlarms)\
.join(Startpoint, AtlasDelayAlarms.startpoint_relation)\
.join(Endpoint, AtlasDelayAlarms.endpoint_relation)
.join(Endpoint, AtlasDelayAlarms.endpoint_relation)\
.options(
contains_eager(AtlasDelayAlarms.startpoint_relation, alias=Startpoint),
contains_eager(AtlasDelayAlarms.endpoint_relation, alias=Endpoint)
)


# If no time filters specified, get rows with max timebin
Expand Down
8 changes: 6 additions & 2 deletions repositories/atlas_delay_repository.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sqlalchemy.orm import Session, aliased
from sqlalchemy.orm import Session, aliased, contains_eager
from sqlalchemy import and_, or_
from models.atlas_delay import AtlasDelay
from datetime import datetime
Expand Down Expand Up @@ -40,7 +40,11 @@ def get_delays(

query = db.query(AtlasDelay)\
.join(Startpoint, AtlasDelay.startpoint_relation)\
.join(Endpoint, AtlasDelay.endpoint_relation)
.join(Endpoint, AtlasDelay.endpoint_relation)\
.options(
contains_eager(AtlasDelay.startpoint_relation, alias=Startpoint),
contains_eager(AtlasDelay.endpoint_relation, alias=Endpoint)
)


# If no time filters specified, get rows with max timebin
Expand Down
13 changes: 11 additions & 2 deletions repositories/hegemony_alarms_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from sqlalchemy.orm import Session
from sqlalchemy.orm import Session, aliased, contains_eager
from models.hegemony_alarms import HegemonyAlarms
from typing import Optional, List, Tuple
from utils import page_size
Expand All @@ -20,7 +20,16 @@ def get_all(
page: int = 1,
order_by: Optional[str] = None
) -> Tuple[List[HegemonyAlarms], int]:
query = db.query(HegemonyAlarms)
ASN = aliased(HegemonyAlarms.asn_relation.property.mapper.class_)
OriginASN = aliased(HegemonyAlarms.originasn_relation.property.mapper.class_)

query = db.query(HegemonyAlarms)\
.join(ASN, HegemonyAlarms.asn_relation)\
.join(OriginASN, HegemonyAlarms.originasn_relation)\
.options(
contains_eager(HegemonyAlarms.asn_relation, alias=ASN),
contains_eager(HegemonyAlarms.originasn_relation, alias=OriginASN)
)

# If no time filters specified, get rows with max timebin
if not timebin_gte and not timebin_lte:
Expand Down
10 changes: 8 additions & 2 deletions repositories/hegemony_country_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from sqlalchemy.orm import Session
from sqlalchemy.orm import Session, contains_eager, aliased
from models.hegemony_country import HegemonyCountry
from typing import Optional, List, Tuple
from utils import page_size
Expand All @@ -23,7 +23,13 @@ def get_all(
page: int = 1,
order_by: Optional[str] = None
) -> Tuple[List[HegemonyCountry], int]:
query = db.query(HegemonyCountry)
ASN = aliased(HegemonyCountry.asn_relation.property.mapper.class_)

query = db.query(HegemonyCountry)\
.join(ASN, HegemonyCountry.asn_relation)\
.options(
contains_eager(HegemonyCountry.asn_relation, alias=ASN),
)

# If no time filters specified, get rows with max timebin
if not timebin_gte and not timebin_lte:
Expand Down
13 changes: 11 additions & 2 deletions repositories/hegemony_prefix_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from sqlalchemy.orm import Session
from sqlalchemy.orm import Session, contains_eager, aliased
from models.hegemony_prefix import HegemonyPrefix
from typing import Optional, List, Tuple
from utils import page_size
Expand Down Expand Up @@ -28,8 +28,17 @@ def get_all(
page: int = 1,
order_by: Optional[str] = None
) -> Tuple[List[HegemonyPrefix], int]:
query = db.query(HegemonyPrefix)

ASN = aliased(HegemonyPrefix.asn_relation.property.mapper.class_)
OriginASN = aliased(HegemonyPrefix.originasn_relation.property.mapper.class_)

query = db.query(HegemonyPrefix)\
.join(ASN, HegemonyPrefix.asn_relation)\
.join(OriginASN, HegemonyPrefix.originasn_relation)\
.options(
contains_eager(HegemonyPrefix.asn_relation, alias=ASN),
contains_eager(HegemonyPrefix.originasn_relation, alias=OriginASN)
)
# If no time filters specified, get rows with max timebin
if not timebin_gte and not timebin_lte:
max_timebin = db.query(func.max(HegemonyPrefix.timebin)).scalar()
Expand Down
16 changes: 13 additions & 3 deletions repositories/hegemony_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from sqlalchemy.orm import Session
from sqlalchemy.orm import Session, contains_eager, aliased
from models.hegemony import Hegemony
from typing import Optional, List, Tuple
from utils import page_size
Expand All @@ -21,8 +21,18 @@ def get_all(
page: int = 1,
order_by: Optional[str] = None
) -> Tuple[List[Hegemony], int]:
query = db.query(Hegemony)


ASN = aliased(Hegemony.asn_relation.property.mapper.class_)
OriginASN = aliased(Hegemony.originasn_relation.property.mapper.class_)

query = db.query(Hegemony)\
.join(ASN, Hegemony.asn_relation)\
.join(OriginASN, Hegemony.originasn_relation)\
.options(
contains_eager(Hegemony.asn_relation, alias=ASN),
contains_eager(Hegemony.originasn_relation, alias=OriginASN)
)

# If no time filters specified, get rows with max timebin
if not timebin_gte and not timebin_lte:
max_timebin = db.query(func.max(Hegemony.timebin)).scalar()
Expand Down
7 changes: 4 additions & 3 deletions repositories/metis_atlas_deployment_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from sqlalchemy.orm import Session
from sqlalchemy.orm import Session, contains_eager
from models.metis_atlas_deployment import MetisAtlasDeployment
from typing import Optional, List, Tuple
from utils import page_size
Expand All @@ -21,8 +21,9 @@ def get_all(
page: int = 1,
order_by: Optional[str] = None
) -> Tuple[List[MetisAtlasDeployment], int]:
query = db.query(MetisAtlasDeployment).join(
MetisAtlasDeployment.asn_relation)
query = db.query(MetisAtlasDeployment)\
.join(MetisAtlasDeployment.asn_relation)\
.options(contains_eager(MetisAtlasDeployment.asn_relation))

# If no time filters specified, get rows with max timebin
if not timebin and not timebin_gte and not timebin_lte:
Expand Down
7 changes: 4 additions & 3 deletions repositories/metis_atlas_selection_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from sqlalchemy.orm import Session
from sqlalchemy.orm import Session, contains_eager
from models.metis_atlas_selection import MetisAtlasSelection
from typing import Optional, List, Tuple
from utils import page_size
Expand All @@ -21,8 +21,9 @@ def get_all(
page: int = 1,
order_by: Optional[str] = None
) -> Tuple[List[MetisAtlasSelection], int]:
query = db.query(MetisAtlasSelection).join(
MetisAtlasSelection.asn_relation)
query = db.query(MetisAtlasSelection)\
.join(MetisAtlasSelection.asn_relation)\
.options(contains_eager(MetisAtlasSelection.asn_relation))

# If no time filters specified, get rows with max timebin
if not timebin and not timebin_gte and not timebin_lte:
Expand Down
8 changes: 6 additions & 2 deletions repositories/tr_hegemony_repository.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sqlalchemy.orm import Session, aliased
from sqlalchemy.orm import Session, aliased, contains_eager
from sqlalchemy import and_, or_
from models.tr_hegemony import TRHegemony
from datetime import datetime
Expand Down Expand Up @@ -34,7 +34,11 @@ def get_tr_hegemony(

query = db.query(TRHegemony)\
.join(Origin, TRHegemony.origin_relation)\
.join(Dependency, TRHegemony.dependency_relation)
.join(Dependency, TRHegemony.dependency_relation)\
.options(
contains_eager(TRHegemony.origin_relation, alias=Origin),
contains_eager(TRHegemony.dependency_relation, alias=Dependency)
)

# If no time filters specified, get rows with max timebin
if not timebin and not timebin_gte and not timebin_lte:
Expand Down