jwnigel / permaculture

Permaculture design app built on scraped plant databases. Drag-n-drop GUI with detailed design plan generator.
23 stars 3 forks source link

create python class for "design" object #20

Closed berteh closed 1 year ago

berteh commented 1 year ago

with minimal infos needed to be able to display the design in editor, and intuitive access methods, likely stored in a pandas DataFrame (but pick whichever internal structure you feel more relevant).

jwnigel commented 1 year ago

So basically a minimalistic application? Or just the minimal working data as mentioned yesterday?

berteh commented 1 year ago

The second one please, so I can try working on other topics as the one you are in parallel.

berteh commented 1 year ago

But not so much data, as data structure + basic access methods.

jwnigel commented 1 year ago

Do you mean a way to select between different plants and view their data?

That would be pandas behind the scenes and python/kivy for the ui.

jwnigel commented 1 year ago

This is our complete data from pfaf: "Family", "Genus", "Species", "CommonName", "GrowthRate", "HardinessZones", "Height", "Width", "Type", "Leaf", "Flower", "Ripen", "Reproduction", "Soils", "pH", "Preferences", "Tolerances", "Habitat", "HabitatRange", "Edibility", "Medicinal", "OtherUses".

Our working data should include: Common Name, Height, Width, Growth Rate, Preferences, and maybe a combination of Edible / Medicinal Uses?

What do you think? Should we include more or less?

jwnigel commented 1 year ago

Some combination of these will be pre-filtered when the design is initialized. Like hardiness zone, soil, maybe habitat and pH?

jwnigel commented 1 year ago

So I think I will make a small data frame with these "essential" columns and using a few different plants to work on selecting and viewing them in the editor. Is that what you had in mind? Sorry, I do not completely understand.

berteh commented 1 year ago

perfect.

I even just meant the first part, the pandas, for the 0.1 milestone, since that's the basics for the next steps... and I'd rather you do it than me so you'd be comfortable with its internal structure.

I can then use it as a pivot to contribute to other things while you work on a first UI prototype that you seem to prioritize (which makes sense, no critique, just a statement ;)

jwnigel commented 1 year ago

Not a problem, I am working on it!

I am working on it in the notebooks directory to be able to see the dataframes.

berteh commented 1 year ago

cool. never used jupyter notebooks before so that'll be new for me. just installed. what's the command line you use to run it ?

jwnigel commented 1 year ago

Just jupyter notebook or just jupyter notebook and then you can select which one to open

You run a cell using Shift + Enter or Control + Enter to add a cell beneath.

And you can use Shift + Tab to see the doc string

The only problem is that they can get messy quickly but as a beginner they are helpful

berteh commented 1 year ago

That's what I tried but this leads me to an internal error, no log/explanation with further explanation on terminal.

likely some wrong lib version / dependency issue... I add #29 to consider using a dependency manager, but have no preference as to which.

In the meantime I'd like to try'n fix it locally. What do you run? I got ubuntu 20.04.5 + python3.8.10 + kv2.1.0 + kivyMD 1.1.1, all installed with latest pip3.

and jupyter notebook 6.5.2. but I guess/hope that last bit should not make a difference.

jwnigel commented 1 year ago

I'm running python3.10.6 and the same kivy versions as you, on Ubuntu 22.04.1. Maybe I need to update Ubuntu?

I just updated jupyter and got this: jupyter-1.0.0 jupyter-console-6.4.4 nbclassic-0.5.1 notebook-6.5.2 qtconsole-5.4.0 qtpy-2.3.0

I had been running notebook 6.5.1

jwnigel commented 1 year ago

My pip is 23.0, maybe that's the issue?

berteh commented 1 year ago

Ok. I'll update my Ubuntu this weekend. Have been postponing it for some time. Hoping it fixes the issue.

You need not to change a thing, since it works 😜

jwnigel commented 1 year ago

Sounds good, the class isn't ready to go yet so there's no rush. I just created a basic search function for our searchbar, and a MyDesign class to be used for each design. It will have an add_plant method for each plant that is dragged onto the grid (probably best called when the user presses "submit" or is ready to view their report, at which time a dataframe should be returned with x- and y-coords for plants, plant totals, etc.

I think the only necessary data here is the latin name as an identifier, the x- and y- coords, and the width and height. Other info could be called from the main database when necessary.

berteh commented 1 year ago

Seems perfect. We can then later add infos to that class when they become part of the core editor, such as the layer for a colour convention/ design filter to ease stratification / collision detection... if that ever gets on the roadmap.

jwnigel commented 1 year ago

Basic structure is done. Not sure if it's what you were imagining. See notebooks/design_data_class.ipynb