Skip to main content

A tool to manage parameters in a form of files, process them, upload to param storage, pull and reconstrut as files.

Project description

Parameterframe

The module provides an interface for managing solution parameters. It allows for the structured storage and retrieval of parameter sets from a database.

import sys
import pandas as pd
import os
sys.path.append('../')
from python_modules.parameterframe import FileTypeHandler, ParameterFrame, DatabaseConnector

Content

  1. Processing and reconstructing yaml and txt with FileTypeHandler
  2. Assembling parameter sets and adding to solution with ParameterFrame
  3. Commiting and pushing solutions with DatabaseConnector

1. Processing and reconstructing yaml and txt with FileTypeHandler

params_path = "../tests/parameterframe/example_configs"

pf = ParameterFrame(
    params_path = params_path
)

pf.process_parameters_from_files()

2. Assembling parameter sets and adding to solution with ParameterFrame

pf.make_parameter_set(
    parameter_set_name="test_set",
    parameter_set_description="example parameters for test purposes",
    parameter_names=['param_1','param_2','param_10', 'param_11','param_21']
)
pf.add_solution_description(solution_name = "example_solution",
                            solution_description = "example solution for test")
pf.solutions['example_solution']
{'solution_id': 'ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60',
 'solution_description': {'solution_id': 'ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60',
  'solution_name': 'example_solution',
  'solution_description': 'example solution for test',
  'deployment_date': None,
  'deprication_date': None,
  'maintainers': None}}
pf.add_parameter_set_to_solution(solution_name="example_solution",
                                 parameter_set_name="test_set")
pd.DataFrame([pf.solutions['example_solution']['solution_parameter_set']['test_set']])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
solution_id parameter_set_id deployment_status insertion_datetime
0 ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac0... a54f04d2ff154294309403206e059aec556cdcfa511206... STAGING 2024-04-21 23:18:22

3. Commiting solutions with DatabaseConnector

pf.commit_solution(solution_name="example_solution",
                    parameter_set_names=["test_set"])

solution_description

pd.DataFrame(pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']['solution_description'])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
solution_id solution_name solution_description deployment_date deprication_date maintainers
0 ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac0... example_solution example solution for test None None None

solution_parameter_set

param_set_id = 'a54f04d2ff154294309403206e059aec556cdcfa51120649ce663f3230a970d5'

pd.DataFrame(pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']['solution_parameter_set'][param_set_id])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
solution_id parameter_set_id deployment_status insertion_datetime
0 ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac0... a54f04d2ff154294309403206e059aec556cdcfa511206... STAGING 2024-04-21 23:18:22

parameter_set

pd.DataFrame(pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']\
    ['parameter_set']\
        [param_set_id])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
parameter_set_id parameter_id
0 a54f04d2ff154294309403206e059aec556cdcfa511206... 4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e0...
1 a54f04d2ff154294309403206e059aec556cdcfa511206... bf11768decb1d0204e2636edd05c354573d473e67f1b04...
2 a54f04d2ff154294309403206e059aec556cdcfa511206... 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60...
3 a54f04d2ff154294309403206e059aec556cdcfa511206... ace2f31433212fbf9e764069a30a7675ca78f496d31f06...
4 a54f04d2ff154294309403206e059aec556cdcfa511206... 1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a...

parameter_set_description

pd.DataFrame(pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']\
    ['parameter_set_description']\
        [param_set_id])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
parameter_set_id parameter_set_name parameter_set_description
0 a54f04d2ff154294309403206e059aec556cdcfa511206... test_set example parameters for test purposes

parameter_description

pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']['parameter_description'][param_set_id]
{'4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e00b45135ea90fc011af': [{'parameter_id': '4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e00b45135ea90fc011af',
   'parameter_name': 'param_1',
   'parameter_description': '',
   'file_name': 'param_1.yaml',
   'file_type': 'yaml'}],
 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f': [{'parameter_id': 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f',
   'parameter_name': 'param_2',
   'parameter_description': '',
   'file_name': 'param_2.yaml',
   'file_type': 'yaml'}],
 '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be': [{'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'parameter_name': 'param_10',
   'parameter_description': '',
   'file_name': 'param_10.txt',
   'file_type': 'txt'}],
 'ace2f31433212fbf9e764069a30a7675ca78f496d31f061d06d0a0420fc52768': [{'parameter_id': 'ace2f31433212fbf9e764069a30a7675ca78f496d31f061d06d0a0420fc52768',
   'parameter_name': 'param_11',
   'parameter_description': '',
   'file_name': 'param_11.dill',
   'file_type': 'unknown'}],
 '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689': [{'parameter_id': '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689',
   'parameter_name': 'param_21',
   'parameter_description': '',
   'file_name': 'param_21.ipynb',
   'file_type': 'unknown'}]}

parameter_description

pd.DataFrame([tab for param_id, tab_list in pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']\
    ['parameter_description']\
        [param_set_id].items()\
            for tab in tab_list])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
parameter_id parameter_name parameter_description file_name file_type
0 4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e0... param_1 param_1.yaml yaml
1 bf11768decb1d0204e2636edd05c354573d473e67f1b04... param_2 param_2.yaml yaml
2 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... param_10 param_10.txt txt
3 ace2f31433212fbf9e764069a30a7675ca78f496d31f06... param_11 param_11.dill unknown
4 1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a... param_21 param_21.ipynb unknown

parameter_attribute

pd.DataFrame([tab for param_id, tab_list in pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']\
    ['parameter_attribute']\
        [param_set_id].items() \
            for tab in tab_list])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
parameter_id attribute_id previous_attribute_id
0 4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e0... ee25af17445d7622cbf61a5b9424246a1f3104704b68bd... None
1 4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e0... 8b5b2be24e60ba407b90967820da8a1385a6d67691a02b... None
2 4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e0... 52ea872c99c586530348ba8902dcab831761673d25cf1c... None
3 bf11768decb1d0204e2636edd05c354573d473e67f1b04... 7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe09077... None
4 bf11768decb1d0204e2636edd05c354573d473e67f1b04... ee25af17445d7622cbf61a5b9424246a1f3104704b68bd... 7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe09077...
5 bf11768decb1d0204e2636edd05c354573d473e67f1b04... 3367512147bf19ae99c986b356af11dcdc067376aa1b79... 7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe09077...
6 bf11768decb1d0204e2636edd05c354573d473e67f1b04... 341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6... 7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe09077...
7 bf11768decb1d0204e2636edd05c354573d473e67f1b04... 2e8b00e571f9d835d3f022a9ff49b9779034ab21bffdcd... 341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6...
8 bf11768decb1d0204e2636edd05c354573d473e67f1b04... ecd93cf051988b23b3590415f4e7d550de264600d7d2af... 341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6...
9 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... fa4e8d81f4dbe6d306aff59bea4693d325a203be5d5b9f... None
10 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... c26e7e96f0f3647c159b0934f4dc55207ac059abb56005... fa4e8d81f4dbe6d306aff59bea4693d325a203be5d5b9f...
11 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... f7cd339f77c1799f399d8ebcbb27f2d41a448622254d64... c26e7e96f0f3647c159b0934f4dc55207ac059abb56005...
12 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... 15a33fe62774a1857b404f453ba1195eb4355e10bc9519... f7cd339f77c1799f399d8ebcbb27f2d41a448622254d64...
13 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... 99761e3d58bc213dc3ab33f2dc8dabe5f97d3aea6b59cd... 15a33fe62774a1857b404f453ba1195eb4355e10bc9519...
14 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... 036a9c122c1f4c9304afa23c4d1fce5224c270a206889a... 99761e3d58bc213dc3ab33f2dc8dabe5f97d3aea6b59cd...
15 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... e72aa8015688052f4e7fddbf4c74e5bf2bd74239ebf390... 036a9c122c1f4c9304afa23c4d1fce5224c270a206889a...
16 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... 0ae8eda3dbeedbc17e27a679c5426dd3af1434f7c37b4e... e72aa8015688052f4e7fddbf4c74e5bf2bd74239ebf390...
17 9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a60... cedcfbb0d95798514b6aaf30118fff7b46f863f1bc8b80... 0ae8eda3dbeedbc17e27a679c5426dd3af1434f7c37b4e...
18 ace2f31433212fbf9e764069a30a7675ca78f496d31f06... ace2f31433212fbf9e764069a30a7675ca78f496d31f06... None
19 1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a... 87d93e1862f0f58199c3fcb7114b92fe59f03581804b1c... None
20 1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a... b4a705d09aa0361f4db453da32abb05a5c4e0249d6180d... 87d93e1862f0f58199c3fcb7114b92fe59f03581804b1c...
21 1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a... e4e2c33a2ea67f34bf3ac1e9d99edaad501c7dc4ea82f4... b4a705d09aa0361f4db453da32abb05a5c4e0249d6180d...
22 1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a... 777abf12375b7f605b21535eb0d6232ce99581c6d2b117... e4e2c33a2ea67f34bf3ac1e9d99edaad501c7dc4ea82f4...
pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']\
    ['parameter_attribute']\
        [param_set_id]
{'4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e00b45135ea90fc011af': [{'parameter_id': '4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e00b45135ea90fc011af',
   'attribute_id': 'ee25af17445d7622cbf61a5b9424246a1f3104704b68bd31b9b7532471d492e5',
   'previous_attribute_id': None},
  {'parameter_id': '4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e00b45135ea90fc011af',
   'attribute_id': '8b5b2be24e60ba407b90967820da8a1385a6d67691a02bc663703160ef655101',
   'previous_attribute_id': None},
  {'parameter_id': '4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e00b45135ea90fc011af',
   'attribute_id': '52ea872c99c586530348ba8902dcab831761673d25cf1cb0023576820289ce6b',
   'previous_attribute_id': None}],
 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f': [{'parameter_id': 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f',
   'attribute_id': '7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe090774f6866311f4fa34179',
   'previous_attribute_id': None},
  {'parameter_id': 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f',
   'attribute_id': 'ee25af17445d7622cbf61a5b9424246a1f3104704b68bd31b9b7532471d492e5',
   'previous_attribute_id': '7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe090774f6866311f4fa34179'},
  {'parameter_id': 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f',
   'attribute_id': '3367512147bf19ae99c986b356af11dcdc067376aa1b79eb8ba8f61324e8dc18',
   'previous_attribute_id': '7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe090774f6866311f4fa34179'},
  {'parameter_id': 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f',
   'attribute_id': '341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6f4c930fdb9d5dd5128',
   'previous_attribute_id': '7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe090774f6866311f4fa34179'},
  {'parameter_id': 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f',
   'attribute_id': '2e8b00e571f9d835d3f022a9ff49b9779034ab21bffdcde075d9d729fabeb960',
   'previous_attribute_id': '341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6f4c930fdb9d5dd5128'},
  {'parameter_id': 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f',
   'attribute_id': 'ecd93cf051988b23b3590415f4e7d550de264600d7d2af8704c973b9c98ca6a9',
   'previous_attribute_id': '341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6f4c930fdb9d5dd5128'}],
 '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be': [{'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': 'fa4e8d81f4dbe6d306aff59bea4693d325a203be5d5b9fde5d5f1e7cce26b861',
   'previous_attribute_id': None},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': 'c26e7e96f0f3647c159b0934f4dc55207ac059abb56005d7a8acd8344ef14798',
   'previous_attribute_id': 'fa4e8d81f4dbe6d306aff59bea4693d325a203be5d5b9fde5d5f1e7cce26b861'},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': 'f7cd339f77c1799f399d8ebcbb27f2d41a448622254d64e9270ae2316211ac1d',
   'previous_attribute_id': 'c26e7e96f0f3647c159b0934f4dc55207ac059abb56005d7a8acd8344ef14798'},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': '15a33fe62774a1857b404f453ba1195eb4355e10bc9519f2f991dd7ba8db19b7',
   'previous_attribute_id': 'f7cd339f77c1799f399d8ebcbb27f2d41a448622254d64e9270ae2316211ac1d'},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': '99761e3d58bc213dc3ab33f2dc8dabe5f97d3aea6b59cd367d40b76937f49aa6',
   'previous_attribute_id': '15a33fe62774a1857b404f453ba1195eb4355e10bc9519f2f991dd7ba8db19b7'},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': '036a9c122c1f4c9304afa23c4d1fce5224c270a206889afa689f3efb36ff368d',
   'previous_attribute_id': '99761e3d58bc213dc3ab33f2dc8dabe5f97d3aea6b59cd367d40b76937f49aa6'},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': 'e72aa8015688052f4e7fddbf4c74e5bf2bd74239ebf3902a5fdc008ecb03aa46',
   'previous_attribute_id': '036a9c122c1f4c9304afa23c4d1fce5224c270a206889afa689f3efb36ff368d'},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': '0ae8eda3dbeedbc17e27a679c5426dd3af1434f7c37b4ecd3b2fb5c492272b75',
   'previous_attribute_id': 'e72aa8015688052f4e7fddbf4c74e5bf2bd74239ebf3902a5fdc008ecb03aa46'},
  {'parameter_id': '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be',
   'attribute_id': 'cedcfbb0d95798514b6aaf30118fff7b46f863f1bc8b80bb2ddd2145e5b3f318',
   'previous_attribute_id': '0ae8eda3dbeedbc17e27a679c5426dd3af1434f7c37b4ecd3b2fb5c492272b75'}],
 'ace2f31433212fbf9e764069a30a7675ca78f496d31f061d06d0a0420fc52768': [{'parameter_id': 'ace2f31433212fbf9e764069a30a7675ca78f496d31f061d06d0a0420fc52768',
   'attribute_id': 'ace2f31433212fbf9e764069a30a7675ca78f496d31f061d06d0a0420fc52768',
   'previous_attribute_id': None}],
 '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689': [{'parameter_id': '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689',
   'attribute_id': '87d93e1862f0f58199c3fcb7114b92fe59f03581804b1c8419868fb00ff8a469',
   'previous_attribute_id': None},
  {'parameter_id': '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689',
   'attribute_id': 'b4a705d09aa0361f4db453da32abb05a5c4e0249d6180d2b8a58d72d08dbd6a0',
   'previous_attribute_id': '87d93e1862f0f58199c3fcb7114b92fe59f03581804b1c8419868fb00ff8a469'},
  {'parameter_id': '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689',
   'attribute_id': 'e4e2c33a2ea67f34bf3ac1e9d99edaad501c7dc4ea82f4b60e9d959418d8438d',
   'previous_attribute_id': 'b4a705d09aa0361f4db453da32abb05a5c4e0249d6180d2b8a58d72d08dbd6a0'},
  {'parameter_id': '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689',
   'attribute_id': '777abf12375b7f605b21535eb0d6232ce99581c6d2b1179af976cd0708ad27ff',
   'previous_attribute_id': 'e4e2c33a2ea67f34bf3ac1e9d99edaad501c7dc4ea82f4b60e9d959418d8438d'}]}

attribute_values

pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']['attribute_values'][param_set_id]
{'4cea5b09e77da310c5105978f2ceea5c5d8c9c7b65d0e00b45135ea90fc011af': [{'attribute_id': 'ee25af17445d7622cbf61a5b9424246a1f3104704b68bd31b9b7532471d492e5',
   'attribute_name': 'name',
   'attribute_value': 'Some name',
   'attribute_value_type': 'str'},
  {'attribute_id': '8b5b2be24e60ba407b90967820da8a1385a6d67691a02bc663703160ef655101',
   'attribute_name': 'age',
   'attribute_value': '111',
   'attribute_value_type': 'int'},
  {'attribute_id': '52ea872c99c586530348ba8902dcab831761673d25cf1cb0023576820289ce6b',
   'attribute_name': 'country',
   'attribute_value': 'Some land',
   'attribute_value_type': 'str'}],
 'bf11768decb1d0204e2636edd05c354573d473e67f1b048369b2ee99c865bf5f': [{'attribute_id': '7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe090774f6866311f4fa34179',
   'attribute_name': 'employee',
   'attribute_value': "{'name': 'Some name', 'id': 10293, 'contact': {'email': 'some.name@example.com', 'phone': '+1234567890'}}",
   'attribute_value_type': 'dict'},
  {'attribute_id': 'ee25af17445d7622cbf61a5b9424246a1f3104704b68bd31b9b7532471d492e5',
   'attribute_name': 'name',
   'attribute_value': 'Some name',
   'attribute_value_type': 'str'},
  {'attribute_id': '3367512147bf19ae99c986b356af11dcdc067376aa1b79eb8ba8f61324e8dc18',
   'attribute_name': 'id',
   'attribute_value': '10293',
   'attribute_value_type': 'int'},
  {'attribute_id': '341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6f4c930fdb9d5dd5128',
   'attribute_name': 'contact',
   'attribute_value': "{'email': 'some.name@example.com', 'phone': '+1234567890'}",
   'attribute_value_type': 'dict'},
  {'attribute_id': '2e8b00e571f9d835d3f022a9ff49b9779034ab21bffdcde075d9d729fabeb960',
   'attribute_name': 'email',
   'attribute_value': 'some.name@example.com',
   'attribute_value_type': 'str'},
  {'attribute_id': 'ecd93cf051988b23b3590415f4e7d550de264600d7d2af8704c973b9c98ca6a9',
   'attribute_name': 'phone',
   'attribute_value': '+1234567890',
   'attribute_value_type': 'str'}],
 '9a4a3ace265c9bf2facc0044ca24260c42805c6e7b2a608dfd2f56a54d9d36be': [{'attribute_id': 'fa4e8d81f4dbe6d306aff59bea4693d325a203be5d5b9fde5d5f1e7cce26b861',
   'attribute_name': '0',
   'attribute_value': '\\X/Fc7;/v`6joU5z*n{35zFB<<6BMC,}/_04],>v$Jr2&0M_7qU\'IY#6uO\\$kEr.)Z&Bb|jUU>QU6\'tu552PTi{fEv&yZ5W[pnU@5>j9#wi9S0^23t1W,0}><v+Pv+9:~v4D_kJGRk&R@e:&UR::#"qAClD~@-%]atMP+.,m3E/x0)|?Xq/bh#FTAA$r@BG9R-yCsD1zW!KG5pZBQxKeVT\'ZX8X6C2H\\@B(h1H,MxhGc|Tcbq@T5]0x5Sb]U~Yz',
   'attribute_value_type': 'str'},
  {'attribute_id': 'c26e7e96f0f3647c159b0934f4dc55207ac059abb56005d7a8acd8344ef14798',
   'attribute_name': '1',
   'attribute_value': 'A7J+1x5|?r]2zg54nxoa>W*loh8Np~*9+*KxWLuD/Z5g!=DN>}c#]Dt->tiov?|Ms.!Hd{@%G[baAjcfSpR<iKJ^_!k+^@,uY&fER+gS%BU^X;s3>}.bKs=\\g_@)\\T5R6R{WZO^KG!j&yl.j~[<7&brDKV<rye]G{Y2_0PFVh/yoqud{2C$Z-:~4mxucBvJlm-"{Qyy|U&SY4Fw.bjFa8,62Z|he;+I\\)ggi$<rVl|9"%n]j&*PP;b!opy^=_pb',
   'attribute_value_type': 'str'},
  {'attribute_id': 'f7cd339f77c1799f399d8ebcbb27f2d41a448622254d64e9270ae2316211ac1d',
   'attribute_name': '2',
   'attribute_value': 'LUs%<HRbNA_4:yYTh!!x&oFZ201sQ7;~Q_IYr"lGRMd=xx,r}|n8zHIP6%JN)",vQIP-bV&y3V5Z6X8NbiQlA05-&g{2-(}h%oiR\\"Q1&1xed&gBtx)L]?(jP{1Bi|x=T<}-+1hxKP;[~$C=J*2LBohTMD~;v6<}&I!]XA)-qmvjON,@Ds~GZ9/PB2a&hdJE/j:ZN![gS>HO`EHTf"`x~=CD|oG.^=g?H:_.JSk5z)g,*moq_f\'A5z$+%V_~CC/',
   'attribute_value_type': 'str'},
  {'attribute_id': '15a33fe62774a1857b404f453ba1195eb4355e10bc9519f2f991dd7ba8db19b7',
   'attribute_name': '3',
   'attribute_value': 'b&z(/Z{s@U>@o!}{+(mmygo}u~AHgdu>:jz4fNBm0;Q6\'o+f%H/z3^8Hh!w<#z.~21H2]$rpWSUD\'\'cV+;hZkyVa?c8u@S.{ct3fzB/&yb]jUAC.wg=PW,va1g]/4Aq6x}Ll.yf\'L[~4ejf[/ZstFQIxU4|c_AKK!Nsf)6I?L3ZLvPzJ0+/$~V_|#9&B\\Gu03=|;5a[@TK-i#"o),hi1Q6D=F)"WNQ/O>na@^%!,iV>9kdRj`V@*Vh:}Dq%w\\r=',
   'attribute_value_type': 'str'},
  {'attribute_id': '99761e3d58bc213dc3ab33f2dc8dabe5f97d3aea6b59cd367d40b76937f49aa6',
   'attribute_name': '4',
   'attribute_value': ".#;5Cu]5~8ZmYBLI4w)|h=)C<(#`KSoM,`7n?dun7]LX>j7/U>Jf||4`AN_u*W!*3)*+<l'4alH5k5dO&`M@*&aZv(cZnr{uBla&b]8SJ1-}FRb3kj{PODJ'qB$t}[]B;%JE/Ag.i^s;1xVwBrs]a~1Y7HPn'Z<SN8Da%+zoFe|`nq$^/EDpB5srxdSc)ej`O\\C+j\\3z@?UKndHAwU{dbk?BxqSAZ@!{k2fZfNO)|JaJrr#eskY!?+:+6,tW-lv",
   'attribute_value_type': 'str'},
  {'attribute_id': '036a9c122c1f4c9304afa23c4d1fce5224c270a206889afa689f3efb36ff368d',
   'attribute_name': '5',
   'attribute_value': '0S)*}6"i)kUg3=n:}>Ji)!"BTbzsdgps8{cR]`.41QJ<O{wr[}}gGan_O63D0WBr]<zJ-`U4W{33`_Il3Z]b{jdzvK2/4^AZu1h<(,dRr.hB?#B|O"3%5MuyeOj~k8WIX1)}Ef^Lhm)Ix@&`RNyX3{)AR[n]ayEDh!dTK%vuOHC=j$Lax_dJezu^V`of@x!?(Dss=xuXD&%*;(ZA\\x2Uty)-7y,a)Q{{|QKme9sRyU\\zM?^DxNg`SG0$K:L|,cf',
   'attribute_value_type': 'str'},
  {'attribute_id': 'e72aa8015688052f4e7fddbf4c74e5bf2bd74239ebf3902a5fdc008ecb03aa46',
   'attribute_name': '6',
   'attribute_value': 'Xb;IgM/`T:VY*6XQ:nvB3)>@32w8H-cD"g>x`MlWp_TnuyCaz62e??md<8tR$Q=X7<9mC5.wHLX?;*z3-z\\v,\'uINGC)x%~3Jz^4P~?|KLTlENtt,d4#<eM<7]M[7}&G1"u1gELm^{.Bn\\jLfrPh?o.R1g8L*jiiwia-WClq`;a/..62oEl}6.8u7+M}P(#2UI>{^IJwo4\'C,@FqjvO~H2iktlg],d*I3?z"j9>$.~(\\04NHsj\'TsJ_Cu1Qs-c\\',
   'attribute_value_type': 'str'},
  {'attribute_id': '0ae8eda3dbeedbc17e27a679c5426dd3af1434f7c37b4ecd3b2fb5c492272b75',
   'attribute_name': '7',
   'attribute_value': 'pq.%\\nmm;M!^cyS|ApMpnjUS<#Ov?e+n"wX/to.wjifCG.fKK@6gI+Wvax&}j18R8p!xB}BIHgkG|f]$%Wi%;#8JP$rzo"XYnga+j7=])2}`;nR}#7cx\'$1EFq-.iMC/Z|"<;wO<}2#,IM\'Mr\\3&]}bZ6DKFdLH>W9G@E}A6M}!FQD]nCPMuh^G9Z+]{R8)LZXE,l+xA~\'h(nK>ZxwJ5L=!I9iHlB;bM!G[Snh,YsZxf4v,t!*QhgB^1p9D1\\c-',
   'attribute_value_type': 'str'},
  {'attribute_id': 'cedcfbb0d95798514b6aaf30118fff7b46f863f1bc8b80bb2ddd2145e5b3f318',
   'attribute_name': '8',
   'attribute_value': '+-;Zt=ex',
   'attribute_value_type': 'str'}],
 'ace2f31433212fbf9e764069a30a7675ca78f496d31f061d06d0a0420fc52768': [{'attribute_id': 'ace2f31433212fbf9e764069a30a7675ca78f496d31f061d06d0a0420fc52768',
   'attribute_name': '0',
   'attribute_value': "b'\\x80\\x04\\x95h\\x00\\x00\\x00\\x00\\x00\\x00\\x00}\\x94(\\x8c\\x07integer\\x94K*\\x8c\\x05float\\x94G@\\t!\\xf9\\xf0\\x1b\\x86n\\x8c\\x06string\\x94\\x8c\\rHello, world!\\x94\\x8c\\x04list\\x94]\\x94(K\\x01K\\x02K\\x03K\\x04K\\x05e\\x8c\\x04dict\\x94}\\x94\\x8c\\x03key\\x94\\x8c\\x05value\\x94su.'",
   'attribute_value_type': 'bytes'}],
 '1a4f19ee9e186ee739daecbc778501c5851d3fb5d05c4a3c1200e599855e8689': [{'attribute_id': '87d93e1862f0f58199c3fcb7114b92fe59f03581804b1c8419868fb00ff8a469',
   'attribute_name': '0',
   'attribute_value': 'b\'{\\n "cells": [\\n  {\\n   "cell_type": "markdown",\\n   "metadata": {},\\n   "source": [\\n    "### Example ipynb file"\\n   ]\\n  },\\n  {\\n   "cell_type": "code",\\n   "execution_count": 1,\\n   "metadata": {},\\n   "outputs": [\\n    {\\n     "data": {\\n      "te',
   'attribute_value_type': 'bytes'},
  {'attribute_id': 'b4a705d09aa0361f4db453da32abb05a5c4e0249d6180d2b8a58d72d08dbd6a0',
   'attribute_name': '1',
   'attribute_value': 'xt/plain": [\\n       "4"\\n      ]\\n     },\\n     "execution_count": 1,\\n     "metadata": {},\\n     "output_type": "execute_result"\\n    }\\n   ],\\n   "source": [\\n    "2+2"\\n   ]\\n  }\\n ],\\n "metadata": {\\n  "kernelspec": {\\n   "display_name": "testenv",\\n',
   'attribute_value_type': 'bytes'},
  {'attribute_id': 'e4e2c33a2ea67f34bf3ac1e9d99edaad501c7dc4ea82f4b60e9d959418d8438d',
   'attribute_name': '2',
   'attribute_value': '   "language": "python",\\n   "name": "python3"\\n  },\\n  "language_info": {\\n   "codemirror_mode": {\\n    "name": "ipython",\\n    "version": 3\\n   },\\n   "file_extension": ".py",\\n   "mimetype": "text/x-python",\\n   "name": "python",\\n   "nbconvert_exporte',
   'attribute_value_type': 'bytes'},
  {'attribute_id': '777abf12375b7f605b21535eb0d6232ce99581c6d2b1179af976cd0708ad27ff',
   'attribute_name': '3',
   'attribute_value': 'r": "python",\\n   "pygments_lexer": "ipython3",\\n   "version": "3.9.15"\\n  }\\n },\\n "nbformat": 4,\\n "nbformat_minor": 2\\n}\\n\'',
   'attribute_value_type': 'bytes'}]}
pd.DataFrame([tab for param_id, tab_list in pf.commited_tables['ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60']\
    ['attribute_values']\
        [param_set_id].items() \
            for tab in tab_list])
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
attribute_id attribute_name attribute_value attribute_value_type
0 ee25af17445d7622cbf61a5b9424246a1f3104704b68bd... name Some name str
1 8b5b2be24e60ba407b90967820da8a1385a6d67691a02b... age 111 int
2 52ea872c99c586530348ba8902dcab831761673d25cf1c... country Some land str
3 7d5ee0e0cd00c3703e5f346c6887baf503faaf9fe09077... employee {'name': 'Some name', 'id': 10293, 'contact': ... dict
4 ee25af17445d7622cbf61a5b9424246a1f3104704b68bd... name Some name str
5 3367512147bf19ae99c986b356af11dcdc067376aa1b79... id 10293 int
6 341769820d8937a5c9f9b980eefca37f3f37fcc6fd01c6... contact {'email': 'some.name@example.com', 'phone': '+... dict
7 2e8b00e571f9d835d3f022a9ff49b9779034ab21bffdcd... email some.name@example.com str
8 ecd93cf051988b23b3590415f4e7d550de264600d7d2af... phone +1234567890 str
9 fa4e8d81f4dbe6d306aff59bea4693d325a203be5d5b9f... 0 \X/Fc7;/v`6joU5z*n{35zFB<<6BMC,}/_04],>v$Jr2&0... str
10 c26e7e96f0f3647c159b0934f4dc55207ac059abb56005... 1 A7J+1x5|?r]2zg54nxoa>W*loh8Np~*9+*KxWLuD/Z5g!=... str
11 f7cd339f77c1799f399d8ebcbb27f2d41a448622254d64... 2 LUs%<HRbNA_4:yYTh!!x&oFZ201sQ7;~Q_IYr"lGRMd=xx... str
12 15a33fe62774a1857b404f453ba1195eb4355e10bc9519... 3 b&z(/Z{s@U>@o!}{+(mmygo}u~AHgdu>:jz4fNBm0;Q6'o... str
13 99761e3d58bc213dc3ab33f2dc8dabe5f97d3aea6b59cd... 4 .#;5Cu]5~8ZmYBLI4w)|h=)C<(#`KSoM,`7n?dun7]LX>j... str
14 036a9c122c1f4c9304afa23c4d1fce5224c270a206889a... 5 0S)*}6"i)kUg3=n:}>Ji)!"BTbzsdgps8{cR]`.41QJ<O{... str
15 e72aa8015688052f4e7fddbf4c74e5bf2bd74239ebf390... 6 Xb;IgM/`T:VY*6XQ:nvB3)>@32w8H-cD"g>x`MlWp_Tnuy... str
16 0ae8eda3dbeedbc17e27a679c5426dd3af1434f7c37b4e... 7 pq.%\nmm;M!^cyS|ApMpnjUS<#Ov?e+n"wX/to.wjifCG.... str
17 cedcfbb0d95798514b6aaf30118fff7b46f863f1bc8b80... 8 +-;Zt=ex str
18 ace2f31433212fbf9e764069a30a7675ca78f496d31f06... 0 b'\x80\x04\x95h\x00\x00\x00\x00\x00\x00\x00}\x... bytes
19 87d93e1862f0f58199c3fcb7114b92fe59f03581804b1c... 0 b'{\n "cells": [\n {\n "cell_type": "markdo... bytes
20 b4a705d09aa0361f4db453da32abb05a5c4e0249d6180d... 1 xt/plain": [\n "4"\n ]\n },\n ... bytes
21 e4e2c33a2ea67f34bf3ac1e9d99edaad501c7dc4ea82f4... 2 "language": "python",\n "name": "python3"... bytes
22 777abf12375b7f605b21535eb0d6232ce99581c6d2b117... 3 r": "python",\n "pygments_lexer": "ipython3"... bytes

4. Pushing solutions with DatabaseConnector

pf.push_solution(solution_id='ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60',
                 parameter_set_ids=['a54f04d2ff154294309403206e059aec556cdcfa51120649ce663f3230a970d5'])
HTTP Request: POST http://localhost:8000/insert "HTTP/1.1 200 OK"





True

5. Pulling solution with DatabaseConnector

params_path = "../tests/parameterframe/example_configs"

pf2 = ParameterFrame(
    params_path = params_path
)

pf2.pull_solution(solution_id='ffb2fa4d1f14786e7a11641a870c3db55f08f375fb7ac00c9a2127f7cd801a60',
                 parameter_set_id='a54f04d2ff154294309403206e059aec556cdcfa51120649ce663f3230a970d5')
HTTP Request: POST http://localhost:8000/search "HTTP/1.1 200 OK"
HTTP Request: POST http://localhost:8000/search "HTTP/1.1 200 OK"
HTTP Request: POST http://localhost:8000/search "HTTP/1.1 200 OK"

6. Reconstructing files

os.listdir("../tests/parameterframe/reconstructed_files")
['.gitignore']
pf2.reconstruct_parameter_set(
    solution_name = "example_solution",
    parameter_set_name = "test_set",
    params_path = "../tests/parameterframe/reconstructed_files"
)
os.listdir("../tests/parameterframe/reconstructed_files")
['param_2.yaml',
 'param_11.dill',
 '.gitignore',
 'param_1.yaml',
 'param_10.txt',
 'param_21.ipynb']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parameterframe-0.0.2.tar.gz (29.0 kB view hashes)

Uploaded Source

Built Distribution

parameterframe-0.0.2-py3-none-any.whl (20.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page