|
1 | 1 | !!! pied-piper ":bulb: TL;DR - Import WebGenAI Project"
|
2 | 2 |
|
3 |
| - You can import WegGenAI projects, merging their data models and rules into a dev project. |
| 3 | + You can import WebGenAI projects, merging their data models and rules into a dev project. |
4 | 4 |
|
5 |
| - Under construction, coming soon. |
| 5 | + `als genai-utils --import-genai --using=<WebGenAI-Project>` |
6 | 6 |
|
7 | 7 |
|
| 8 | + |
| 9 | +# Coordinating Parallel Dev Streams (Multi-Team Development) |
| 10 | + |
| 11 | +This is the Diego Lo Giudice challenge: enable ongoing parallel development with both the LOB and Dev *teams.* It's enabled by declarative technology, where the integration is done with software, not manual effort. |
| 12 | + |
| 13 | +It works like this: |
| 14 | + |
| 15 | +1. The project begins with the **Kickstart:** several iterations to get *solid requirements*. |
| 16 | + * Uses Natural Language and Declarative Rules |
| 17 | + |
| 18 | +2. The project is **exported:** the Dev Team begin work on the Custom UI, Enterprise Integration, etc |
| 19 | + * This is *not* the end of declarative: logic is either or both of Natural Language, and Python DSL |
| 20 | + |
| 21 | +3. As depicted in the **divergent arcs:** there are now 2 versions of the project. Both can, in parallel, introduce new rules and attributes. This is not just "Team Development", it is ***TeamS Development***. |
| 22 | + * **LOB Parallel:** (WG_Team): new rules & attributes |
| 23 | + * Observe: WG is not a day-1-only pilot... |
| 24 | + * They continue to use the Natural Language Web-Based interface (WebGenai) |
| 25 | + * **Dev_Team:** their own new rules & attributes, using either genai Natural Language and/or alembic... |
| 26 | + * In addition, the server team also uses Python (and) and libs as required, e.g. for enterprise integration. |
| 27 | + * They do this in their favorite IDE, with tools such as GitHub etc. |
| 28 | + * Observe the logic remains at a high lev |
| 29 | + * The UI team can use familiar tools for Custom UIs. These |
| 30 | + * leverage the API (ready day 1, so they are not blocked on API Dev), and |
| 31 | + * are dramatically simplified by automated backend rule-based logic |
| 32 | + |
| 33 | +4. **Export 2:** illustrates that the LOB WG_Team can export their project. The dev team can import it using the API Logic Server CLI. |
| 34 | + |
| 35 | + * This automatically integrates rules and attributes from both projects, **updating the dev project with a new database and models.** |
| 36 | + * This is virtually impossible with procedural code, because developers must manually assess the execution dependencies and order the logic properly. It time-consuming, complex, and error-prone - just like post deployment maintenance. |
| 37 | + * The integration is automatic and "safe" because logic is expressed in a declarative rules/models for which *ordering is automatic.* |
| 38 | + * It also rebuilds the test data, per your rules (e.g. sum/count values) |
| 39 | + * The process supports multiple exports. |
| 40 | + |
| 41 | +<br/> |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +<br/> |
| 46 | + |
| 47 | +# Exploring Import |
| 48 | + |
| 49 | +<br/> |
| 50 | + |
| 51 | +## Setup: Manager pre-installs Import Sample |
| 52 | + |
| 53 | +When [you create the manager (**strongly recommended**)](https://apilogicserver.github.io/Docs/Manager/), the system installs 3 sample projects you can use to explore import. |
| 54 | + |
| 55 | +1. **Base Project** is GenAI_no_logic. No rule-based attributes. See `system/genai/examples/genai_demo/wg_dev_merge/base_genai_demo_no_logic`. It's not really used, just provided as a reference. |
| 56 | + |
| 57 | +2. **Dev Project** was created with export-1, and has added rules for `carbon_neutral`. It is ready for export-2. See `system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed` |
| 58 | + |
| 59 | +3. **WG project** has continued from export-1 to add our standard customer.balance rules. It is ready for export-2. See `system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed`. |
| 60 | + |
| 61 | + * It has an `docs/export/export.json`, which describes the data model and rules from the WG project. This is used for import. |
| 62 | + |
| 63 | +The naming convention is that these started with no rules, had rules added, and were **"fixed"** by Genai-Logic to update the data model. |
| 64 | + |
| 65 | +<br/> |
| 66 | + |
| 67 | +## Usage |
| 68 | + |
| 69 | +Imports are performed from with the dev project, using the `import-genai` CLI command: |
| 70 | + |
| 71 | +```bash |
| 72 | +cd system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed |
| 73 | +als genai-utils --import-genai --using=../wg_demo_no_logic_fixed |
| 74 | +``` |
| 75 | + |
| 76 | +That will leave things in this state: |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +The `import-genai` command creates the `docs/import` directory and the following files, as shown above: |
| 81 | + |
| 82 | +* `request.json` is sent to ChatGPT. It contains both models, and a command to merge them |
| 83 | +* `response.json` is the merged model. It should reflect the attributes from both sides, as shown |
| 84 | +* The response is translated to `system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed/docs/import/create_db_models.py` |
| 85 | +* The system creates `docs/import/create_db_models.py/create_db_models.sqlite` by executing the file above. |
| 86 | +* The system then uses this to update the dev project: |
| 87 | + * update the dev `database/db.sqlite` and |
| 88 | + * Runs `--rebuild-from-database`. This updates the model, the api, etc from the new database. |
| 89 | + * **It's good practice to verify these**. Make sure all the attributes from both sources are reflected in the updated **database** and **models** noted above. |
| 90 | + |
| 91 | +<br/> |
| 92 | + |
| 93 | +### Restart option for failure recovery |
| 94 | + |
| 95 | +It may fail, requiring either a **re-run** or an `import-resume`: |
| 96 | + |
| 97 | +* **Re-run** is indicated if the data model is missing attributes, incorrect or imcomplete. |
| 98 | + 1. make sure to get initial `system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed/database/models.py` (eg, update from models_for_resume.py) |
| 99 | + 2. delete or rename the `docs/import` directory. |
| 100 | + |
| 101 | +* `import-resume` can be used if you can repair the file below, e.g., a minor syntax error. |
| 102 | + 1. fix `system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed/docs/import/create_db_models.py` |
| 103 | + * Note: you can run this standalone with your IDE to verify it. It should create `create_db_models.sqlite` in your `docs/import` directory. |
| 104 | + 2. make sure to get initial system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed/database/models.py (eg, update from models_for_resume.py) |
| 105 | + |
| 106 | +```bash |
| 107 | +cd system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed |
| 108 | +als genai-utils --import-genai --using=../wg_demo_no_logic_fixed --import-resume |
| 109 | +``` |
| 110 | + |
| 111 | +<br/> |
| 112 | + |
| 113 | +# Appendices |
| 114 | + |
| 115 | +<br/> |
| 116 | + |
| 117 | +## Ground Rules |
| 118 | +* No Dev_Team -> WG_Team integration (just deploy Dev_Team version, and use) |
| 119 | + * Dev team code cannot be integrated into WG - dependencies, libs, integration, ... |
| 120 | +* WG_Team - serial dev (as now) |
| 121 | +* WG_Team logic files are separate from Dev_Team (eg, using logic/discovery) |
| 122 | +* sqlite only, for now (presume upgrade to 'some other db' is doable later) |
| 123 | + * Tyler, what were the issues you mentioned in sqlite that forced you to use PG? |
| 124 | +* All Dev_Team and logic generations are finished before merge-G |
| 125 | + |
| 126 | +<br/> |
| 127 | + |
0 commit comments