diff --git a/db/eolas.db b/db/eolas.db index 7d9c76e..2b33bbf 100644 Binary files a/db/eolas.db and b/db/eolas.db differ diff --git a/out/eolas-graph.json b/out/eolas-graph.json index 47d2d82..07e3a34 100644 --- a/out/eolas-graph.json +++ b/out/eolas-graph.json @@ -289,7 +289,11 @@ "type": "tag" }, { - "id": "#ecosolpoc", + "id": "#sound", + "type": "tag" + }, + { + "id": "#analogue", "type": "tag" }, { @@ -304,10 +308,6 @@ "id": "#number-theory", "type": "tag" }, - { - "id": "#analogue", - "type": "tag" - }, { "id": "#file-system", "type": "tag" @@ -344,10 +344,6 @@ "id": "#kernel", "type": "tag" }, - { - "id": "#sound", - "type": "tag" - }, { "id": "#theory-of-computation", "type": "tag" @@ -436,6 +432,14 @@ "id": "653c0b1d_host_protocols_of_ARPANET", "type": "entry" }, + { + "id": "738d0481_sound_recording_as_wave_phenomena", + "type": "entry" + }, + { + "id": "747589ad_effects_of_privacy_violation", + "type": "entry" + }, { "id": "82f9c228_dissolution_of_ARPANET", "type": "entry" @@ -1252,6 +1256,10 @@ "id": "Hexadecimal_number_system", "type": "entry" }, + { + "id": "ICMP_Protocol", + "type": "entry" + }, { "id": "IP_addresses", "type": "entry" @@ -1548,6 +1556,10 @@ "id": "MongoDB_connection", "type": "entry" }, + { + "id": "Monitor_DNS_resolution_and_internet_connectivity_script", + "type": "entry" + }, { "id": "Monitoring_processes_and_resources", "type": "entry" @@ -1608,10 +1620,6 @@ "id": "Network_card", "type": "entry" }, - { - "id": "Network_debugging", - "type": "entry" - }, { "id": "Network_fundamentals", "type": "entry" @@ -1708,6 +1716,10 @@ "id": "Peer_to_peer_network", "type": "entry" }, + { + "id": "Ping", + "type": "entry" + }, { "id": "Ports_in_NodeJS", "type": "entry" @@ -1848,6 +1860,10 @@ "id": "Reciprocals", "type": "entry" }, + { + "id": "Recording_and_playback_of_sound", + "type": "entry" + }, { "id": "Recursion", "type": "entry" @@ -2276,6 +2292,10 @@ "id": "Variables_in_C", "type": "entry" }, + { + "id": "View_IP_addresses", + "type": "entry" + }, { "id": "Viewing_remote_changes_without_merging", "type": "entry" @@ -2850,6 +2870,14 @@ "source": "#nand-to-tetris", "target": "Hardware_Description_Language" }, + { + "source": "#networks", + "target": "Monitor_DNS_resolution_and_internet_connectivity_script" + }, + { + "source": "#procedural", + "target": "Monitor_DNS_resolution_and_internet_connectivity_script" + }, { "source": "#javascript", "target": "React_useReducer" @@ -3130,6 +3158,10 @@ "source": "#javascript", "target": "Map_and_filter_to_reduce_in_JS" }, + { + "source": "#networks", + "target": "ICMP_Protocol" + }, { "source": "#AWS", "target": "Accessing_secrets_from_a_Lambda" @@ -3523,7 +3555,7 @@ "target": "Weaving_the_Web_Berners_Lee" }, { - "source": "#ecosolpoc", + "source": "#ecopolsoc", "target": "Weaving_the_Web_Berners_Lee" }, { @@ -3542,6 +3574,18 @@ "source": "#internet", "target": "Architecture_of_the_World_Wide_Web" }, + { + "source": "#sound", + "target": "Binary_encoding_of_sound" + }, + { + "source": "#binary", + "target": "Binary_encoding_of_sound" + }, + { + "source": "#analogue", + "target": "Binary_encoding_of_sound" + }, { "source": "#mongo-db", "target": "Modelling_relationships_in_MongoDB" @@ -4374,6 +4418,18 @@ "source": "#typescript", "target": "Type_guarding_and_narrowing_in_TS" }, + { + "source": "#ecopolsoc", + "target": "747589ad_effects_of_privacy_violation" + }, + { + "source": "#privacy", + "target": "747589ad_effects_of_privacy_violation" + }, + { + "source": "#surveillance-capitalism", + "target": "747589ad_effects_of_privacy_violation" + }, { "source": "#operating-systems", "target": "Processes" @@ -4806,18 +4862,6 @@ "source": "#Turing", "target": "Turing_machines" }, - { - "source": "#procedural", - "target": "Network_debugging" - }, - { - "source": "#Linux", - "target": "Network_debugging" - }, - { - "source": "#networks", - "target": "Network_debugging" - }, { "source": "#systems-programming", "target": "journald" @@ -4982,6 +5026,30 @@ "source": "#binary", "target": "Bitwise_operators" }, + { + "source": "#sound", + "target": "Recording_and_playback_of_sound" + }, + { + "source": "#analogue", + "target": "Recording_and_playback_of_sound" + }, + { + "source": "#physics", + "target": "Recording_and_playback_of_sound" + }, + { + "source": "#networks", + "target": "View_IP_addresses" + }, + { + "source": "#procedural", + "target": "View_IP_addresses" + }, + { + "source": "#Linux", + "target": "View_IP_addresses" + }, { "source": "#propositional-logic", "target": "Logical_indeterminacy" @@ -5274,6 +5342,14 @@ "source": "#computer-history", "target": "e470bf3d_IMPs_in_the_ARPANET" }, + { + "source": "#networks", + "target": "Ping" + }, + { + "source": "#procedural", + "target": "Ping" + }, { "source": "#prealgebra", "target": "Reciprocals" @@ -5610,6 +5686,18 @@ "source": "#databases", "target": "Node_and_MySQL_db" }, + { + "source": "#sound", + "target": "738d0481_sound_recording_as_wave_phenomena" + }, + { + "source": "#analogue", + "target": "738d0481_sound_recording_as_wave_phenomena" + }, + { + "source": "#physics", + "target": "738d0481_sound_recording_as_wave_phenomena" + }, { "source": "#AWS", "target": "Secrets_or_env_vars_in_AWS" @@ -6159,7 +6247,7 @@ "target": "f6564af9_AOL_and_early_internet_enclosure" }, { - "source": "#ecosolpoc", + "source": "#ecopolsoc", "target": "f6564af9_AOL_and_early_internet_enclosure" }, { @@ -6394,6 +6482,10 @@ "source": "Hardware_Description_Language", "target": "Boolean_functions" }, + { + "source": "Monitor_DNS_resolution_and_internet_connectivity_script", + "target": "Ping" + }, { "source": "React_useReducer", "target": "React_useState" @@ -6478,6 +6570,22 @@ "source": "Application_state_management_with_React_hooks", "target": "React_useContext" }, + { + "source": "ICMP_Protocol", + "target": "Internet_Layer_of_Internet_Protocol" + }, + { + "source": "ICMP_Protocol", + "target": "Transport_Layer_of_Internet_Protocol" + }, + { + "source": "ICMP_Protocol", + "target": "Application_Layer_of_Internet_Protocol" + }, + { + "source": "ICMP_Protocol", + "target": "Ping" + }, { "source": "Accessing_secrets_from_a_Lambda", "target": "Fetch_from_Secrets_Manager" @@ -6630,6 +6738,10 @@ "source": "Architecture_of_the_World_Wide_Web", "target": "IP_addresses" }, + { + "source": "Binary_encoding_of_sound", + "target": "Recording_and_playback_of_sound" + }, { "source": "Practical_walkthrough_Lambda_creation_within_AWS", "target": "Lambda_triggers" @@ -7030,10 +7142,6 @@ "source": "Using_GraphQL_with_Node", "target": "Middleware_in_NodeJS" }, - { - "source": "Network_debugging", - "target": "Network_scanning" - }, { "source": "journald", "target": "systemd" @@ -7094,6 +7202,14 @@ "source": "Python_data_types", "target": "Strings_in_Python" }, + { + "source": "Recording_and_playback_of_sound", + "target": "Binary_encoding_of_sound" + }, + { + "source": "View_IP_addresses", + "target": "IP_addresses" + }, { "source": "Magnetic_tape", "target": "The_History_of_Computing_Swade" @@ -7202,10 +7318,6 @@ "source": "Set_DNS_settings", "target": "Network_scanning" }, - { - "source": "Set_DNS_settings", - "target": "Network_debugging" - }, { "source": "Docker_Compose", "target": "Node_and_MySQL_db" @@ -7238,6 +7350,10 @@ "source": "e470bf3d_IMPs_in_the_ARPANET", "target": "Network_fundamentals" }, + { + "source": "Ping", + "target": "ICMP_Protocol" + }, { "source": "Magnetic_drum_memory", "target": "Williams_Tube_memory" diff --git a/src/cli.py b/src/cli.py index 7960048..d7951f7 100644 --- a/src/cli.py +++ b/src/cli.py @@ -23,16 +23,19 @@ def main(): ) parser.add_argument( "command", - choices=["populate-database", "generate-graph"], + choices=["populate-database", "generate-graph", "export-tags"], help="Command to execute", ) args = parser.parse_args() if args.command == "populate-database": - controller.populate_database() + controller.execute("populate") if args.command == "generate-graph": - controller.generate_graph() + controller.execute("graph") + + # if args.command == "export-tags": + # controller.export_tags() if __name__ == "__main__": diff --git a/src/controllers/controller.py b/src/controllers/controller.py index df80f6a..c33b22e 100644 --- a/src/controllers/controller.py +++ b/src/controllers/controller.py @@ -1,30 +1,37 @@ from termcolor import colored + class Controller: def __init__( - self, database_service, table_service, parse_file_service, graph_service + self, + database_service, + table_service, + parse_file_service, + graph_service, + # tag_service, ): self.database_service = database_service self.table_service = table_service self.parse_file_service = parse_file_service self.graph_service = graph_service + # self.tag_service = tag_service - def populate_database(self): + def execute(self, operation): try: - entries = self.parse_file_service.parse_source_directory() - self.table_service.populate_tables(entries) - print(colored("SUCCESS Database populated", "green")) + match operation: + case "populate": + return self.__populate_database() + case "graph": + return self.__generate_graph() except Exception as e: - raise Exception(colored(f"ERROR {e}", "red")) + raise Exception(colored(f"ERROR {e}", "red")) finally: self.database_service.disconnect() - print(colored("INFO Database connection closed", "blue")) - def generate_graph(self): - try: - self.graph_service.generate_graph() - print(colored("SUCCESS Graph generated", "green")) - except Exception as e: - raise Exception(colored(f"ERROR {e}"), "red") - finally: - self.database_service.disconnect() - print(colored("INFO Database connection closed", "blue")) + + def __populate_database(self): + entries = self.parse_file_service.parse_source_directory() + self.table_service.populate_tables(entries) + self.database_service.disconnect() + + def __generate_graph(self): + self.graph_service.generate_graph()