diff --git a/README.md b/README.md index 9aa12dc..69891e2 100644 --- a/README.md +++ b/README.md @@ -56,14 +56,14 @@ import brickschema from portable_app_framework import Application app = Application( - data=pd.DataFrame(), metadata=brickschema.Graph(), - app_name='app_example' + app_name='app_name' ) -app.qualify() -app.fetch() -app.clean() -app.analyze() +qualify_result = app.qualify() # True/False +fetch_result = app.fetch() # Dict of mapped variables +df = pd.DataFrame() # get df according to your logic +df_clean = app.clean(df) +final_result = app.analyze(df_clean) ``` ## Installation @@ -72,7 +72,7 @@ The source code is currently hosted on GitHub at https://github.com/RobertoChiosa/portable-app-framework and the list of changes for each release can be found in the [CHANGELOG](https://github.com/RobertoChiosa/portable-app-framework/blob/main/CHANGELOG.md). -The `portable-app-framework` package requires Python >= 3.8. +The `portable-app-framework` package requires Python >= 3.9. You can install the package in different ways depending on the level of usage you want to have. @@ -97,6 +97,7 @@ You can install the latest test version from test PyPI with the following comman ```sh pip install -i https://test.pypi.org/simple/ PFB-Toolkit==0.1.0 ``` + ### From PyPI You can install the stable version from PyPI with the following command: @@ -107,18 +108,11 @@ pip install portable-app-framework ## Dependencies -- [Pandas]() -- [Brickschema]() -- [Buildingmotif]() - +The main dependencies are reported in the requirements.txt and in the setup.py file. See the [full installation instructions](https://portable-app-framework.pydata.org/portable-app-framework-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies. -## Background - -Work on ``portable-app-framework`` started ... - ## Contributing [//]: # ([![Open Source Helpers](https://www.codetriage.com/RobertoChiosa/afdd/badges/users.svg)](https://www.codetriage.com/RobertoChiosa/afdd)) @@ -146,3 +140,22 @@ by [Contributor Code of Conduct](https://github.com/RobertoChiosa/portable-app-f The present repository has been released under [MIT LICENSE](LICENSE) +## Cite + +Work on ``portable-app-framework`` started in 2021 as an internal project at BAEDA Lab to deploy energy management and +information systems application in a most reliable way instead of solving implementation issues from scratch every time. +We found that the framework enabled faster deployment of such solutions thanks to the builtin methods that allowed the +analyst to skip ripetitive data integration tasks. Moreover allowed non analyst expert of metadata schema to exploit the +power of such tools. So we decided to create this package to share our experience with the scientific community and not +only. + +To cite the package in publications use: + +```bibtex +@software{portable-app-framework, + author = {Roberto Chiosa}, + title = {Portable Framework for Building Applications - PFB-Toolkit}, + url = {} +} +``` + diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..41c44b6 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,8 @@ +brickschema==0.6.1 +buildingmotif==0.1.0a0 +inquirer==3.2.4 +pandas==2.2.2 +PyYAML==6.0.1 +rdflib==6.1.1 +jupyter-book +jupyter \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index bf3df90..24095cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,6 @@ -brickschema -buildingmotif -inquirer -pandas -PyYAML -jupyter-book -jupyter -rdflib \ No newline at end of file +brickschema==0.6.1 +buildingmotif==0.1.0a0 +inquirer==3.2.4 +pandas==2.2.2 +PyYAML==6.0.1 +rdflib==6.1.1 \ No newline at end of file diff --git a/src/portable_app_framework/README.md b/src/portable_app_framework/README.md index a98cb09..e293349 100644 --- a/src/portable_app_framework/README.md +++ b/src/portable_app_framework/README.md @@ -1,9 +1,10 @@ # Portable applications framework package This folder contains the source code for the portable applications framework package. The package is designed to -facilitate the development of portable applications that can be easily shared and reused. +facilitate the development of portable applications that can be easily shared and reused. ## Structure + ```txt ├── README.md ├── __init__.py # Package initialization with Application class and CLI @@ -14,11 +15,11 @@ facilitate the development of portable applications that can be easily shared an │   ├── manifest.ttl # SHACL Shape or manifest │   └── query.rq # SPARQL query ├── libraries # External libraries -│   ├── Brick-nightly.ttl -│   ├── Brick-subset.ttl -│   └── Brick.ttl +│   ├── Brick-nightly.ttl +│   ├── Brick-subset.ttl +│   ├── Brick.ttl +│   └── constraints.ttl └── utils # Utility functions - ├── __init__.p ├── logger.py # Logging utility ├── util.py # General utility functions ├── util_brick.py # Brick-specific utility functions diff --git a/src/portable_app_framework/__init__.py b/src/portable_app_framework/__init__.py index 0ac78d2..f06835d 100644 --- a/src/portable_app_framework/__init__.py +++ b/src/portable_app_framework/__init__.py @@ -26,11 +26,13 @@ from .utils.util_brick import parse_raw_query from .utils.util_qualify import BasicValidationInterface, BuildingMotifValidationInterface +logger = CustomLogger().get_logger() # todo spostare all'interno della cli setup # create app folder if not exists APP_FOLDER = os.path.join(os.getcwd(), 'app') -os.makedirs(APP_FOLDER, exist_ok=True) -print('App folder created' + APP_FOLDER) +if not os.path.exists(APP_FOLDER): + os.makedirs(APP_FOLDER, exist_ok=True) + logger.info(f'Created app folder in {APP_FOLDER}') MODULE_BASEPATH = os.path.dirname(__file__) USER_BASEPATH = os.getcwd() @@ -326,7 +328,7 @@ def update_readme(app_name): md += f')\n' md += f'qualify_result = app.qualify() # True/False\n' md += f'fetch_result = app.fetch() # Dict of mapped variables\n' - md += f'# get df according to your logic \n' + md += f'df = pd.DataFrame()# get df according to your logic \n' md += f'df_clean = app.clean(df)\n' md += f'final_result = app.analyze(df_clean)\n' md += f'```\n\n' diff --git a/src/portable_app_framework/app_template/README.md b/src/portable_app_framework/app_template/README.md index 3ef25ad..cee9c23 100644 --- a/src/portable_app_framework/app_template/README.md +++ b/src/portable_app_framework/app_template/README.md @@ -22,7 +22,6 @@ import brickschema from portable_app_framework import Application app = Application( - data=pd.DataFrame(), metadata=brickschema.Graph(), app_name='app_template' ) diff --git a/src/portable_app_framework/app_template/query.rq b/src/portable_app_framework/app_template/query.rq index a566b9e..ec92e21 100644 --- a/src/portable_app_framework/app_template/query.rq +++ b/src/portable_app_framework/app_template/query.rq @@ -1,6 +1,6 @@ PREFIX rdf: PREFIX brick: -PREFIX bldg: +PREFIX bldg: SELECT * WHERE { } diff --git a/src/portable_app_framework/utils/__init__.py b/src/portable_app_framework/utils/__init__.py index c5b7f59..e69de29 100644 --- a/src/portable_app_framework/utils/__init__.py +++ b/src/portable_app_framework/utils/__init__.py @@ -1,14 +0,0 @@ -""" -Author: Roberto Chiosa -Copyright: Roberto Chiosa, © 2024 -Email: roberto.chiosa@pinvision.it - -Created: 05/01/24 -Script Name: __init__.py -Path: utils - -Script Description: - - -Notes: -"""