starting admin work
This commit is contained in:
289
docs/LineageCheck.md
Normal file
289
docs/LineageCheck.md
Normal file
@ -0,0 +1,289 @@
|
||||
# Neo4j Lineage Verification Guide
|
||||
|
||||
Use this guide to confirm that your plants and LINEAGE relationships have been imported correctly into Neo4j. Save this file as `neo4j_lineage_check.md` for future reference.
|
||||
|
||||
---
|
||||
|
||||
## 1. Open the Neo4j Browser
|
||||
|
||||
1. **Ensure Neo4j is running.**
|
||||
In a Docker‐Compose setup, Neo4j is typically exposed at:
|
||||
|
||||
```
|
||||
http://localhost:7474
|
||||
```
|
||||
2. **Log in** with your Neo4j credentials (e.g., username `neo4j`, password as configured).
|
||||
|
||||
Once logged in, you can execute Cypher commands in the query pane on the left.
|
||||
|
||||
---
|
||||
|
||||
## 2. Verify That Your `Plant` Nodes Exist
|
||||
|
||||
Before checking relationships, confirm that nodes were created:
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant)
|
||||
RETURN p.uuid AS uuid, p.name AS common_name
|
||||
LIMIT 20;
|
||||
```
|
||||
|
||||
* This query will return up to 20 plant nodes with their `uuid` and `name` properties.
|
||||
* If you see your imported plants here, it means the nodes exist in the database.
|
||||
|
||||
---
|
||||
|
||||
## 3. Check Direct Parent→Child LINEAGE Pairs
|
||||
|
||||
To list all direct child→parent relationships:
|
||||
|
||||
```cypher
|
||||
MATCH (child:Plant)-[:LINEAGE]->(parent:Plant)
|
||||
RETURN child.uuid AS child_uuid, parent.uuid AS parent_uuid
|
||||
LIMIT 50;
|
||||
```
|
||||
|
||||
* Each row represents one `(:Plant)-[:LINEAGE]->(:Plant)` relationship.
|
||||
* `child_uuid` is the UUID of the child node, and `parent_uuid` is the UUID of its direct parent.
|
||||
|
||||
---
|
||||
|
||||
## 4. Look Up a Specific Plant by UUID or Name
|
||||
|
||||
If you know a particular plant’s UUID, you can confirm its properties:
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant {uuid: "YOUR_UUID_HERE"})
|
||||
RETURN p.uuid AS uuid, p.name AS common_name, p.scientific_name AS sci_name;
|
||||
```
|
||||
|
||||
Alternatively, if you only know the common name:
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant)
|
||||
WHERE p.name = "Common Name Here"
|
||||
RETURN p.uuid AS uuid, p.name AS common_name, p.scientific_name AS sci_name;
|
||||
```
|
||||
|
||||
This helps you find the exact UUID or check that the `name` and `scientific_name` properties were stored correctly.
|
||||
|
||||
---
|
||||
|
||||
## 5. Show Children of a Given Parent
|
||||
|
||||
To list all direct children of a specific parent by UUID:
|
||||
|
||||
```cypher
|
||||
MATCH (parent:Plant {uuid: "PARENT_UUID_HERE"})<-[:LINEAGE]-(child:Plant)
|
||||
RETURN child.uuid AS child_uuid, child.name AS child_name;
|
||||
```
|
||||
|
||||
* This returns every plant node that points to the specified `parent_uuid` via a `LINEAGE` relationship.
|
||||
|
||||
---
|
||||
|
||||
## 6. Visualize a Subtree Around One Node
|
||||
|
||||
To visualize a parent node and its children in graph form:
|
||||
|
||||
```cypher
|
||||
MATCH subtree = (parent:Plant {uuid: "PARENT_UUID_HERE"})<-[:LINEAGE]-(child:Plant)
|
||||
RETURN subtree;
|
||||
```
|
||||
|
||||
* Switch to the “Graph” view in the Neo4j browser to see a node for the parent with arrows pointing to each child.
|
||||
|
||||
---
|
||||
|
||||
## 7. Walk the Full Ancestor Chain (Multi‐Level)
|
||||
|
||||
If you want to see all ancestors of a given child, use a variable‐length pattern:
|
||||
|
||||
```cypher
|
||||
MATCH path = (desc:Plant {uuid: "CHILD_UUID_HERE"})-[:LINEAGE*1..]->(anc:Plant)
|
||||
RETURN path;
|
||||
```
|
||||
|
||||
* `[:LINEAGE*1..]` indicates “follow one or more consecutive `LINEAGE` relationships upward.”
|
||||
* In “Graph” view, Neo4j will display the entire chain from child → parent → grandparent → …
|
||||
|
||||
To return just the list of ancestor UUIDs:
|
||||
|
||||
```cypher
|
||||
MATCH (start:Plant {uuid: "CHILD_UUID_HERE"})-[:LINEAGE*1..]->(anc:Plant)
|
||||
RETURN DISTINCT anc.uuid AS ancestor_uuid;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. Show All Descendants of a Given Parent
|
||||
|
||||
To find all descendants (children, grandchildren, etc.) of a root node:
|
||||
|
||||
```cypher
|
||||
MATCH (root:Plant {uuid: "ROOT_UUID_HERE"})<-[:LINEAGE*]-(desc:Plant)
|
||||
RETURN desc.uuid AS descendant_uuid, desc.name AS descendant_name;
|
||||
```
|
||||
|
||||
* The pattern `[:LINEAGE*]` (with no lower bound specified) matches zero or more hops.
|
||||
* To visualize the full descendant tree:
|
||||
|
||||
```cypher
|
||||
MATCH subtree = (root:Plant {uuid: "ROOT_UUID_HERE"})<-[:LINEAGE*]-(desc:Plant)
|
||||
RETURN subtree;
|
||||
```
|
||||
|
||||
Then switch to “Graph” view.
|
||||
|
||||
---
|
||||
|
||||
## 9. Combining Queries for a Full Walk‐Through
|
||||
|
||||
1. **List a few plants** (to copy a known UUID):
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant)
|
||||
RETURN p.uuid AS uuid, p.name AS common_name
|
||||
LIMIT 10;
|
||||
```
|
||||
2. **Pick one UUID** (e.g. `"2ee2e0e7-69de-4b8f-abfe-4ed973c3d760"`).
|
||||
3. **Show its direct children**:
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant {uuid: "2ee2e0e7-69de-4b8f-abfe-4ed973c3d760"})<-[:LINEAGE]-(child:Plant)
|
||||
RETURN child.uuid AS child_uuid, child.name AS child_name;
|
||||
```
|
||||
4. **Show its parent** (if any):
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant {uuid: "8b1059c8-8dd3-487a-af19-1eb548788e87"})-[:LINEAGE]->(parent:Plant)
|
||||
RETURN parent.uuid AS parent_uuid, parent.name AS parent_name;
|
||||
```
|
||||
5. **Get the full ancestor chain** of that child:
|
||||
|
||||
```cypher
|
||||
MATCH path = (c:Plant {uuid: "8b1059c8-8dd3-487a-af19-1eb548788e87"})-[:LINEAGE*1..]->(anc:Plant)
|
||||
RETURN path;
|
||||
```
|
||||
6. **Get the full descendant tree** of that parent:
|
||||
|
||||
```cypher
|
||||
MATCH subtree = (root:Plant {uuid: "2ee2e0e7-69de-4b8f-abfe-4ed973c3d760"})<-[:LINEAGE*]-(desc:Plant)
|
||||
RETURN subtree;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. Checking via Python (Optional)
|
||||
|
||||
If you prefer to script these checks using the Neo4j Bolt driver from Python, here’s a quick example:
|
||||
|
||||
```python
|
||||
from neo4j import GraphDatabase
|
||||
|
||||
uri = "bolt://localhost:7687"
|
||||
auth = ("neo4j", "your_password")
|
||||
driver = GraphDatabase.driver(uri, auth=auth)
|
||||
|
||||
def print_lineage(tx, plant_uuid):
|
||||
# Show direct parent
|
||||
result = tx.run(
|
||||
"MATCH (c:Plant {uuid:$u})-[:LINEAGE]->(p:Plant) "
|
||||
"RETURN p.uuid AS parent_uuid, p.name AS parent_name",
|
||||
u=plant_uuid
|
||||
)
|
||||
for row in result:
|
||||
print(f"Parent of {plant_uuid}: {row['parent_uuid']} ({row['parent_name']})")
|
||||
|
||||
# Show all ancestors
|
||||
result2 = tx.run(
|
||||
"MATCH path = (c:Plant {uuid:$u})-[:LINEAGE*1..]->(anc:Plant) "
|
||||
"RETURN [n IN nodes(path) | n.uuid] AS all_uuids",
|
||||
u=plant_uuid
|
||||
)
|
||||
for row in result2:
|
||||
print("Ancestor chain UUIDs:", row["all_uuids"])
|
||||
|
||||
with driver.session() as session:
|
||||
session.read_transaction(print_lineage, "8b1059c8-8dd3-487a-af19-1eb548788e87")
|
||||
|
||||
driver.close()
|
||||
```
|
||||
|
||||
* Install `neo4j` Python package if needed:
|
||||
|
||||
```bash
|
||||
pip install neo4j
|
||||
```
|
||||
* Adjust the `uri` and `auth` values to match your Neo4j setup.
|
||||
|
||||
---
|
||||
|
||||
## 11. Summary of Key Cypher Queries
|
||||
|
||||
* **List all plants (sample):**
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant)
|
||||
RETURN p.uuid AS uuid, p.name AS common_name
|
||||
LIMIT 20;
|
||||
```
|
||||
|
||||
* **List direct parent→child relationships:**
|
||||
|
||||
```cypher
|
||||
MATCH (child:Plant)-[:LINEAGE]->(parent:Plant)
|
||||
RETURN child.uuid AS child_uuid, parent.uuid AS parent_uuid;
|
||||
```
|
||||
|
||||
* **List direct children of a parent:**
|
||||
|
||||
```cypher
|
||||
MATCH (parent:Plant {uuid:"PARENT_UUID"})<-[:LINEAGE]-(child:Plant)
|
||||
RETURN child.uuid AS child_uuid, child.name AS child_name;
|
||||
```
|
||||
|
||||
* **List direct parent of a child:**
|
||||
|
||||
```cypher
|
||||
MATCH (child:Plant {uuid:"CHILD_UUID"})-[:LINEAGE]->(parent:Plant)
|
||||
RETURN parent.uuid AS parent_uuid, parent.name AS parent_name;
|
||||
```
|
||||
|
||||
* **Visualize parent + children subgraph:**
|
||||
|
||||
```cypher
|
||||
MATCH subtree = (parent:Plant {uuid:"PARENT_UUID"})<-[:LINEAGE]-(child:Plant)
|
||||
RETURN subtree;
|
||||
```
|
||||
|
||||
* **Full ancestor chain for a child:**
|
||||
|
||||
```cypher
|
||||
MATCH path = (c:Plant {uuid:"CHILD_UUID"})-[:LINEAGE*1..]->(anc:Plant)
|
||||
RETURN path;
|
||||
```
|
||||
|
||||
* **Full descendant tree for a parent:**
|
||||
|
||||
```cypher
|
||||
MATCH subtree = (root:Plant {uuid:"PARENT_UUID"})<-[:LINEAGE*]-(desc:Plant)
|
||||
RETURN subtree;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Usage Tips
|
||||
|
||||
* **Switch between “Table” and “Graph” views** in the Neo4j Browser to see raw data vs. visual graph.
|
||||
* Use `LIMIT` when you only want a quick preview of results.
|
||||
* To filter by partial names, you can do:
|
||||
|
||||
```cypher
|
||||
MATCH (p:Plant)
|
||||
WHERE toLower(p.name) CONTAINS toLower("baltic")
|
||||
RETURN p.uuid, p.name;
|
||||
```
|
||||
* Remember to enclose string literals in double quotes (`"..."`) and escape any internal quotes if needed.
|
||||
|
||||
Keep this guide handy for whenever you need to verify or debug your Neo4j lineage data!
|
68
docs/main-app.txt
Normal file
68
docs/main-app.txt
Normal file
@ -0,0 +1,68 @@
|
||||
**Full Development Prompt for Nature in Pots**
|
||||
|
||||
**Context:**
|
||||
You are ChatGPT, assisting with the continued development of the "Nature in Pots" Flask web application. The app uses MySQL, Neo4j, SQLAlchemy, Flask-Migrate, and a plugin structure. You will be provided a ZIP file containing the entire codebase. Your task is to:
|
||||
|
||||
1. **Review Every File in the ZIP**
|
||||
|
||||
* **Scan every single line and file** without exceptions or omissions.
|
||||
* Only use code present in the ZIP as source of truth. Do **not** assume or generate context beyond what the files contain.
|
||||
* Persistently store the reviewed code in memory for reference in all subsequent responses.
|
||||
|
||||
2. **Incorporate All Historical Changes & Conversations**
|
||||
|
||||
* The code you see may already include modifications from earlier prompts (media plugin, submissions plugin, vendor affiliation, image voting, vendor claims, etc.). When generating any new code, **explicitly reference existing code** structures, naming conventions, imports, and file placements from the ZIP.
|
||||
* Integrate **all features and rules** we have specified so far, including but not limited to:
|
||||
|
||||
* **Authentication & Core Models**: `User`, `Role`, `user_roles` many-to-many, `has_role()`, hashed passwords, Flask-Login user\_loader, CSRF on auth forms.
|
||||
* **Media Plugin**: `Media`, `ImageHeart` model (likes/dislikes), `FeaturedImage`, image filename randomization, EXIF stripping, storage under `/static/uploads`, AJAX endpoints for voting, batch job every 12 hours to select top-voted image per species, exclude logos/avatars from voting, `net_votes` column on `Media`.
|
||||
* **Submissions Plugin**: Submission types (`market_price`, `name_correction`, `new_plant`, `mutation`, `vendor_rating`, `vendor_alias`), `Submission.plant_id`, vendor fields (`vendor_id`, `old_vendor_id`, `new_vendor_id`), form logic for conditional fields, CSRF, redirect `/submission/` to `/submission/new`, list and view routes filtered by user role, image uploads, preventing self-ratings, ex-affiliate flags, vendor alias community voting with `VendorAliasVote` model, thresholds, vendor appeals via `VendorAliasAppeal`, admin override, redirect behaviors.
|
||||
* **Vendor Profiles & Affiliations**: `VendorProfile` (`owner_id`, `business_name`, `description`, `logo_url`, `is_active`, `unclaimed` logic), `VendorMember` (`joined_at`, `left_at`, `left_reason`), `VendorAffiliationRequest` (user-initiated or owner-initiated), owner or admin can approve/reject, owner can forcibly remove members, store affiliation history, prevent self-voting by active members, allow ex-affiliate rating flagged, claims: `VendorClaimRequest` to claim unclaimed vendors, admin review, set `is_active=True`, assign `owner_id`.
|
||||
* **Grow-Log Plugin**: `PlantUpdate` and `UpdateImage` models, BigInteger IDs, `is_public` flag, share-by-key mechanism, personal vs. vendor context (`vendor_id` on `PlantUpdate`), image uploads use shared `Media` table, only public images eligible for voting, owners choose a personal featured image per plant instance.
|
||||
* **Ownership & Transfers Plugin**: `TransferRequest`, `PlantOwnershipLog` extended with `date_released` and `transfer_note`, `Plant` has `owner_id` (user or vendor) and `vendor_id` (nullable), standard transfer flows (owner-to-owner), purchase-proof transfers (invoice upload, admin/moderator approval), migrations, CSRF, role checks.
|
||||
* **Search Plugin**: AJAX autocomplete on common/scientific names, search results page, navbar integration with JS snippet, templates.
|
||||
* **Trait & Health Events Plugin**: `Trait` and `HealthEvent` models, image attachments, admin approval queue, display under "Health & Traits" tab, optional standardized `PestType` and `CareType` lookup tables.
|
||||
* **Vendor Dashboard & Inventory**: `VendorProfile` and `VendorMember`, unclaimed vs. active vendors, claim workflow, owner and member management, plant inventory management (assign `plant.vendor_id` or personal), multiple vendor profiles per user, pending transfer requests within vendor context.
|
||||
* **Admin Dashboard**: Queues for all pending items (Submissions, Traits, HealthEvents, TransferRequests, VendorClaimRequests, VendorAffiliationRequests, VendorAliasAppeals), user management (role assignment, cannot demote super admin), ability to override community featured images (`Plant.override_featured_media_id`), CSV exports, ERD viewer.
|
||||
* **Marketplace & Analytics**: `Listing` and `PriceHistory` models, listing CRUD, price-trend charts (Recharts), analytics metrics (top-selling plants, vendor performance, marketplace price distributions).
|
||||
* **PWA & Offline Support**: `manifest.json`, `service-worker.js`, caching strategies, responsive design, offline GrowLog drafts.
|
||||
|
||||
3. **Include All Recent Changes & Rules**
|
||||
|
||||
* Vendors cannot vote on images "as a vendor"; votes are always tied to the user account.
|
||||
* Community may add unclaimed vendors when adding a plant or purchase-based submission; vendors later claim their profile via `VendorClaimRequest`.
|
||||
* Prevent a user from rating a vendor they currently own or belong to (active `VendorMember`). Ex-affiliate ratings are allowed but flagged.
|
||||
* Vendor alias submissions: approval paths are vendor self (if active member of both), admin, or community voting (threshold); vendors can appeal alias, admin or community may reject based on votes.
|
||||
* Image voting logic: likes/dislikes stored in `ImageHeart`; toggling vote nullifies prior vote; update `Media.net_votes`; exclude logos and avatars.
|
||||
* Batch job every 12 hrs updates `Plant.featured_media_id` based on highest `net_votes` among `media.is_public=True`.
|
||||
* Vendor affiliations: multiple users per vendor; track `joined_at`, `left_at`, `left_reason`; affiliation requests and approvals; owner can remove members unilaterally.
|
||||
* Plant-addition form: prepopulate vendors dropdown; if user chooses "Add New Vendor", show inline minimal vendor fields (name, URL); create unclaimed vendor in background.
|
||||
* Purchase-proof transfers: user requests a transfer by submitting invoice; vendor or moderator/admin approves; then proceed with standard transfer logs.
|
||||
|
||||
4. **When Generating New Code or Modifications**
|
||||
|
||||
* Always reference existing file paths, blueprints, model names, import statements, migrations, templates, and static assets from the ZIP. E.g., if adding a new model, follow the existing pattern in `plugins/<plugin>/models.py`.
|
||||
* For every new or updated file, provide the full file contents including imports, class definitions, blueprint registration, and template code as necessary—**never partial snippets**.
|
||||
* If migrations are needed, supply a complete Alembic revision file with `upgrade()`/`downgrade()` including all column/table changes; name the revision descriptively (e.g., `phase3_growlog_models_added`).
|
||||
* When modifying templates, show the full Jinja2 file, include `{% csrf_token() %}` in forms, ensure blocks match `base.html` inheritance.
|
||||
* For static content (CSS/JS), reference existing asset locations; if adding new JS for AJAX voting or dynamic form field toggling, place it under the same `static/js/` directory and update `base.html` or relevant templates to include the script.
|
||||
|
||||
5. **Testing & Verification**
|
||||
|
||||
* After each phase’s changes, describe how to manually test: e.g., "Log in as a user with Vendor role, navigate to /vendor/dashboard, click 'Add Plant', verify vendor dropdown and inline vendor creation, submit Plant, check DB record, attempt image vote, etc.".
|
||||
* Provide instructions for verifying image storage: ensure uploaded files appear under `static/uploads/<YYYY>/<MM>/<DD>/`, are persisted by Docker volume, and accessible via `/media/files/<path>`.
|
||||
* Show how to test purchase-proof transfer: as a member, buy from an existing vendor, upload invoice, check that a `TransferRequest` is created; log in as vendor owner, approve, confirm `Plant.owner_id` changes.
|
||||
* Demonstrate vendor-affiliation flows: a normal user requests to join vendor, vendor owner approves, record `VendorMember` created; if removed, `left_at` set and voting blocked.
|
||||
|
||||
6. **Final Instructions**
|
||||
|
||||
* **Only modify code under** `app/` and `plugins/` directories—do not create files elsewhere.
|
||||
* Keep plugin discovery and blueprint registration intact (e.g., ensure each plugin has `plugin.json` with correct metadata). Do not remove any existing plugin scaffolding files.
|
||||
* Include any adjustments necessary to `app/__init__.py` (e.g., blueprint imports, CLI registration) if new plugins or routes are added.
|
||||
* For Docker setup: ensure `docker-compose.yml` still maps `./static/uploads` as a volume so that image files persist outside the container.
|
||||
* When providing a response, indicate which files were added or changed by listing their relative paths and giving full contents.
|
||||
* Always include a brief summary of that phase’s changes and a manual testing plan.
|
||||
* **Wait for a new ZIP upload** before implementing changes. After reviewing the ZIP, return a short acknowledgement: "Got it, ready to review." then proceed phase by phase.
|
||||
|
||||
**End of Prompt**
|
||||
|
61
docs/plant.csv
Normal file
61
docs/plant.csv
Normal file
@ -0,0 +1,61 @@
|
||||
uuid,plant_type,name,scientific_name,mother_uuid
|
||||
a290790f-1a7a-44e4-8563-e009df73cfe1,plant,Monstera,Monstera deliciosa,
|
||||
83ce3667-9a47-4d02-9c76-ae438b99696d,plant,Thai Constellation Monstera,Monstera deliciosa 'Thai Constellation',
|
||||
2ee2e0e7-69de-4b8f-abfe-4ed973c3d760,plant,Baltic Blue,Epipremnum pinnatum 'Baltic Blue',
|
||||
abd9dbf7-e487-4d2e-9753-5f96bd757d30,cutting,Yellow Flame Pothos,Epipremnum pinnatum 'Yellow Flame',
|
||||
e788375e-a90c-4442-b9ba-dbb7d54e4ffa,cutting,Yellow Flame Pothos,Epipremnum pinnatum 'Yellow Flame',
|
||||
9359048e-42d7-44c1-a145-c71c5f7dde99,cutting,Yellow Flame Pothos ,Epipremnum pinnatum 'Yellow Flame',
|
||||
84f7c394-025a-4a7d-8ba6-809001f2e9b1,cutting,Yellow Flame Pothos ,Epipremnum pinnatum 'Yellow Flame',
|
||||
55e834e5-42c5-4d1e-b672-a229cf9fb385,cutting,Yellow Flame Pothos ,Epipremnum pinnatum 'Yellow Flame',
|
||||
2b0f313d-bc4b-4ae3-a1b7-7a43c33183c8,cutting,Teruno Himiko Pothos,Epipremnum aureum 'Teruno Himiko',
|
||||
9e9c54e8-b4d7-483d-829b-809a5ad56965,cutting,Jessenia Pothos ,Epipremnum aureum 'Jessenia',
|
||||
cfd7f26a-fbcb-4858-bb68-9057bc02ce11,cutting,Jessenia Pothos ,Epipremnum aureum 'Jessenia',
|
||||
8015f878-ce4b-43a0-93a4-77d27c788f90,cutting,Lemon Top Pothos,Epipremnum aureum 'Lemon Top',
|
||||
61a75de2-6f15-4881-b476-805817406068,cutting,Lemon Top Pothos ,Epipremnum aureum 'Lemon Top',
|
||||
7593deb2-ee82-4609-844d-d968ceefe86e,cutting,Snow Queen Pothos,Epipremnum aureum 'Snow Queen',
|
||||
d4518e5f-555b-42ca-b6ae-23ae7cdf242e,cutting,Skeleton Key Pothos ,Epipremnum pinnatum 'Skeleton Key',
|
||||
a26e98c8-8d9a-454f-bb55-7f86bd3c85a1,cutting,Skeleton Key Pothos ,Epipremnum pinnatum 'Skeleton Key',
|
||||
b6f2d9a7-b7a9-4ee9-bd99-32eb1086a50a,cutting,Lemon Meringue Pothos ,Epipremnum aureum 'Lemon Meringue',
|
||||
604e0128-2243-4a86-8ed5-f3f0d1f42375,cutting,Lemon Meringue Pothos ,Epipremnum aureum 'Lemon Meringue',
|
||||
6d7c6be6-ebf6-474a-8529-beb119f78885,cutting,Champs-Élysées Pothos,Epipremnum aureum 'Champs-Élysées',
|
||||
44b3db46-3e76-4121-8684-15c6aab3c941,cutting,Champs-Élysées Pothos,Epipremnum aureum 'Champs-Élysées',
|
||||
992c7664-cdb0-4272-b91e-a883e2c7583e,cutting,Champs-Élysées Pothos,Epipremnum Aureum 'Champs-Élysées',
|
||||
bac3ed6a-fc57-40bd-951c-4dfbefdf97a0,cutting,Hoya Carnosa,Hoya carnosa,
|
||||
63752b15-f8d6-4243-90b0-e03c91b5ab00,cutting,Aurea Variegated Pothos,Epipremnum amplissimum 'aurea',
|
||||
3c75a03c-85c8-4556-99bc-f9374649ac91,cutting,Aurea Variegated Pothos,Epipremnum amplissimum 'aurea',
|
||||
7338f556-2667-4bb5-8e4d-93258b3e7629,cutting,Aurea Variegated Pothos,Epipremnum amplissimum 'aurea',
|
||||
65fe9d39-4901-475f-b281-288470ce8bfc,tissue_culture,Philodendron Joepii,Philodendron × joepii,
|
||||
0d3eb3b4-f91f-4223-aeae-8d07e376fb0f,tissue_culture,Philodendron Joepii,Philodendron × joepii,
|
||||
0054998b-69e9-4b54-939d-28af973a5072,tissue_culture,Philodendron Joepii,Philodendron × joepii,
|
||||
72765979-76c9-4cd5-9f32-c1447bd442c6,tissue_culture,Philodendron Joepii,Philodendron × joepii,
|
||||
41f61e96-7aa0-4266-981a-bdc07dc1d73d,tissue_culture,Philodendron Joepii,Philodendron × joepii,
|
||||
114701f1-6b7e-447e-902b-ac8eb7a77b1e,tissue_culture,Anthurium Warocqueanum Queen,Anthurium warocqueanum,
|
||||
2bf6cf5b-02ef-4fd7-b2aa-4116d5a82210,tissue_culture,Anthurium Warocqueanum Queen,Anthurium warocqueanum,
|
||||
053da33c-0491-40d0-ad45-0f4dfd3899cd,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',
|
||||
f14a61b1-3e79-4fd5-94b4-ca65fd6dabf4,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',
|
||||
1944c316-1a69-4708-95a2-e78ee310cfcf,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',
|
||||
18b16b54-bb05-4ab8-aedf-01f5a3ca0429,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',
|
||||
02d416eb-f1ef-43fd-901e-c67b9af5d04c,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',
|
||||
b9320c61-a2df-40b4-9998-f292f814ceec,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',
|
||||
1992b27a-2b12-42cd-ae1c-a152e64b742c,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',
|
||||
e9aa3ec5-d107-4769-bfb1-180b4013c5f2,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',
|
||||
e0f4a333-ae5c-4eaf-b5fc-6275d96b37d1,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',
|
||||
cf39b897-3fcd-45db-a421-653177d45f7e,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',
|
||||
a14ea46c-49d7-440b-8e7d-25be98fad0c2,tissue_culture,Philodendron V. Red Anderson,Philodendron erubescens 'Anderson',
|
||||
5510456a-27de-49f5-87ca-1ce4c9eaa1a8,tissue_culture,Philodendron Goeldii Mint,Thaumatophyllum spruceanum 'Mint' ,
|
||||
7ac40dec-747c-48ec-b9f3-cdde9b45cc4c,plant,Albo Monstera,Monstera deliciosa 'Albo Variegata' ,
|
||||
f3ab0c30-c50a-4fdc-b9d3-df84a416fe45,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,
|
||||
6f1cbaec-8753-4ba8-b208-db132eba20af,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,
|
||||
05e4d1d7-66b1-4b51-ac8e-f9f29a6ffea4,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,
|
||||
10c05f27-94ed-4834-849c-ba56a1c0648c,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,
|
||||
c7d5ebad-6a90-4310-b5b9-50a8dc9d53b7,plant,Thai Constellation Monstera,Monstera deliciosa 'Thai Constellation',
|
||||
9accd1a0-dae5-4fbb-8a11-f01b4a5079d3,plant,Thai Constellation Monstera,Monstera deliciosa 'Thai Constellation',
|
||||
f419f936-a662-4ad8-8504-49d187e1029d,plant,Mint Monstera,Monstera deliciosa 'Mint',
|
||||
b55eb046-1551-4073-9958-7bc52090344c,plant,Albo Monstera ,Monstera deliciosa 'Albo Variegata',
|
||||
ce681d56-e777-431f-aea3-68f7b9a86cc1,plant,Albo Monstera ,Monstera deliciosa 'Albo Variegata',
|
||||
f0b88046-1262-40a2-981c-7ce8d1ac2cf6,plant,Albo Monstera ,Monstera deliciosa 'Albo Variegata',
|
||||
71a6b08b-7ec4-4c94-a558-25aaceb4f4a6,plant,Philodendron V. Pink Princess ,Philodendron erubescens 'Pink Princess',
|
||||
cd49f25c-a397-4d93-b127-ab7fe5fb681f,plant,White Monstera Monstera,Monstera deliciosa 'White Monster',
|
||||
c138540f-aca7-4753-bd49-fef0dcd15afa,plant,Monstera Dubia,Monstera dubia,
|
||||
8b1059c8-8dd3-487a-af19-1eb548788e87,cutting,Baltic Blue,Epipremnum pinnatum 'Baltic Blue',2ee2e0e7-69de-4b8f-abfe-4ed973c3d760
|
||||
5646befb-36d0-444c-b531-6cca73128c59,cutting,Baltic Blue ,Epipremnum pinnatum 'Baltic Blue',2ee2e0e7-69de-4b8f-abfe-4ed973c3d760
|
|
61
docs/plant_converted.csv
Normal file
61
docs/plant_converted.csv
Normal file
@ -0,0 +1,61 @@
|
||||
UUID,Type,Name,Scientific Name,Mother UUID,Notes,Vendor Name,Price
|
||||
a290790f-1a7a-44e4-8563-e009df73cfe1,plant,Monstera,Monstera deliciosa,,,,
|
||||
83ce3667-9a47-4d02-9c76-ae438b99696d,plant,Thai Constellation Monstera,Monstera deliciosa 'Thai Constellation',,,,
|
||||
2ee2e0e7-69de-4b8f-abfe-4ed973c3d760,plant,Baltic Blue,Epipremnum pinnatum 'Baltic Blue',,,,
|
||||
abd9dbf7-e487-4d2e-9753-5f96bd757d30,cutting,Yellow Flame Pothos,Epipremnum pinnatum 'Yellow Flame',,,,
|
||||
e788375e-a90c-4442-b9ba-dbb7d54e4ffa,cutting,Yellow Flame Pothos,Epipremnum pinnatum 'Yellow Flame',,,,
|
||||
9359048e-42d7-44c1-a145-c71c5f7dde99,cutting,Yellow Flame Pothos ,Epipremnum pinnatum 'Yellow Flame',,,,
|
||||
84f7c394-025a-4a7d-8ba6-809001f2e9b1,cutting,Yellow Flame Pothos ,Epipremnum pinnatum 'Yellow Flame',,,,
|
||||
55e834e5-42c5-4d1e-b672-a229cf9fb385,cutting,Yellow Flame Pothos ,Epipremnum pinnatum 'Yellow Flame',,,,
|
||||
2b0f313d-bc4b-4ae3-a1b7-7a43c33183c8,cutting,Teruno Himiko Pothos,Epipremnum aureum 'Teruno Himiko',,,,
|
||||
9e9c54e8-b4d7-483d-829b-809a5ad56965,cutting,Jessenia Pothos ,Epipremnum aureum 'Jessenia',,,,
|
||||
cfd7f26a-fbcb-4858-bb68-9057bc02ce11,cutting,Jessenia Pothos ,Epipremnum aureum 'Jessenia',,,,
|
||||
8015f878-ce4b-43a0-93a4-77d27c788f90,cutting,Lemon Top Pothos,Epipremnum aureum 'Lemon Top',,,,
|
||||
61a75de2-6f15-4881-b476-805817406068,cutting,Lemon Top Pothos ,Epipremnum aureum 'Lemon Top',,,,
|
||||
7593deb2-ee82-4609-844d-d968ceefe86e,cutting,Snow Queen Pothos,Epipremnum aureum 'Snow Queen',,,,
|
||||
d4518e5f-555b-42ca-b6ae-23ae7cdf242e,cutting,Skeleton Key Pothos ,Epipremnum pinnatum 'Skeleton Key',,,,
|
||||
a26e98c8-8d9a-454f-bb55-7f86bd3c85a1,cutting,Skeleton Key Pothos ,Epipremnum pinnatum 'Skeleton Key',,,,
|
||||
b6f2d9a7-b7a9-4ee9-bd99-32eb1086a50a,cutting,Lemon Meringue Pothos ,Epipremnum aureum 'Lemon Meringue',,,,
|
||||
604e0128-2243-4a86-8ed5-f3f0d1f42375,cutting,Lemon Meringue Pothos ,Epipremnum aureum 'Lemon Meringue',,,,
|
||||
6d7c6be6-ebf6-474a-8529-beb119f78885,cutting,Champs-Élysées Pothos,Epipremnum aureum 'Champs-Élysées',,,,
|
||||
44b3db46-3e76-4121-8684-15c6aab3c941,cutting,Champs-Élysées Pothos,Epipremnum aureum 'Champs-Élysées',,,,
|
||||
992c7664-cdb0-4272-b91e-a883e2c7583e,cutting,Champs-Élysées Pothos,Epipremnum Aureum 'Champs-Élysées',,,,
|
||||
bac3ed6a-fc57-40bd-951c-4dfbefdf97a0,cutting,Hoya Carnosa,Hoya carnosa,,,,
|
||||
63752b15-f8d6-4243-90b0-e03c91b5ab00,cutting,Aurea Variegated Pothos,Epipremnum amplissimum 'aurea',,,,
|
||||
3c75a03c-85c8-4556-99bc-f9374649ac91,cutting,Aurea Variegated Pothos,Epipremnum amplissimum 'aurea',,,,
|
||||
7338f556-2667-4bb5-8e4d-93258b3e7629,cutting,Aurea Variegated Pothos,Epipremnum amplissimum 'aurea',,,,
|
||||
65fe9d39-4901-475f-b281-288470ce8bfc,tissue_culture,Philodendron Joepii,Philodendron × joepii,,,,
|
||||
0d3eb3b4-f91f-4223-aeae-8d07e376fb0f,tissue_culture,Philodendron Joepii,Philodendron × joepii,,,,
|
||||
0054998b-69e9-4b54-939d-28af973a5072,tissue_culture,Philodendron Joepii,Philodendron × joepii,,,,
|
||||
72765979-76c9-4cd5-9f32-c1447bd442c6,tissue_culture,Philodendron Joepii,Philodendron × joepii,,,,
|
||||
41f61e96-7aa0-4266-981a-bdc07dc1d73d,tissue_culture,Philodendron Joepii,Philodendron × joepii,,,,
|
||||
114701f1-6b7e-447e-902b-ac8eb7a77b1e,tissue_culture,Anthurium Warocqueanum Queen,Anthurium warocqueanum,,,,
|
||||
2bf6cf5b-02ef-4fd7-b2aa-4116d5a82210,tissue_culture,Anthurium Warocqueanum Queen,Anthurium warocqueanum,,,,
|
||||
053da33c-0491-40d0-ad45-0f4dfd3899cd,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',,,,
|
||||
f14a61b1-3e79-4fd5-94b4-ca65fd6dabf4,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',,,,
|
||||
1944c316-1a69-4708-95a2-e78ee310cfcf,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',,,,
|
||||
18b16b54-bb05-4ab8-aedf-01f5a3ca0429,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',,,,
|
||||
02d416eb-f1ef-43fd-901e-c67b9af5d04c,tissue_culture,Philodendron V. White Princess,Philodendron erubescens 'White Princess',,,,
|
||||
b9320c61-a2df-40b4-9998-f292f814ceec,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',,,,
|
||||
1992b27a-2b12-42cd-ae1c-a152e64b742c,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',,,,
|
||||
e9aa3ec5-d107-4769-bfb1-180b4013c5f2,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',,,,
|
||||
e0f4a333-ae5c-4eaf-b5fc-6275d96b37d1,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',,,,
|
||||
cf39b897-3fcd-45db-a421-653177d45f7e,tissue_culture,Philodendron V. Pink Princess,Philodendron erubescens 'Pink Princess',,,,
|
||||
a14ea46c-49d7-440b-8e7d-25be98fad0c2,tissue_culture,Philodendron V. Red Anderson,Philodendron erubescens 'Anderson',,,,
|
||||
5510456a-27de-49f5-87ca-1ce4c9eaa1a8,tissue_culture,Philodendron Goeldii Mint,Thaumatophyllum spruceanum 'Mint' ,,,,
|
||||
7ac40dec-747c-48ec-b9f3-cdde9b45cc4c,plant,Albo Monstera,Monstera deliciosa 'Albo Variegata' ,,,,
|
||||
f3ab0c30-c50a-4fdc-b9d3-df84a416fe45,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,,,,
|
||||
6f1cbaec-8753-4ba8-b208-db132eba20af,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,,,,
|
||||
05e4d1d7-66b1-4b51-ac8e-f9f29a6ffea4,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,,,,
|
||||
10c05f27-94ed-4834-849c-ba56a1c0648c,cutting,Albo Monstera ,Monstera deliciosa 'Albo Variegata' ,,,,
|
||||
c7d5ebad-6a90-4310-b5b9-50a8dc9d53b7,plant,Thai Constellation Monstera,Monstera deliciosa 'Thai Constellation',,,,
|
||||
9accd1a0-dae5-4fbb-8a11-f01b4a5079d3,plant,Thai Constellation Monstera,Monstera deliciosa 'Thai Constellation',,,,
|
||||
f419f936-a662-4ad8-8504-49d187e1029d,plant,Mint Monstera,Monstera deliciosa 'Mint',,,,
|
||||
b55eb046-1551-4073-9958-7bc52090344c,plant,Albo Monstera ,Monstera deliciosa 'Albo Variegata',,,,
|
||||
ce681d56-e777-431f-aea3-68f7b9a86cc1,plant,Albo Monstera ,Monstera deliciosa 'Albo Variegata',,,,
|
||||
f0b88046-1262-40a2-981c-7ce8d1ac2cf6,plant,Albo Monstera ,Monstera deliciosa 'Albo Variegata',,,,
|
||||
71a6b08b-7ec4-4c94-a558-25aaceb4f4a6,plant,Philodendron V. Pink Princess ,Philodendron erubescens 'Pink Princess',,,,
|
||||
cd49f25c-a397-4d93-b127-ab7fe5fb681f,plant,White Monstera Monstera,Monstera deliciosa 'White Monster',,,,
|
||||
c138540f-aca7-4753-bd49-fef0dcd15afa,plant,Monstera Dubia,Monstera dubia,,,,
|
||||
8b1059c8-8dd3-487a-af19-1eb548788e87,cutting,Baltic Blue,Epipremnum pinnatum 'Baltic Blue',2ee2e0e7-69de-4b8f-abfe-4ed973c3d760,,,
|
||||
5646befb-36d0-444c-b531-6cca73128c59,cutting,Baltic Blue ,Epipremnum pinnatum 'Baltic Blue',2ee2e0e7-69de-4b8f-abfe-4ed973c3d760,,,
|
|
119
docs/subapp.txt
Normal file
119
docs/subapp.txt
Normal file
@ -0,0 +1,119 @@
|
||||
You are ChatGPT, an expert Flask developer. I will upload two ZIP files:
|
||||
|
||||
* **plant-scan-main.zip** (the standalone sub-app)
|
||||
* **natureinpots\_main.zip** (the main app with its utility plugin)
|
||||
|
||||
When I upload them, **immediately reply**:
|
||||
|
||||
> Got it, ready to review both codebases.
|
||||
|
||||
Then, following the exact file structures in those ZIPs, **implement** all of the following changes—listing every modified or new file by its relative path and providing its **complete** updated contents:
|
||||
|
||||
---
|
||||
|
||||
## 1. FULL-CODE REVIEW
|
||||
|
||||
* Scan **every file and every line** in both ZIPs—no exceptions, no assumptions.
|
||||
* Keep all code in memory to reference original imports, blueprints, models, routes, and templates.
|
||||
|
||||
---
|
||||
|
||||
## 2. SUB-APP ENHANCEMENTS (Plant Scan)
|
||||
|
||||
1. **Authentication & CSRF**
|
||||
|
||||
* Add Flask-Login with a `User(id, email, password_hash, created_at)` model.
|
||||
* Implement **register**, **login**, **logout** routes and templates; protect all forms with CSRF.
|
||||
* Scope all queries so users only see their own data (`Plant.user_id == current_user.id`, `GrowLog.user_id == current_user.id`).
|
||||
|
||||
2. **Image Upload Support**
|
||||
|
||||
* Modify plant-create/edit and grow-log forms to accept `<input type="file" multiple name="images">`.
|
||||
* Save uploads under:
|
||||
|
||||
* `static/uploads/<user_id>/<plant_id>/<uuid>.<ext>`
|
||||
* `static/uploads/<user_id>/growlogs/<plant_id>/<update_id>/<uuid>.<ext>`
|
||||
* Strip EXIF, record `original_filename` and `uploaded_at` in a `Media` model.
|
||||
|
||||
3. **Export My Data**
|
||||
|
||||
* Add a login-required `/export` route and button.
|
||||
* Generate `<username>_export.zip` containing:
|
||||
|
||||
* **plants.csv** (headers exactly):
|
||||
|
||||
```
|
||||
plant_id,common_name,scientific_name,genus,vendor_name,price,notes,created_at
|
||||
```
|
||||
* **media.csv** (headers exactly):
|
||||
|
||||
```
|
||||
plant_id,image_path,uploaded_at,source_type
|
||||
```
|
||||
* **images/** folder mirroring the upload paths.
|
||||
* A hidden **export\_id** (UUID + timestamp) in a metadata file or CSV header.
|
||||
* Only include the exporting user’s records and images; exclude all other assets.
|
||||
|
||||
4. **Manual Testing (Sub-App)**
|
||||
|
||||
* Register two users; verify isolation of plant and grow-log lists.
|
||||
* Upload multiple images; confirm storage paths and DB entries.
|
||||
* Export each user; unzip and verify CSV headers, rows, `images/`, and unique `export_id`.
|
||||
|
||||
---
|
||||
|
||||
## 3. MAIN-APP utility REFACTOR (“Nature in Pots”)
|
||||
|
||||
1. **Web-Based ZIP Upload**
|
||||
|
||||
* Change the utility form to accept a `.zip` file.
|
||||
* On upload, unzip into a temp directory expecting `plants.csv`, `media.csv`, and `images/`.
|
||||
* If only a CSV is uploaded, process it but skip media.
|
||||
|
||||
2. **CSV Header Validation**
|
||||
|
||||
* Abort with a clear error if **plants.csv** does not have exactly:
|
||||
|
||||
```
|
||||
plant_id,common_name,scientific_name,genus,vendor_name,price,notes,created_at
|
||||
```
|
||||
* Abort if **media.csv** does not have exactly:
|
||||
|
||||
```
|
||||
plant_id,image_path,uploaded_at,source_type
|
||||
```
|
||||
|
||||
3. **Import Logic & Collision Avoidance**
|
||||
|
||||
* For each row in `plants.csv`, create a new `Plant`.
|
||||
* For each row in `media.csv`, locate the file under `images/...`, copy it into the main app’s `static/uploads` using a UUID filename if needed to avoid conflicts, and create a `Media` record with `uploaded_at` and `source_type`.
|
||||
* Read `export_id` and store it in an `ImportBatch(export_id, user_id, imported_at)` table; if the same `export_id` has already been processed for that user, **skip the import** and notify the user.
|
||||
|
||||
4. **Ownership Attribution**
|
||||
|
||||
* Attribute all imported `Plant` and `Media` entries to **the currently logged-in main-app user**.
|
||||
|
||||
5. **Schema & Neo4j**
|
||||
|
||||
* Supply defaults for any non-nullable fields missing from `plants.csv`.
|
||||
* Pass all imported fields (e.g. `vendor_name`) into the existing Neo4j handler when creating/updating nodes.
|
||||
|
||||
6. **Manual Testing (utility)**
|
||||
|
||||
* As a main-app user, upload the `<username>_export.zip`; confirm no duplicates on re-upload.
|
||||
* Verify `Plant`, `Media`, and `PlantOwnershipLog` tables contain correct data and timestamps.
|
||||
* View plant detail pages to ensure images load correctly.
|
||||
* Inspect Neo4j for the new or updated plant nodes.
|
||||
|
||||
---
|
||||
|
||||
## 4. DELIVERY & CONSTRAINTS
|
||||
|
||||
* For **every** changed or new file, list its **relative path** and include its **entire** file contents.
|
||||
* **CSV headers must match exactly**—no deviations.
|
||||
* Use **UUID filenames** to guarantee no file collisions on import.
|
||||
* All routes and forms must enforce **authentication** and **CSRF**.
|
||||
* **Only modify** code under `app/` or `plugins/`; **do not delete** any existing files.
|
||||
|
||||
Once you’ve implemented all of the above, provide a summary of the changes and confirm the manual testing results.
|
||||
|
Reference in New Issue
Block a user