# WAVE
> # Workflow Automation and Versatile Engine
<div align="center">
<img src="RDM_components/img/wave.jpeg" alt="WAVE" width="450px"/>
</div>
> Owned by Lucas Lourenço
> Maintained by Lucas Lourenço
> Translation to [Portuguese](/RDM_components/PT_README.md)
----
# Getting Started on WAVE
To use WAVE, execute the following command in your terminal
##### ```pip install -U wave-flow```
# Examples
<details open>
<summary>
Practical Examples
</summary>
<p>
- [Simple Example](e.g/simple/simpleExample.py)
- [Complex Example](e.g/complex/complexExample.py)
- [Complex Example With Classes](e.g/complexWithClass/complexExample2.py)
</p>
</details>
<details open>
<summary>
Class Use Case Example
</summary>
<p>
- [DataHandler](#-datahandler)
- [Builder](#-builder)
- [To](#-to)
- [Transmitter](#-transmitter)
</p>
</details>
---
# How To Use
## | **DataHandler**
The `DataHandler` class is the first step when you're using WAVE. Using it, you become able to use several features, including the unique way to reach `Archive` class (as shown in the next topic). Below are the methods and it's explication.
* #### **DType**
>As [Pandas](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.dtypes.html), you can pass a _DType_ as parameter. The _KEYS_ on this dict must have to be one of the Headers at the column that you want to perform the read as the _VALUE_ data.
e.g.:
```python
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==') # important part of the code that will be shown below.
handler.setDtype({"ID":str, "DATE":str})
```
* #### **Acess Archive**
>To acess the class [Archive](#-archive), the unique way to reach it is using the code below.
e.g.:
```python
handler = DataHandler(r'example.xlsx')
handler.getArchive() # and it's methods as shown
```
* #### **Read File**
>After informate the [Delimiter](#-delimiter), and if you think it's necessary, inform the [Dtype](#dtype), you have to read the file.<p>
You can only read `xlsx`, `csv` and `json`
e.g.:
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==')
handler.setDtype({"ID":str, "DATE":str})
handler.readFile()
print(handler.getArchive().getData()) # -> dict
```
## | **Archive**
After being accessed by the method in [DataHandler (Acess Archive)](#acess-archive), you can manage a lot of data informations. Which them gonna be expressed below.
* ### **Delimiter**
One of the most important part of the orchestra. It's necessary and primordial to identify where the placeholders are.
e.g.:
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==')
[...]
```
* ### **Transform Data**
This method cooperate with [To](#-to) class. To handle data, `To` has a lot of management about it. You can read more about it [clicking here](#-to).
Following the harmony of the structure, it is appropriate that you use this method to process any type of data.
e.g.:
```python
handler.getArchive().transformData("HOUR", To.Hour().to_hh_mm)
handler.getArchive().transformData("DATE", To.Date().to_dd_mm_yyyy)
handler.getArchive().transformData("FINALDATE", lambda x: To.Date().to_personalizedFormat(x, '%d de %B de %Y'))
```
* ### **Additional Parameter**
`setAdditionalParameters`
Using this method, you can personalize formatting configurations to each info which will be placed.
Assuming those obrigatory parameters `keyColumn`, `parameterToChange`, `newValueToParameter`, pay attention to the required data below.
| **possibilities** | **appropriate data type** |
|-----------------------------|------------------------------|
| bold | bool |
| italic | bool |
| font | string |
| size | int |
`keyColumn`: Place here the header which you want to operate.
`parameterToChange`: Select one of the four possibility.
`newValueToParameter`: place the proper data to what you wanna format.
e.g.:
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==')
handler.readFile()
handler.getArchive().setAdditionalParameters("NAME", "size", 12)
handler.getArchive().setAdditionalParameters("NAME", "bold", True)
handler.getArchive().setAdditionalParameters("COUNTRY", 'italic', True)
handler.getArchive().setAdditionalParameters("DATE", "font", 'Times New Roman')
[...]
```
OR `setAdditionalParametersForAll`<p>
This method implements for all headers the same configuration.
e.g.:
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==')
handler.readFile()
handler.getArchive().setAdditionalParametersForAll("centralize", True)
[...]
```
<!--
def setAdditionalParameters(self, keyColumn:str, parameterToChange:Literal["font", "size", "italic", "bold"], newValueToParameter):
self.__DictWithData[keyColumn]['additional_parameters'][parameterToChange] = newValueToParameter -->
* ### **Getters**
| **Method Name** | **Return Type** | **Description** |
|------------------------------|-------------------------|---------------------------------------------------------------------------------|
| `getData()` | `dict` | Returns the data dictionary, raises `ReferenceError` if no data is available. **(maybe it's what you're looking for)**|
| `getFileType()` | `str` | Returns the file type of the archive. |
| `getMetaData()` | `list[str]` | Returns a list of metadata associated with the file. |
| `getFilename()` | `str` | Returns the name of the file. |
| `getDesignatedFile()` | `docx.Document` | Returns the designated file object. |
| `getDataFrame()` | `pd.DataFrame` | Returns the data as a DataFrame, raises `ReferenceError` if no DataFrame exists.|
| `getDelimiter()` | `str` | Returns the current delimiter used for key formatting. |
| `getFilesGenerated()` | `list[docx.Document]` | Returns a list of files generated by the system. |
---
## | **Builder**
The `Builder` class requires only two obrigatory parameters. Are them the _instance_ of Archive, it means you **HAVE** to informate "handler.getArchive()" as first parameter(archive parameter). As second, you have to informate the base document(baseDocx parameter) which you want to deal.
e.g.:
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==')
handler.readFile()
build = Builder(handler.getArchive(), r'example.docx')
[...]
```
* ### **Generation**
`.generate()`
Method used to generate the documents. There's no parameters, just need to run it.
e.g.:
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==')
handler.readFile()
build = Builder(handler.getArchive(), r'example.docx')
build.generate()
[...]
```
* ### **Saving Generated Files**
`.saveAs()`
To save in a zip file or locally, first you have to generate as shown above.
This method has a lot of personalization ways to do. Below you gonna find informations.
| Parameter | Type Needed |
|---------------|-------------------------|
| `textAtFile` | str |
| `keyColumn` | list[str] |
| `ZipFile` | bool -> False as default|
| `saveLocally` | bool -> True as default |
### Explication
- **textAtFile**
>That's the pattern name of the file that will be generated. <p>
As e.g.: " {} - Document Generated - {}". <p>
The "{}" in string is present because you can personalize the output with the next paramenter — keyColumn
- **keyColumn**
> With the Headers (Keys) which you informate in this list as string, you can provide the current
- **ZipFile & saveLocally**
> It'll build a ZipFile content (in case of ZipFile receives True) and create locally files (in case of saveLocally receives True)
e.g.:
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
handler = DataHandler(r'example.xlsx')
handler.getArchive().setDelimiter('==')
handler.readFile()
build = Builder(handler.getArchive(), r'example.docx')
build.generate()
build.saveAs(textAtFile="DOCS/{}/{} - Document",
keyColumn=['Date', 'Name'],
ZipFile=True,
saveLocally=True)
```
* ### **Getters**
| Method | Output |
|-------------------------|---------------------------------------------|
| `getTimeToGenerate` | _the current time neeeded to generate_ |
| `getIndexSequence` | _the actual sequence of all documents_ |
---
## | **To**
The `To` class provides multiple utilities for transforming dates, times, and monetary values into different formats. Below are the available methods and their usage examples.
---
> ### **1. Language Configuration**
***Before*** using the `Date`, `Hour`, or `Money` utilities, you can set the language using the `To.languageTo()` method.
#### **Languages Supported**
- `'pt_BR'` - Portuguese (Brazil)
- `'es_ES'` - Spanish
- `'en_US'` - English
- `'fr_FR'` - French
- You can use another language which `locale` can handle.
#### **Example**
```python
from WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)
[...]
To.languageTo('pt_BR') # Set language to Portuguese
handler.getArchive().transformData("HOUR", To.Hour().to_hh_mm)
[...]
```
---
> ### **2. Date Manipulation**
The `To.Date()` provides various methods to handle and transform date objects.
#### **Available Methods**
| Method | Output Format | Example Input | Example Output |
|---------------------------------|---------------------|------------------------------|-------------------------------|
| `to_dd_mm` | `dd/m` | `Timestamp('2024-01-01')` | `01/1` |
| `to_dd_MM` | `dd/M` | `Timestamp('2024-01-01')` | `01/January` |
| `to_MM_yy` | `MM/y` | `Timestamp('2024-01-01')` | `January/24` |
| `to_MM_yyyy` | `MM/Y` | `Timestamp('2024-01-01')` | `January/2024` |
| `to_dd_mm_yy` | `dd/mm/yy` | `Timestamp('2024-01-01')` | `01/01/24` |
| `to_dd_mm_yy_periodSep` | `dd.mm.yy` | `Timestamp('2024-01-01')` | `01.01.24` |
| `to_dd_MM_yyyy` | `dd/MM/yyyy` | `Timestamp('2024-01-01')` | `01/January/2024` |
| `to_dd_mm_yyyy` | `dd/mm/yyyy` | `Timestamp('2024-01-01')` | `01/01/2024` |
| `to_mm_dd_yyyy` | `mm/dd/yyyy` | `Timestamp('2024-01-01')` | `01/01/2024` |
| `to_yyyy_mm_dd` | `yyyy-mm-dd` | `Timestamp('2024-01-01')` | `2024-01-01` |
| `to_full_date` | Full Date String | `Timestamp('2024-01-01')` | `Monday, 01 January 2024` |
| `to_dd_MM_yyyy_in_full` | Full Date String | `Timestamp('2024-01-01')` | `01 January 2024` |
| `to_personalizedFormat` | Custom Format | `Timestamp('2024-01-01')` | Based on format provided |
> Input type must be ***Timestamp class***
#### **Example**
* **pattern method use**:
```python
[...]
handler.getArchive().transformData("DATE", To.Date().to_dd_mm_yy_periodSep)
[...]
```
* **to_personalizedFormat**:
It's an exclusive method in < To > class that provides a personalization about data been treated. You can use the same `.strftime()` as [used on pandas](https://pandas.pydata.org/docs/reference/api/pandas.Series.dt.strftime.html).
```python
[...]
handler.getArchive().transformData("DATE",lambda x:To.Date().to_personalizedFormat(x,'%d de %B de %Y'))
[...]
```
---
> ### **3. Time Manipulation**
The `To.Hour()` provides methods for transforming time objects into desired formats.
#### **Available Methods**
| Method | Output Format | Example Input | Example Output |
|----------------------|---------------------|------------------------|--------------------|
| `to_hh_mm_ss` | `HH:MM:SS` | `datetime(11, 30)` | `11:30:00` |
| `to_hh_mm` | `HH:MM` | `datetime(11, 30)` | `11:30` |
| `to_12_hour_format` | `HH:MM AM/PM` | `datetime(23, 30)` | `11:30 PM` |
| `to_24_hour_format` | `HH:MM` | `datetime(23, 30)` | `23:30` |
> Input type must be ***datetime class***
#### **Example**
* **pattern method use**:
```python
[...]
To.languageTo('pt_BR')
handler.getArchive().transformData("HOUR", To.Hour().to_hh_mm)
[...]
```
---
> ### **4. Money Formatting Manipulation**
The `To.Money()` provides methods for formatting monetary values into various currencies.
#### **Available Methods**
| Method | Output Format | Example Input | Example Output |
|------------------|--------------------------|----------------|------------------------|
| `to_dollars` | `$ {value}` | `1234.56` | `$ 1,234.56` |
| `to_euros` | `€ {value}` | `1234.56` | `€ 1.234,56` |
| `to_pounds` | `£ {value}` | `1234.56` | `£ 1,234.56` |
| `to_brl` | `R$ {value}` | `1234.56` | `R$ 1.234,56` |
> Input type must be ***float*** or ***int***
#### **Example**
* **pattern method use**:
```python
[...]
To.languageTo('pt_BR')
handler.getArchive().transformData("VALUE", To.Money().to_brl)
[...]
```
---
## | **Transmitter**
This class could be the first step for your usage on WAVE, because it can analyse a .docx and return a .xlsx file with all headers which where defined at docx.
Everything you need to do is informate the document (it **must have** to be a list) and pass the delimiter. After that, just use the method `export`.
Follow the example:
```python
from WaveFlow import Transmitter
transmitter = Transmitter(['example.xlsx'], '==')
transmitter.export("exampleExport.xlsx")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "wave-flow",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "wave build docx treatdata xlsx to word waveflow wave-flow",
"author": "Lucas Louren\u00e7o",
"author_email": "dev.lucaslourenco@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0d/b8/7fff86e8f8c59be44167bd1202854d956b1565e8c2c0251c49adad0bffbf/wave-flow-1.1.1.tar.gz",
"platform": null,
"description": "# WAVE\r\n> # Workflow Automation and Versatile Engine\r\n\r\n\r\n<div align=\"center\">\r\n<img src=\"RDM_components/img/wave.jpeg\" alt=\"WAVE\" width=\"450px\"/>\r\n</div>\r\n\r\n> Owned by Lucas Louren\u00e7o\r\n\r\n> Maintained by Lucas Louren\u00e7o\r\n\r\n> Translation to [Portuguese](/RDM_components/PT_README.md)\r\n----\r\n\r\n# Getting Started on WAVE\r\nTo use WAVE, execute the following command in your terminal\r\n\r\n##### ```pip install -U wave-flow```\r\n\r\n\r\n\r\n# Examples\r\n\r\n<details open>\r\n<summary>\r\nPractical Examples\r\n</summary>\r\n\r\n<p>\r\n\r\n - [Simple Example](e.g/simple/simpleExample.py)\r\n \r\n - [Complex Example](e.g/complex/complexExample.py)\r\n\r\n - [Complex Example With Classes](e.g/complexWithClass/complexExample2.py)\r\n\r\n</p>\r\n</details>\r\n\r\n\r\n<details open>\r\n<summary>\r\nClass Use Case Example\r\n</summary>\r\n\r\n<p>\r\n\r\n - [DataHandler](#-datahandler)\r\n\r\n - [Builder](#-builder)\r\n \r\n - [To](#-to)\r\n \r\n - [Transmitter](#-transmitter)\r\n\r\n\r\n</p>\r\n</details>\r\n\r\n\r\n---\r\n\r\n# How To Use\r\n\r\n\r\n## | **DataHandler**\r\nThe `DataHandler` class is the first step when you're using WAVE. Using it, you become able to use several features, including the unique way to reach `Archive` class (as shown in the next topic). Below are the methods and it's explication.\r\n\r\n\r\n* #### **DType**\r\n>As [Pandas](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.dtypes.html), you can pass a _DType_ as parameter. The _KEYS_ on this dict must have to be one of the Headers at the column that you want to perform the read as the _VALUE_ data.\r\n\r\ne.g.:\r\n```python\r\nhandler = DataHandler(r'example.xlsx')\r\nhandler.getArchive().setDelimiter('==') # important part of the code that will be shown below.\r\nhandler.setDtype({\"ID\":str, \"DATE\":str})\r\n```\r\n\r\n* #### **Acess Archive**\r\n>To acess the class [Archive](#-archive), the unique way to reach it is using the code below.\r\n\r\ne.g.:\r\n```python\r\nhandler = DataHandler(r'example.xlsx')\r\nhandler.getArchive() # and it's methods as shown\r\n```\r\n\r\n\r\n* #### **Read File**\r\n>After informate the [Delimiter](#-delimiter), and if you think it's necessary, inform the [Dtype](#dtype), you have to read the file.<p>\r\nYou can only read `xlsx`, `csv` and `json`\r\n\r\n\r\ne.g.:\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\nhandler = DataHandler(r'example.xlsx')\r\nhandler.getArchive().setDelimiter('==')\r\nhandler.setDtype({\"ID\":str, \"DATE\":str})\r\nhandler.readFile()\r\n\r\nprint(handler.getArchive().getData()) # -> dict\r\n```\r\n\r\n## | **Archive**\r\nAfter being accessed by the method in [DataHandler (Acess Archive)](#acess-archive), you can manage a lot of data informations. Which them gonna be expressed below.\r\n\r\n* ### **Delimiter**\r\nOne of the most important part of the orchestra. It's necessary and primordial to identify where the placeholders are.\r\n\r\ne.g.:\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\nhandler = DataHandler(r'example.xlsx')\r\nhandler.getArchive().setDelimiter('==')\r\n\r\n[...]\r\n\r\n```\r\n\r\n\r\n* ### **Transform Data**\r\nThis method cooperate with [To](#-to) class. To handle data, `To` has a lot of management about it. You can read more about it [clicking here](#-to).\r\nFollowing the harmony of the structure, it is appropriate that you use this method to process any type of data.\r\n\r\ne.g.:\r\n```python\r\nhandler.getArchive().transformData(\"HOUR\", To.Hour().to_hh_mm)\r\nhandler.getArchive().transformData(\"DATE\", To.Date().to_dd_mm_yyyy)\r\nhandler.getArchive().transformData(\"FINALDATE\", lambda x: To.Date().to_personalizedFormat(x, '%d de %B de %Y'))\r\n```\r\n\r\n\r\n\r\n* ### **Additional Parameter**\r\n`setAdditionalParameters`\r\n\r\nUsing this method, you can personalize formatting configurations to each info which will be placed.\r\nAssuming those obrigatory parameters `keyColumn`, `parameterToChange`, `newValueToParameter`, pay attention to the required data below.\r\n\r\n| **possibilities** | **appropriate data type** | \r\n|-----------------------------|------------------------------|\r\n| bold | bool |\r\n| italic | bool |\r\n| font | string |\r\n| size | int |\r\n\r\n\r\n`keyColumn`: Place here the header which you want to operate.\r\n\r\n`parameterToChange`: Select one of the four possibility.\r\n\r\n`newValueToParameter`: place the proper data to what you wanna format.\r\n\r\ne.g.:\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\n handler = DataHandler(r'example.xlsx')\r\n \r\n handler.getArchive().setDelimiter('==')\r\n handler.readFile()\r\n \r\n handler.getArchive().setAdditionalParameters(\"NAME\", \"size\", 12)\r\n handler.getArchive().setAdditionalParameters(\"NAME\", \"bold\", True)\r\n handler.getArchive().setAdditionalParameters(\"COUNTRY\", 'italic', True)\r\n handler.getArchive().setAdditionalParameters(\"DATE\", \"font\", 'Times New Roman')\r\n \r\n [...]\r\n\r\n```\r\nOR `setAdditionalParametersForAll`<p>\r\n\r\nThis method implements for all headers the same configuration.\r\n\r\ne.g.:\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\n handler = DataHandler(r'example.xlsx')\r\n \r\n handler.getArchive().setDelimiter('==')\r\n handler.readFile()\r\n \r\n handler.getArchive().setAdditionalParametersForAll(\"centralize\", True)\r\n \r\n [...]\r\n\r\n\r\n```\r\n\r\n<!-- \r\n def setAdditionalParameters(self, keyColumn:str, parameterToChange:Literal[\"font\", \"size\", \"italic\", \"bold\"], newValueToParameter):\r\n self.__DictWithData[keyColumn]['additional_parameters'][parameterToChange] = newValueToParameter -->\r\n\r\n\r\n* ### **Getters**\r\n\r\n| **Method Name** | **Return Type** | **Description** |\r\n|------------------------------|-------------------------|---------------------------------------------------------------------------------|\r\n| `getData()` | `dict` | Returns the data dictionary, raises `ReferenceError` if no data is available. **(maybe it's what you're looking for)**|\r\n| `getFileType()` | `str` | Returns the file type of the archive. |\r\n| `getMetaData()` | `list[str]` | Returns a list of metadata associated with the file. |\r\n| `getFilename()` | `str` | Returns the name of the file. |\r\n| `getDesignatedFile()` | `docx.Document` | Returns the designated file object. |\r\n| `getDataFrame()` | `pd.DataFrame` | Returns the data as a DataFrame, raises `ReferenceError` if no DataFrame exists.|\r\n| `getDelimiter()` | `str` | Returns the current delimiter used for key formatting. |\r\n| `getFilesGenerated()` | `list[docx.Document]` | Returns a list of files generated by the system. |\r\n\r\n\r\n---\r\n## | **Builder**\r\nThe `Builder` class requires only two obrigatory parameters. Are them the _instance_ of Archive, it means you **HAVE** to informate \"handler.getArchive()\" as first parameter(archive parameter). As second, you have to informate the base document(baseDocx parameter) which you want to deal.\r\n\r\ne.g.:\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\n\r\nhandler = DataHandler(r'example.xlsx')\r\nhandler.getArchive().setDelimiter('==')\r\nhandler.readFile()\r\n\r\nbuild = Builder(handler.getArchive(), r'example.docx')\r\n\r\n[...]\r\n```\r\n\r\n\r\n* ### **Generation**\r\n`.generate()`\r\n\r\nMethod used to generate the documents. There's no parameters, just need to run it.\r\n\r\ne.g.:\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\n\r\nhandler = DataHandler(r'example.xlsx')\r\nhandler.getArchive().setDelimiter('==')\r\nhandler.readFile()\r\n\r\nbuild = Builder(handler.getArchive(), r'example.docx')\r\nbuild.generate()\r\n\r\n[...]\r\n\r\n```\r\n\r\n\r\n* ### **Saving Generated Files**\r\n`.saveAs()`\r\n\r\nTo save in a zip file or locally, first you have to generate as shown above.\r\n\r\nThis method has a lot of personalization ways to do. Below you gonna find informations.\r\n\r\n\r\n| Parameter | Type Needed |\r\n|---------------|-------------------------|\r\n| `textAtFile` | str |\r\n| `keyColumn` | list[str] |\r\n| `ZipFile` | bool -> False as default|\r\n| `saveLocally` | bool -> True as default |\r\n\r\n### Explication\r\n\r\n- **textAtFile**\r\n\r\n>That's the pattern name of the file that will be generated. <p>\r\nAs e.g.: \" {} - Document Generated - {}\". <p>\r\nThe \"{}\" in string is present because you can personalize the output with the next paramenter \u2014 keyColumn\r\n\r\n\r\n- **keyColumn**\r\n\r\n> With the Headers (Keys) which you informate in this list as string, you can provide the current\r\n\r\n- **ZipFile & saveLocally**\r\n\r\n> It'll build a ZipFile content (in case of ZipFile receives True) and create locally files (in case of saveLocally receives True)\r\n\r\n\r\ne.g.:\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\n\r\nhandler = DataHandler(r'example.xlsx')\r\nhandler.getArchive().setDelimiter('==')\r\nhandler.readFile()\r\n\r\nbuild = Builder(handler.getArchive(), r'example.docx')\r\nbuild.generate()\r\n\r\nbuild.saveAs(textAtFile=\"DOCS/{}/{} - Document\",\r\n keyColumn=['Date', 'Name'], \r\n ZipFile=True, \r\n saveLocally=True)\r\n```\r\n\r\n\r\n* ### **Getters**\r\n| Method | Output |\r\n|-------------------------|---------------------------------------------|\r\n| `getTimeToGenerate` | _the current time neeeded to generate_ |\r\n| `getIndexSequence` | _the actual sequence of all documents_ |\r\n\r\n---\r\n## | **To**\r\n\r\nThe `To` class provides multiple utilities for transforming dates, times, and monetary values into different formats. Below are the available methods and their usage examples.\r\n\r\n---\r\n\r\n\r\n> ### **1. Language Configuration**\r\n***Before*** using the `Date`, `Hour`, or `Money` utilities, you can set the language using the `To.languageTo()` method.\r\n\r\n#### **Languages Supported**\r\n- `'pt_BR'` - Portuguese (Brazil)\r\n- `'es_ES'` - Spanish\r\n- `'en_US'` - English\r\n- `'fr_FR'` - French\r\n- You can use another language which `locale` can handle.\r\n\r\n#### **Example**\r\n```python\r\nfrom WaveFlow import (PreRequisitesWave, To, DataHandler, Builder, Transmitter)\r\n\r\n[...]\r\n\r\nTo.languageTo('pt_BR') # Set language to Portuguese\r\nhandler.getArchive().transformData(\"HOUR\", To.Hour().to_hh_mm)\r\n\r\n[...]\r\n```\r\n\r\n\r\n---\r\n\r\n> ### **2. Date Manipulation**\r\nThe `To.Date()` provides various methods to handle and transform date objects.\r\n\r\n#### **Available Methods**\r\n| Method | Output Format | Example Input | Example Output |\r\n|---------------------------------|---------------------|------------------------------|-------------------------------|\r\n| `to_dd_mm` | `dd/m` | `Timestamp('2024-01-01')` | `01/1` |\r\n| `to_dd_MM` | `dd/M` | `Timestamp('2024-01-01')` | `01/January` |\r\n| `to_MM_yy` | `MM/y` | `Timestamp('2024-01-01')` | `January/24` |\r\n| `to_MM_yyyy` | `MM/Y` | `Timestamp('2024-01-01')` | `January/2024` |\r\n| `to_dd_mm_yy` | `dd/mm/yy` | `Timestamp('2024-01-01')` | `01/01/24` |\r\n| `to_dd_mm_yy_periodSep` | `dd.mm.yy` | `Timestamp('2024-01-01')` | `01.01.24` |\r\n| `to_dd_MM_yyyy` | `dd/MM/yyyy` | `Timestamp('2024-01-01')` | `01/January/2024` |\r\n| `to_dd_mm_yyyy` | `dd/mm/yyyy` | `Timestamp('2024-01-01')` | `01/01/2024` |\r\n| `to_mm_dd_yyyy` | `mm/dd/yyyy` | `Timestamp('2024-01-01')` | `01/01/2024` |\r\n| `to_yyyy_mm_dd` | `yyyy-mm-dd` | `Timestamp('2024-01-01')` | `2024-01-01` |\r\n| `to_full_date` | Full Date String | `Timestamp('2024-01-01')` | `Monday, 01 January 2024` |\r\n| `to_dd_MM_yyyy_in_full` | Full Date String | `Timestamp('2024-01-01')` | `01 January 2024` |\r\n| `to_personalizedFormat` | Custom Format | `Timestamp('2024-01-01')` | Based on format provided |\r\n\r\n> Input type must be ***Timestamp class***\r\n#### **Example**\r\n* **pattern method use**:\r\n```python\r\n[...]\r\n\r\nhandler.getArchive().transformData(\"DATE\", To.Date().to_dd_mm_yy_periodSep)\r\n\r\n[...]\r\n```\r\n* **to_personalizedFormat**:\r\n\r\n It's an exclusive method in < To > class that provides a personalization about data been treated. You can use the same `.strftime()` as [used on pandas](https://pandas.pydata.org/docs/reference/api/pandas.Series.dt.strftime.html).\r\n```python\r\n[...]\r\n\r\nhandler.getArchive().transformData(\"DATE\",lambda x:To.Date().to_personalizedFormat(x,'%d de %B de %Y'))\r\n\r\n[...]\r\n```\r\n\r\n\r\n---\r\n\r\n> ### **3. Time Manipulation**\r\nThe `To.Hour()` provides methods for transforming time objects into desired formats.\r\n\r\n#### **Available Methods**\r\n| Method | Output Format | Example Input | Example Output |\r\n|----------------------|---------------------|------------------------|--------------------|\r\n| `to_hh_mm_ss` | `HH:MM:SS` | `datetime(11, 30)` | `11:30:00` |\r\n| `to_hh_mm` | `HH:MM` | `datetime(11, 30)` | `11:30` |\r\n| `to_12_hour_format` | `HH:MM AM/PM` | `datetime(23, 30)` | `11:30 PM` |\r\n| `to_24_hour_format` | `HH:MM` | `datetime(23, 30)` | `23:30` |\r\n\r\n> Input type must be ***datetime class***\r\n\r\n#### **Example**\r\n* **pattern method use**:\r\n```python\r\n[...]\r\n\r\nTo.languageTo('pt_BR')\r\nhandler.getArchive().transformData(\"HOUR\", To.Hour().to_hh_mm)\r\n\r\n[...]\r\n```\r\n\r\n---\r\n\r\n\r\n\r\n> ### **4. Money Formatting Manipulation**\r\nThe `To.Money()` provides methods for formatting monetary values into various currencies.\r\n\r\n#### **Available Methods**\r\n| Method | Output Format | Example Input | Example Output |\r\n|------------------|--------------------------|----------------|------------------------|\r\n| `to_dollars` | `$ {value}` | `1234.56` | `$ 1,234.56` |\r\n| `to_euros` | `\u20ac {value}` | `1234.56` | `\u20ac 1.234,56` |\r\n| `to_pounds` | `\u00a3 {value}` | `1234.56` | `\u00a3 1,234.56` |\r\n| `to_brl` | `R$ {value}` | `1234.56` | `R$ 1.234,56` |\r\n\r\n> Input type must be ***float*** or ***int***\r\n\r\n#### **Example**\r\n* **pattern method use**:\r\n```python\r\n[...]\r\n\r\nTo.languageTo('pt_BR')\r\nhandler.getArchive().transformData(\"VALUE\", To.Money().to_brl)\r\n\r\n[...]\r\n```\r\n\r\n---\r\n\r\n## | **Transmitter**\r\nThis class could be the first step for your usage on WAVE, because it can analyse a .docx and return a .xlsx file with all headers which where defined at docx.\r\n\r\nEverything you need to do is informate the document (it **must have** to be a list) and pass the delimiter. After that, just use the method `export`.\r\nFollow the example:\r\n\r\n```python\r\nfrom WaveFlow import Transmitter\r\n\r\ntransmitter = Transmitter(['example.xlsx'], '==')\r\ntransmitter.export(\"exampleExport.xlsx\")\r\n\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "WAVE - Workflow Automation and Versatile Engine",
"version": "1.1.1",
"project_urls": null,
"split_keywords": [
"wave",
"build",
"docx",
"treatdata",
"xlsx",
"to",
"word",
"waveflow",
"wave-flow"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0db87fff86e8f8c59be44167bd1202854d956b1565e8c2c0251c49adad0bffbf",
"md5": "828d6646d809317fed320e5b0632aae1",
"sha256": "64097964e13f20a89a2f8aeeae9e5ab878c6672c6bf437e4cf4672469915fdd7"
},
"downloads": -1,
"filename": "wave-flow-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "828d6646d809317fed320e5b0632aae1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16355,
"upload_time": "2024-12-05T13:57:08",
"upload_time_iso_8601": "2024-12-05T13:57:08.170433Z",
"url": "https://files.pythonhosted.org/packages/0d/b8/7fff86e8f8c59be44167bd1202854d956b1565e8c2c0251c49adad0bffbf/wave-flow-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-05 13:57:08",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "wave-flow"
}