|
| 1 | +.. _track_d_byod_gnucash: |
| 2 | + |
| 3 | +=========================================== |
| 4 | +Track D BYOD with GnuCash (core_gl profile) |
| 5 | +=========================================== |
| 6 | + |
| 7 | +GnuCash is a **free, open-source** double-entry accounting system. |
| 8 | +In Track D, we use it as a “real but accessible” source system: |
| 9 | + |
| 10 | +- it produces realistic **multi-line split** exports (not toy spreadsheets) |
| 11 | +- it teaches a *cleaning + normalization* lesson that matches real analytics work |
| 12 | +- it requires **no trials** and works offline |
| 13 | + |
| 14 | +What you’ll do |
| 15 | +-------------- |
| 16 | + |
| 17 | +1. Create a tiny mock business in GnuCash (guided transaction list). |
| 18 | +2. Export your transactions using **Export Transactions to CSV** with **Simple Layout OFF**. |
| 19 | +3. Run the Track D BYOD normalization pipeline to produce: |
| 20 | + |
| 21 | + - ``normalized/chart_of_accounts.csv`` |
| 22 | + - ``normalized/gl_journal.csv`` |
| 23 | + |
| 24 | +Downloads (demo pack) |
| 25 | +--------------------- |
| 26 | + |
| 27 | +If you want to follow along quickly, download: |
| 28 | + |
| 29 | +- :download:`Transaction list to enter in GnuCash <_downloads/gnucash_demo/gnucash_demo_transactions_to_enter.csv>` |
| 30 | +- :download:`Demo export (complex/multi-line) <_downloads/gnucash_demo/gnucash_demo_export_complex.csv>` |
| 31 | + |
| 32 | +The export file above is **adapter-ready** (it matches what the ``gnucash_gl`` adapter expects). |
| 33 | + |
| 34 | +Step 1 — Create a tiny GnuCash book |
| 35 | +----------------------------------- |
| 36 | + |
| 37 | +In GnuCash, create a new file (a “book”). |
| 38 | + |
| 39 | +You can either: |
| 40 | + |
| 41 | +- use a default “Small Business” chart of accounts, *or* |
| 42 | +- create only the accounts you need (minimum below) |
| 43 | + |
| 44 | +Minimum accounts used in the demo: |
| 45 | + |
| 46 | +- ``Assets:Current Assets:Checking`` |
| 47 | +- ``Assets:Equipment`` |
| 48 | +- ``Liabilities:Credit Card`` |
| 49 | +- ``Liabilities:Sales Tax Payable`` |
| 50 | +- ``Equity:Owner Capital`` |
| 51 | +- ``Income:Sales`` |
| 52 | +- ``Expenses:Supplies`` |
| 53 | +- ``Expenses:Rent`` |
| 54 | +- ``Expenses:Shipping`` |
| 55 | +- ``Expenses:Advertising`` |
| 56 | + |
| 57 | +Step 2 — Enter the demo transactions |
| 58 | +------------------------------------ |
| 59 | + |
| 60 | +Use the downloaded transaction list as your guide: |
| 61 | + |
| 62 | +:download:`gnucash_demo_transactions_to_enter.csv <_downloads/gnucash_demo/gnucash_demo_transactions_to_enter.csv>` |
| 63 | + |
| 64 | +Tips: |
| 65 | + |
| 66 | +- Most entries can be done in the **Checking** register. |
| 67 | +- For the “sales tax” example, use a **split** transaction. |
| 68 | +- For the credit-card equipment purchase, enter it in the **Credit Card** register. |
| 69 | + |
| 70 | +Step 3 — Export from GnuCash (complex layout) |
| 71 | +--------------------------------------------- |
| 72 | + |
| 73 | +Use: |
| 74 | + |
| 75 | +``File → Export → Export Transactions to CSV`` |
| 76 | + |
| 77 | +Critical setting: |
| 78 | + |
| 79 | +- **Uncheck** “Simple Layout” (this creates the multi-line export) |
| 80 | + |
| 81 | +Export a CSV that includes your accounts and the date range that covers your demo transactions. |
| 82 | + |
| 83 | +Step 4 — Initialize a Track D BYOD project |
| 84 | +------------------------------------------ |
| 85 | + |
| 86 | +From your PyStatsV1 repo root (or any folder you like): |
| 87 | + |
| 88 | +.. code-block:: console |
| 89 | +
|
| 90 | + pystatsv1 trackd byod init --dest byod/gnucash_demo --profile core_gl |
| 91 | +
|
| 92 | +This creates: |
| 93 | + |
| 94 | +- ``tables/`` (where you place exports) |
| 95 | +- ``normalized/`` (generated outputs) |
| 96 | +- ``config.toml`` (tiny config: profile, tables_dir, adapter) |
| 97 | + |
| 98 | +Step 5 — Point the project at the GnuCash adapter |
| 99 | +------------------------------------------------- |
| 100 | + |
| 101 | +Open: |
| 102 | + |
| 103 | +``byod/gnucash_demo/config.toml`` |
| 104 | + |
| 105 | +Change: |
| 106 | + |
| 107 | +.. code-block:: toml |
| 108 | +
|
| 109 | + [trackd] |
| 110 | + adapter = "gnucash_gl" |
| 111 | +
|
| 112 | +(Leave ``profile = "core_gl"`` as-is.) |
| 113 | + |
| 114 | +Step 6 — Place your export in the expected location |
| 115 | +--------------------------------------------------- |
| 116 | + |
| 117 | +Copy your GnuCash export CSV to: |
| 118 | + |
| 119 | +``byod/gnucash_demo/tables/gl_journal.csv`` |
| 120 | + |
| 121 | +Yes, the file is called ``gl_journal.csv`` even though it is still “raw export.” |
| 122 | +The adapter reads this file and writes the canonical tables to ``normalized/``. |
| 123 | + |
| 124 | +If you want to test without GnuCash, copy the demo export instead: |
| 125 | + |
| 126 | +.. code-block:: console |
| 127 | +
|
| 128 | + # (Windows PowerShell) |
| 129 | + copy docs\source\workbook\_downloads\gnucash_demo\gnucash_demo_export_complex.csv byod\gnucash_demo\tables\gl_journal.csv |
| 130 | +
|
| 131 | + # (macOS/Linux) |
| 132 | + cp docs/source/workbook/_downloads/gnucash_demo/gnucash_demo_export_complex.csv byod/gnucash_demo/tables/gl_journal.csv |
| 133 | +
|
| 134 | +Step 7 — Normalize |
| 135 | +------------------ |
| 136 | + |
| 137 | +Run: |
| 138 | + |
| 139 | +.. code-block:: console |
| 140 | +
|
| 141 | + pystatsv1 trackd byod normalize --project byod/gnucash_demo |
| 142 | +
|
| 143 | +You should now have: |
| 144 | + |
| 145 | +- ``byod/gnucash_demo/normalized/chart_of_accounts.csv`` |
| 146 | +- ``byod/gnucash_demo/normalized/gl_journal.csv`` |
| 147 | + |
| 148 | +Step 8 — Validate the normalized tables |
| 149 | +--------------------------------------- |
| 150 | + |
| 151 | +.. code-block:: console |
| 152 | +
|
| 153 | + pystatsv1 trackd validate --datadir byod/gnucash_demo/normalized --profile core_gl |
| 154 | +
|
| 155 | +Step 9 — Do a first analysis |
| 156 | +---------------------------- |
| 157 | + |
| 158 | +Go to: |
| 159 | + |
| 160 | +- :doc:`track_d_byod_gnucash_demo_analysis` (daily totals + basic plots), or |
| 161 | +- :doc:`track_d_my_own_data` (the general “apply Track D to your data” bridge) |
| 162 | + |
| 163 | +Troubleshooting |
| 164 | +--------------- |
| 165 | + |
| 166 | +- If normalization complains about missing columns, re-export and confirm **Simple Layout is OFF**. |
| 167 | +- If numbers import incorrectly (decimal commas, etc.), adjust your export settings so amounts use a ``.`` decimal. |
0 commit comments