Flat file data storage ideas please

Last year I planted some seeds in seed trays with 40 cells. I somehow messed up my plans and had no real idea what was what until they started getting quite large! It is funny how most seedlings look the same :thinking:

Anyway this year I have decided to record the contents of the cells straight onto the computer; this hopefully means I will not mix them up again ( awful handwriting did not help ).

Anyway to the point; I can create a MySQL database but thought I would look at flat files. I have seen a database class that uses XML and I know I can create a csv file. If it works OK I could make the code available to others who may not be able to install a database.

I would be interested to know what people suggest?

File contents:

  • Tray number
  • Date ( this could be the file name along with the tray number. )
  • Cell number ( 1 > 40 although I might use a different size tray especially when I move the seedlings on )
  • Type ( Tomato, carrot etc. )
  • Variety

Pages
Input/save page with a form
Graphical display page - I thought it would interesting to use some icons in the cells like a tomato etc.
Possibly a page with the types that I can include/read on the input /save page

Out of interest what the input and display pages look like at the moment:input display

I think I might be tempted to use a CSV file. They are easy to create, use and view.

Have you looked at SQLite? It’s not flat file, but it is a file and you don’t need to install anything on your machine.

1 Like

That is interesting @rpkamp as I always thought it had to be “installed” and was not part of php as it is now.

I now have some csv code working. The XML and csv options seemed a good idea as they are “portable”; as in it could be imported into Excel. Not that I have any plans to do that at the moment

I probably need to think a bit more about what I want to do exactly and it is interesting to see what others think.

For the specific purposes you describe using rest.db would be a quick, efficient method to catalog the trays.

An easy alternative to that would be installing a NoSQL db or storing JSON in a flat file using a document object model.

Example:

{
	"label": "#Tray 1",
	"cells" [
		{
			{
				"label": '#1',
				"content": {
					"name": "Carrot"
				}
			}
		},
		{
			{
				"label": '#2',
				"content": {
					"name": "Apple"
				}
			}
		}

	]
}

Taking it to the extreme you could store the info in dynamodb instance in aws and build server less API around it with node.js.

https://aws.amazon.com/dynamodb/
https://aws.amazon.com/lambda/

You could then build the client side interface using Angular, React, or Vue consuming the AWS lambda service at basically no cost.

If I just wanted a quick, and easy method to catalog this info for my own personal use I would probably use restdb.io. If I wanted full control and use this as a learning experience I would probably go the other route starting with storing the info as documents in a NoSQL db and building on it from there.

Alternatively you could also serialize your data to JSON, dump it in a file, and read it again when you need it.

In case you’re using objects, you can use https://github.com/matthiasnoback/naive-serializer

Quite an extensive list to throw at someone who wants a simple solution to store some stuff in a file :thinking:

1 Like

@motor_man I want to keep things simple and not have to install anything extra as other people may use the code; so restdb and NoSQL are not for me in this case.

I have a csv version running at the moment and will see how it progresses. As I say I need to decide how far I am going with this project as it may be worth moving to SQLite if it starts to expand.

Thak you all for the ideas.

If you abstract away the entire notion of saving and loading behind an interface, swapping our the implementation later will be trivial.

Plus it will make testing a lot easier as you can mock your storage layer.

1 Like

The ambiguity of cotyledons !
Disclaimer, I use simple markers for my seed flats and for the most part seed per flat not per cell.

Anyway, I think localStorage could work. AFAIK it’s limited to 10MB so a lot of “flat-grid-X-Y” value pairs could work. eg.

flat A

a b c
1 tomato basil
2 corn bean squash
3
"A1a": "tomato" 
"A1b": "basil" 
"A2a": "corn" 
"A2b": "bean" 
"A2c": "squash" 

Well I have some working code but need some validation and error checking. I would also like to be able to work on different tray sizes and I think I just need an extra input on the first page. It should automatically sort itself out on the second page.

I have just thought the input could be improved with some JavaScript - I could just drag the icon into the “box” and add the variety. I will have to look on the web for some code; I am not very good with JavaScript.
Just found you can drag and drop in HTML5 as well, although the example site I tried it didn’t work!

I use plug trays as I only want a couple of each plant. I plant more than I need and give any I do not want away. Even then I usually end up re seeding some types as they fail for some reason!

An example of my output page:

[off-topic]

Reminds me of…

[/off-topic]

1 Like

No one would need to install anything if you offered it as a simple serve-less service running in the cloud. I think there is more value in offering a service anyone can easily use.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.