Skip to content

Commit

Permalink
refactor(app) readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoChiosa committed Apr 26, 2024
1 parent 151bd17 commit 532222d
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 47 deletions.
43 changes: 28 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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:
Expand All @@ -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))
Expand Down Expand Up @@ -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 = {}
}
```

8 changes: 8 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
14 changes: 6 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
brickschema
buildingmotif
inquirer
pandas
PyYAML
jupyter-book
jupyter
rdflib
brickschema==0.6.1
buildingmotif==0.1.0a0
inquirer==3.2.4
pandas==2.2.2
PyYAML==6.0.1
rdflib==6.1.1
11 changes: 6 additions & 5 deletions src/portable_app_framework/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/portable_app_framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion src/portable_app_framework/app_template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import brickschema
from portable_app_framework import Application

app = Application(
data=pd.DataFrame(),
metadata=brickschema.Graph(),
app_name='app_template'
)
Expand Down
2 changes: 1 addition & 1 deletion src/portable_app_framework/app_template/query.rq
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX brick: <https://brickschema.org/schema/Brick#>
PREFIX bldg: <http://bldg-59#>
PREFIX bldg: <http://mybldg#>
SELECT *
WHERE {
}
14 changes: 0 additions & 14 deletions src/portable_app_framework/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -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:
"""

0 comments on commit 532222d

Please sign in to comment.