diff --git a/src/connectors/example/enum.py b/src/connectors/example/enum.py new file mode 100644 index 00000000..cca0cb19 --- /dev/null +++ b/src/connectors/example/enum.py @@ -0,0 +1,88 @@ +""" +Enum connectors for populating taxonomy and enumeration data in the AIOD database. + +This module provides connectors for various enumeration types used throughout +the AIOD platform, such as application areas, resource types, event modes, etc. +""" + +import pathlib +from typing import Type, TypeVar + +from connectors.example.example_connector import ExampleConnector +from database.model.named_relation import NamedRelation + +T = TypeVar('T', bound=NamedRelation) + +ENUM_RESOURCE_PATH = pathlib.Path(__file__).parent / "resources" / "enum" + + +class BaseEnumConnector(ExampleConnector[T]): + """Base class for enum connectors that load enumeration data from JSON files.""" + + def __init__(self, enum_filename: str, enum_class: Type[T]): + json_path = ENUM_RESOURCE_PATH / f"{enum_filename}.json" + super().__init__(json_path, enum_class) + + +class EnumConnectorApplicationArea(BaseEnumConnector): + """Connector for application area enumeration data.""" + + def __init__(self): + from database.model.concept.application_area import ApplicationArea + super().__init__("application_areas", ApplicationArea) + + +class EnumConnectorEducationalResourceType(BaseEnumConnector): + """Connector for educational resource type enumeration data.""" + + def __init__(self): + from database.model.concept.educational_resource_type import EducationalResourceType + super().__init__("educational_resource_types", EducationalResourceType) + + +class EnumConnectorEventMode(BaseEnumConnector): + """Connector for event mode enumeration data.""" + + def __init__(self): + from database.model.concept.event_mode import EventMode + super().__init__("event_modes", EventMode) + + +class EnumConnectorEventStatus(BaseEnumConnector): + """Connector for event status enumeration data.""" + + def __init__(self): + from database.model.concept.event_status import EventStatus + super().__init__("event_statuses", EventStatus) + + +class EnumConnectorLanguage(BaseEnumConnector): + """Connector for language enumeration data.""" + + def __init__(self): + from database.model.concept.language import Language + super().__init__("languages", Language) + + +class EnumConnectorLicense(BaseEnumConnector): + """Connector for license enumeration data.""" + + def __init__(self): + from database.model.concept.license import License + super().__init__("licenses", License) + + +class EnumConnectorOrganisationType(BaseEnumConnector): + """Connector for organisation type enumeration data.""" + + def __init__(self): + from database.model.concept.organisation_type import OrganisationType + super().__init__("organisation_types", OrganisationType) + + +class EnumConnectorNewsCategory(BaseEnumConnector): + """Connector for news category enumeration data.""" + + def __init__(self): + from database.model.concept.news_category import NewsCategory + super().__init__("news_categories", NewsCategory) diff --git a/src/connectors/example/resources/enum/application_areas.json b/src/connectors/example/resources/enum/application_areas.json new file mode 100644 index 00000000..9d6555e9 --- /dev/null +++ b/src/connectors/example/resources/enum/application_areas.json @@ -0,0 +1,22 @@ +[ + { + "name": "machine learning", + "definition": "Applications involving machine learning algorithms and techniques", + "official": true + }, + { + "name": "natural language processing", + "definition": "Applications focused on processing and understanding human language", + "official": true + }, + { + "name": "computer vision", + "definition": "Applications involving image and video analysis", + "official": true + }, + { + "name": "robotics", + "definition": "Applications in robotics and autonomous systems", + "official": true + } +] diff --git a/src/connectors/example/resources/enum/educational_resource_types.json b/src/connectors/example/resources/enum/educational_resource_types.json new file mode 100644 index 00000000..6614f6e3 --- /dev/null +++ b/src/connectors/example/resources/enum/educational_resource_types.json @@ -0,0 +1,22 @@ +[ + { + "name": "course", + "definition": "A structured educational program or series of lessons", + "official": true + }, + { + "name": "tutorial", + "definition": "Step-by-step instructional content", + "official": true + }, + { + "name": "documentation", + "definition": "Technical documentation and guides", + "official": true + }, + { + "name": "video", + "definition": "Video-based educational content", + "official": true + } +] diff --git a/src/connectors/example/resources/enum/event_modes.json b/src/connectors/example/resources/enum/event_modes.json new file mode 100644 index 00000000..06657360 --- /dev/null +++ b/src/connectors/example/resources/enum/event_modes.json @@ -0,0 +1,17 @@ +[ + { + "name": "online", + "definition": "Virtual events conducted over the internet", + "official": true + }, + { + "name": "offline", + "definition": "In-person events at physical locations", + "official": true + }, + { + "name": "hybrid", + "definition": "Events combining both online and offline participation", + "official": true + } +] diff --git a/src/connectors/example/resources/enum/event_statuses.json b/src/connectors/example/resources/enum/event_statuses.json new file mode 100644 index 00000000..24eeed2f --- /dev/null +++ b/src/connectors/example/resources/enum/event_statuses.json @@ -0,0 +1,22 @@ +[ + { + "name": "upcoming", + "definition": "Events scheduled for the future", + "official": true + }, + { + "name": "ongoing", + "definition": "Events currently taking place", + "official": true + }, + { + "name": "completed", + "definition": "Events that have finished", + "official": true + }, + { + "name": "cancelled", + "definition": "Events that have been cancelled", + "official": true + } +] diff --git a/src/connectors/example/resources/enum/languages.json b/src/connectors/example/resources/enum/languages.json new file mode 100644 index 00000000..cbe18919 --- /dev/null +++ b/src/connectors/example/resources/enum/languages.json @@ -0,0 +1,27 @@ +[ + { + "name": "english", + "definition": "English language", + "official": true + }, + { + "name": "german", + "definition": "German language", + "official": true + }, + { + "name": "french", + "definition": "French language", + "official": true + }, + { + "name": "spanish", + "definition": "Spanish language", + "official": true + }, + { + "name": "italian", + "definition": "Italian language", + "official": true + } +] diff --git a/src/connectors/example/resources/enum/licenses.json b/src/connectors/example/resources/enum/licenses.json new file mode 100644 index 00000000..2dd41762 --- /dev/null +++ b/src/connectors/example/resources/enum/licenses.json @@ -0,0 +1,27 @@ +[ + { + "name": "mit", + "definition": "MIT License - permissive open source license", + "official": true + }, + { + "name": "apache-2.0", + "definition": "Apache License 2.0 - permissive open source license", + "official": true + }, + { + "name": "gpl-3.0", + "definition": "GNU General Public License v3.0 - copyleft license", + "official": true + }, + { + "name": "bsd-3-clause", + "definition": "BSD 3-Clause License - permissive open source license", + "official": true + }, + { + "name": "cc-by-4.0", + "definition": "Creative Commons Attribution 4.0 International", + "official": true + } +] diff --git a/src/connectors/example/resources/enum/news_categories.json b/src/connectors/example/resources/enum/news_categories.json new file mode 100644 index 00000000..982be343 --- /dev/null +++ b/src/connectors/example/resources/enum/news_categories.json @@ -0,0 +1,27 @@ +[ + { + "name": "research", + "definition": "News related to research developments and findings", + "official": true + }, + { + "name": "technology", + "definition": "Technology-related news and updates", + "official": true + }, + { + "name": "events", + "definition": "Announcements and coverage of events", + "official": true + }, + { + "name": "funding", + "definition": "News about funding opportunities and grants", + "official": true + }, + { + "name": "partnerships", + "definition": "News about collaborations and partnerships", + "official": true + } +] diff --git a/src/connectors/example/resources/enum/organisation_types.json b/src/connectors/example/resources/enum/organisation_types.json new file mode 100644 index 00000000..9914d1a0 --- /dev/null +++ b/src/connectors/example/resources/enum/organisation_types.json @@ -0,0 +1,27 @@ +[ + { + "name": "university", + "definition": "Academic institution providing higher education", + "official": true + }, + { + "name": "research institute", + "definition": "Organization focused on research activities", + "official": true + }, + { + "name": "company", + "definition": "Commercial business organization", + "official": true + }, + { + "name": "non-profit", + "definition": "Non-profit organization", + "official": true + }, + { + "name": "government", + "definition": "Government agency or department", + "official": true + } +]