MEDfl 0.1.16__py3-none-any.whl → 0.1.18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,9 @@ import yaml
6
6
  from sklearn.metrics import *
7
7
  from yaml.loader import SafeLoader
8
8
 
9
+
10
+ from Medfl.NetManager.database_connector import DatabaseManager
11
+
9
12
  # from scripts.base import *
10
13
  import json
11
14
 
@@ -21,8 +24,6 @@ import ast
21
24
 
22
25
  from sqlalchemy import text
23
26
 
24
- from Medfl.NetManager.database_connector import DatabaseManager
25
-
26
27
 
27
28
  # Get the directory of the current script
28
29
  current_directory = os.path.dirname(os.path.abspath(__file__))
@@ -42,11 +43,11 @@ with open(yaml_path) as g:
42
43
  DEFAULT_CONFIG_PATH = 'config.ini'
43
44
 
44
45
 
45
- def load_config():
46
+ def load_db_config():
46
47
  config = os.environ.get('MEDFL_DB_CONFIG')
47
48
 
48
49
  if config:
49
- return ast.literal_eval( config )
50
+ return ast.literal_eval(config)
50
51
  else:
51
52
  raise ValueError(f"MEDfl db config not found")
52
53
 
@@ -61,13 +62,9 @@ def set_db_config(config_path):
61
62
  else:
62
63
  raise ValueError(f"mysql key not found in file '{config_path}'")
63
64
 
64
- # set the master dataset path
65
-
66
65
 
67
- def set_masterDataset_path(dataset_path):
68
- os.environ['MEDFL_MASTERDATASET_PATH'] = dataset_path
69
66
 
70
- # Create database
67
+ # Create databas
71
68
 
72
69
 
73
70
  def create_MEDfl_db():
@@ -176,7 +173,7 @@ def empty_db():
176
173
  db_manager = DatabaseManager()
177
174
  db_manager.connect()
178
175
  my_eng = db_manager.get_connection()
179
-
176
+
180
177
  # my_eng.execute(text(f"DELETE FROM {'DataSets'}"))
181
178
  my_eng.execute(text(f"DELETE FROM {'Nodes'}"))
182
179
  my_eng.execute(text(f"DELETE FROM {'FedDatasets'}"))
@@ -303,7 +300,7 @@ def get_pipeline_result(pipeline_id):
303
300
  db_manager = DatabaseManager()
304
301
  db_manager.connect()
305
302
  my_eng = db_manager.get_connection()
306
-
303
+
307
304
  data = pd.read_sql(
308
305
  text(
309
306
  f"SELECT * FROM testResults WHERE pipelineid = '{pipeline_id}'"), my_eng
@@ -4,12 +4,11 @@ from configparser import ConfigParser
4
4
 
5
5
  import subprocess
6
6
 
7
-
8
7
  class DatabaseManager:
9
8
  def __init__(self):
10
9
 
11
- from Medfl.LearningManager.utils import load_config
12
- db_config = load_config()
10
+ from Medfl.LearningManager.utils import load_db_config
11
+ db_config = load_db_config()
13
12
  if db_config:
14
13
  self.config = db_config
15
14
  else:
@@ -18,8 +17,7 @@ class DatabaseManager:
18
17
 
19
18
  def connect(self):
20
19
  if not self.config:
21
- raise ValueError(
22
- "Database configuration not loaded. Use load_config() or set_config_path() first.")
20
+ raise ValueError("Database configuration not loaded. Use load_db_config() or set_config_path() first.")
23
21
  connection_string = (
24
22
  f"mysql+mysqlconnector://{self.config['user']}:{self.config['password']}@"
25
23
  f"{self.config['host']}:{self.config['port']}/{self.config['database']}"
@@ -30,21 +28,21 @@ class DatabaseManager:
30
28
  if not self.engine:
31
29
  self.connect()
32
30
  return self.engine.connect()
33
-
34
- def create_MEDfl_db(self, path_to_csv):
31
+
32
+ def create_MEDfl_db(self , path_to_csv):
35
33
  # Get the directory of the current script
36
34
  current_directory = os.path.dirname(__file__)
37
35
 
38
36
  # Define the path to the create_db.py script
39
- create_db_script_path = os.path.join(
40
- current_directory, '..', '..', 'scripts', 'create_db.py')
37
+ create_db_script_path = os.path.join(current_directory, '..', 'scripts', 'create_db.py')
41
38
 
42
39
  # Execute the create_db.py script
43
- subprocess.run(
44
- ['python', create_db_script_path, path_to_csv], check=True)
40
+ subprocess.run(['python', create_db_script_path, path_to_csv], check=True)
45
41
 
46
42
  return
47
43
 
48
44
  def close(self):
49
45
  if self.engine:
50
46
  self.engine.dispose()
47
+
48
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Medfl
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: Python Open-source package for simulating federated learning and differential privacy
5
5
  Home-page: https://github.com/HaithemLamri/MEDfl
6
6
  Author: MEDomics consortium
@@ -10,23 +10,23 @@ Medfl/LearningManager/params_optimiser.py,sha256=Pg_I5n_sPz-7ZqOsJGmnVM9ye7c5aPp
10
10
  Medfl/LearningManager/plot.py,sha256=iPqMV9rVd7hquoFixDL20OzXI5bMpBW41bkVmTKIWtE,7927
11
11
  Medfl/LearningManager/server.py,sha256=iQYiWFWMh9FdyQfNoAGYZ7l67fY4lB0dwICgnDXPOlA,7205
12
12
  Medfl/LearningManager/strategy.py,sha256=n0asQajkHfGLDX3QbbV5qntQA-xuJZU8Z92XccZENsA,3517
13
- Medfl/LearningManager/utils.py,sha256=-lchRC7cmPV529nlEg-i-O4fp0-sncyMa2vpr4TBdVc,9480
13
+ Medfl/LearningManager/utils.py,sha256=80yWwpjVsQbYdjpzu5q_mpi6YWpEQUdPhSUdXGK9gx0,9339
14
14
  Medfl/NetManager/__init__.py,sha256=htCEy8g7lrKKeZJ-cH9-YCTyWfIOLwKtoj_dlNasOuM,246
15
- Medfl/NetManager/database_connector.py,sha256=UZYeAKOA0BqwDd-KBlNFyTKFT-Du2QtWq1l6e6uIcVA,1574
15
+ Medfl/NetManager/database_connector.py,sha256=rooasWBSNtZZmqQvLPS0IimHQqWeCMyyGFRFzNM8Dlw,1538
16
16
  Medfl/NetManager/dataset.py,sha256=NpbmfSKJdtqIsShvjsb_z8W1vqlpYoFyZp8Wzsx_aEc,2869
17
17
  Medfl/NetManager/flsetup.py,sha256=IPWdZcz13PZic5OQyCiMyJ34cQPegKwkKEJSAqjjnqg,11754
18
18
  Medfl/NetManager/net_helper.py,sha256=VYJPVI65wo34X9GO9t1joNGPr3TutZdxfva-X6P3MSU,7017
19
19
  Medfl/NetManager/net_manager_queries.py,sha256=2dfhba0iuh40kVoC7am-vC4Hlrvr-zfJ5ESymsI1Kps,4327
20
20
  Medfl/NetManager/network.py,sha256=dzSyEv0IFcoAFeXnI4Favhe9aHuw18YZHB9zwm0VwZE,5521
21
21
  Medfl/NetManager/node.py,sha256=c1vxcpzZFRV0KeG7KLBtP_sA_VmTdjG93PWUpGNIsKM,6535
22
- Medfl-0.1.16.data/scripts/setup_mysql.sh,sha256=PXl271yvYBrXwrZ7P0tsYHnGkOubKvRaFee4MnzsSko,560
22
+ Medfl-0.1.18.data/scripts/setup_mysql.sh,sha256=PXl271yvYBrXwrZ7P0tsYHnGkOubKvRaFee4MnzsSko,560
23
23
  alembic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  alembic/env.py,sha256=a4zJAzPNLHnIrUlXCqf_8vuAlFu0pceFJJKM1PQaOI4,1649
25
25
  scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  scripts/base.py,sha256=B0KKbl9Czh4HhExmO41tdbI2-g1OyiW2ArYhLYgKNEw,778
27
27
  scripts/config.ini,sha256=tDQQlpwZbCFQuSS017yjEiLglLihp6wETbWtNrSWeAA,82
28
28
  scripts/create_db.py,sha256=ZoQeXIPRBxpcMX6wgQSUKCHzxg3kixzBz0ysTGpAejs,4461
29
- Medfl-0.1.16.dist-info/METADATA,sha256=8_6PdJEj203_ljWHWcoa6mMsPiZHWX1XlRHRLQQE8Xw,5577
30
- Medfl-0.1.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
31
- Medfl-0.1.16.dist-info/top_level.txt,sha256=CmLt1TC7PJj-V55rhffMZ9LSOiuSaaEbz9FJm_zOw_E,22
32
- Medfl-0.1.16.dist-info/RECORD,,
29
+ Medfl-0.1.18.dist-info/METADATA,sha256=NOuAr_ydSJOE2Wo44aXGMg-_5yN6Uyn41nUdR1zCNtM,5577
30
+ Medfl-0.1.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
31
+ Medfl-0.1.18.dist-info/top_level.txt,sha256=CmLt1TC7PJj-V55rhffMZ9LSOiuSaaEbz9FJm_zOw_E,22
32
+ Medfl-0.1.18.dist-info/RECORD,,
File without changes