Tagging plants with barcode? An app to scan barcodes and populate forms?

hawaiirsn

Member
SoSH Member
Sep 22, 2006
757
Honolulu, HI
I am a plant ecologist working with wild and planted populations of endangered plant species. I've got an idea I'm considering implementing in my PhD research, but I'm not sure exactly how to implement it. Basically, for my research, I have to measure plants multiple times a year through several years to track their growth, survival, reproduction etc. I also have a lot of characteristics I need to input either on a hard copy data sheet (which I have been doing so far then adding to excel) or on my field computer (an old Pansonic tough book that runs windows XP) directly into excel or google sheets.

I'm wondering if its feasible and how hard it would be to tag my plants with barcodes on the tags so that I can scan them with an iOS app or with my field computer, then input data into a form. It would be great if when I scan the plant some information about that individual plant I've already collected. I'd like to add in the data (and perhaps location coordinates from my phone) I'm collecting to a form and possibly take a photo that will be associated with that barcode/individual plant. I will have several things to measure each time and input- several measures of size, reproduction, etc.

Does anyone have any suggestions of apps in iOS or another form filling workflow I might consider? My field computer has a built in barcode reader I could use as well. Whatever I use, I need to be able to use it without cell reception.

I don't have any app development experience but I'd be willing to figure something out if making something myself is the best option. Even if its a fair bit of work, it would probably save me time in the long run.
 

schillzilla

New Member
May 11, 2006
122
Just spitballing here, but you could probably use a QR code to store some information. Look at http://goqr.me to see different potential options for storing some data. One option option is just storing plain text, so you could store anything (text notes, or a structured JSON object which could be read by your app later and then saved to a database). If it must work without connectivity, then you are probably looking at a native iOS app so it can be used offline and store data locally on the device itself. My guess is you want to generate codes for the attributes that really don’t change (the codes would be your “keys” for the various plants). Then using the qr code reader you could load up the record on your device (finding it by the key) and be ready to update /enter whatever you want. Just a thought.
 

uncannymanny

Member
SoSH Member
Jan 12, 2007
9,078
QR code is a good avenue to look into. Lots of support for these, lots of free tools (of course the app itself could be expensive depending on your needs — does your school have a computer science program where you might be able to help someone with an idea and they can help you with building it?). One thing to look into is the amount of data that can be stored in a code. Usually it’s a link or a few fields. It may not be able to hold the amount of data you need (if you’re internet connected you could get around any limitations...but then you’ll need to build an API too and host it somewhere and ostensibly know how to secure it).
 

hawaiirsn

Member
SoSH Member
Sep 22, 2006
757
Honolulu, HI
QR code is a good avenue to look into. Lots of support for these, lots of free tools (of course the app itself could be expensive depending on your needs — does your school have a computer science program where you might be able to help someone with an idea and they can help you with building it?). One thing to look into is the amount of data that can be stored in a code. Usually it’s a link or a few fields. It may not be able to hold the amount of data you need (if you’re internet connected you could get around any limitations...but then you’ll need to build an API too and host it somewhere and ostensibly know how to secure it).
I was looking into QR codes, and it does seem likely suitable for my needs. While we have a lot of services through IT, I am remote while here in Hawaii doing field work for the next seven months, so on my own for the time. They could certainly host an API for me, and help me with that, so that's a good suggestion. Perhaps I'll contact their help desk for some suggestions.

I don't need to store too much information, but I'd like to have some kind of interface where scanning the QR will allow me to input data into a form that would then be associated with that individual plant in a super simple database (basically a row in a spreadsheet).
 

charlieoscar

Member
Sep 28, 2014
1,339
I need some clarification. If I am understanding what you want is so method of identifying individual plants and any measurements that you do on each plant will be recorded by hand. If the barcode changes to reflect changes in measurements, won't you need to change the barcode on the plant each time?

Do a Google search for entering barcodes into excel and see if you find anything that helps. Although it seems to me that you just need a text editor (or similar) to read the bar code and start a record that includes it where you could enter the measurements as a comma-delimited sequence. You could build the plant's type, number, location into the barcode and also use that as one field in your database. As for plant photographs, include a Y/N field for its existence. If you have a photograph of the plant that also has its barcode visible, you can add it to you database.

One problem may be Windows XP and the version of software you use.
 

jayhoz

Ronald Bartel
SoSH Member
Jul 19, 2005
17,362
Another thing to look into is NFC tags. I know that you can write data to them and have them trigger actions on your smartphone. I'm not sure how much data they can hold and whether they will work for your application, but it's worth a quick look. They are also dirt cheap.
 

hawaiirsn

Member
SoSH Member
Sep 22, 2006
757
Honolulu, HI
I need some clarification. If I am understanding what you want is so method of identifying individual plants and any measurements that you do on each plant will be recorded by hand. If the barcode changes to reflect changes in measurements, won't you need to change the barcode on the plant each time?

Do a Google search for entering barcodes into excel and see if you find anything that helps. Although it seems to me that you just need a text editor (or similar) to read the bar code and start a record that includes it where you could enter the measurements as a comma-delimited sequence. You could build the plant's type, number, location into the barcode and also use that as one field in your database. As for plant photographs, include a Y/N field for its existence. If you have a photograph of the plant that also has its barcode visible, you can add it to you database.

One problem may be Windows XP and the version of software you use.
Basically, each barcode will be associated with an individual record in my database (each record being an individual plant). So when I scan the barcode, I will then enter data into a form that will be a new observation for that date for that individual plant.

I suppose I could build this in Access in a more data base structure with each record being a plant and then multiple observations under each record for my various time-stamped measurement.

XP could be a problem, but I am running Windows 10 on my laptop, and I don't necessarily have to use the field computer at all if I can find an iOS app to record data on my phone. Or obtain a newer field computer!
 

charlieoscar

Member
Sep 28, 2014
1,339
Basically, each barcode will be associated with an individual record in my database (each record being an individual plant). So when I scan the barcode, I will then enter data into a form that will be a new observation for that date for that individual plant.
Put all the unchanging information into your barcode. For example, Retrosheet uses a format like HHHyyyymmddG to idnetify each play in a game, where HHH is the three letter code for the home team, yyyy is the year, mm is the month, dd is the day, and G is the game (1 for the first game of a doubleheader; 2, the second; and 0 is a single game) as in BOS201704050. With Excel or a database you can easily filter the records for any of those criteria.

I'm guessing that you want to keep every record of an individual plant to you can track its growth, so to add the current date in Excel hold down the CTRL key while typing the ; key (look up Excel time stamp). You can also do something similar for the time and a combination of the two.
 

hawaiirsn

Member
SoSH Member
Sep 22, 2006
757
Honolulu, HI
Write a simple web form to edit your DB records, separate ID per plant. Encode the URL ID per plant into a QR code, something like: https://some.where/editPlantData?id=123

First time you scan them it creates the new record, after that it edits the existing one.
Yeah, this seems to basically be what I'd like to do. Although, it would be better if it wasn't a web based form so that I can run this when I am at my populations that aren't in places I have cell reception. I am wondering if I can have my data in a portable access database and have the QR code have an ID per plant that inputs into that record.
 

SumnerH

Malt Liquor Picker
Dope
SoSH Member
Jul 18, 2005
31,885
Alexandria, VA
Yeah, this seems to basically be what I'd like to do. Although, it would be better if it wasn't a web based form so that I can run this when I am at my populations that aren't in places I have cell reception.
You can offline apps with background Javascript service workers. Save the page to your desktop (with an app-style icon), and have the service worker use local storage when you're offline and re-sync only when you're connected.

https://auth0.com/blog/creating-offline-first-web-apps-with-service-workers/
 

Gagliano

Ask me about my mollusks
Lifetime Member
SoSH Member
Sep 19, 2001
5,812
Maine
I've done a lot of work using QR codes to track inventory, and can offer a few tips/options. I would use SQL Server instead of Access for storage (the Express version is free and unless you have millions of plants, you will have plenty of space). I would build a table that contains all of the static data, and then other tables for live data. On the tag itself, I would just have a simple ID, and bind that to the data on your tables. That way, if you wanted to use a different type of ID media in the future, it would be much simpler to convert. For instance, if you found that some dirt cheap passive RFID chips would also do the job, you could just switch to using the RFID identifier on the fly without embedding plant specific data on the chip and both systems could be used simultaneously and the data would look the same in your database.

I did a system last year where a forklift driver could drive up to a skid and scan it from eight feet away and pass the ID to my database, and I would pass back everything he needed to know to the scanner. Like Sumner said, this is a common and easy thing to do in Java. But again, I would keep custom data off the QR code and keep it in the database instead. The exception would be if you thought some human readable data would be useful on the QR code as well (your QR code generator will have this option to display all or part of the QR data in text).
 

hawaiirsn

Member
SoSH Member
Sep 22, 2006
757
Honolulu, HI
I've done a lot of work using QR codes to track inventory, and can offer a few tips/options. I would use SQL Server instead of Access for storage (the Express version is free and unless you have millions of plants, you will have plenty of space). I would build a table that contains all of the static data, and then other tables for live data. On the tag itself, I would just have a simple ID, and bind that to the data on your tables. That way, if you wanted to use a different type of ID media in the future, it would be much simpler to convert. For instance, if you found that some dirt cheap passive RFID chips would also do the job, you could just switch to using the RFID identifier on the fly without embedding plant specific data on the chip and both systems could be used simultaneously and the data would look the same in your database.

I did a system last year where a forklift driver could drive up to a skid and scan it from eight feet away and pass the ID to my database, and I would pass back everything he needed to know to the scanner. Like Sumner said, this is a common and easy thing to do in Java. But again, I would keep custom data off the QR code and keep it in the database instead. The exception would be if you thought some human readable data would be useful on the QR code as well (your QR code generator will have this option to display all or part of the QR data in text).
This sounds like what I should do. I don't have any experience building a SQL server, but I have a basic understanding of how the language works I think, and I shouldn't have any issues figuring that part of it out. I have access to full SQL Server for free through my University.

I will build a table with the static data and then relate a table to each plant with the different observations. I do have some things that once I observe, will not change, and will probably have these fields in the static data table- these are whether the plant is mature (once I've observed reproductive activity it is marked mature) and the sex of my plants (which hypothetically will not change but it isn't always easy to tell when its a subtle difference of whether the male and/or female parts are functional on the flowers).

I think ultimately, if I can afford them, RFK chips would be ideal, but for now I can put that unique code on a QR code. I think RFID codes would be problematic because the range generally pretty long and my plants are close together. So having to get relatively close with scanning device is actually a good thing in my situation to avoid confusion. The nice thing about using a chip like this though would be not worrying about the visual clarity of a QR type code. In the mountains, algae and fungus and all sorts of things like to grow on plant tags-- back when I was working in plant conservation from the management side of things we even had to use scrubbing pads to clear off engraved metal tags to tell which plants were which. If I make up a nice system, I am optimistic eventually some of these agencies managing endangered species like my study species would adopt it to track their plants (especially if I get this going in some of the endangered plant plantings I am collaborating with them to establish).

The Java part of it is definitely totally foreign to me, but I probably just have to commit the time to figuring it out. Maybe I can recruit someone that has experience doing this to help me out. I don't know if my University's support will be that helpful from the east coast being here in Hawaii (although they can certainly host whatever for me).

Thanks for the help!
 

Gagliano

Ask me about my mollusks
Lifetime Member
SoSH Member
Sep 19, 2001
5,812
Maine
Writing SQL queries is easy once you understand some basic syntax, IF, and this is a big if, the tables are designed correctly. Write down every property of a plant that you can think of, and try to anticipate how they would be used. As an example of bad database design, let's say your plants could have three different kinds of leaves- broad, slim, and oval. A beginner might create a text column and enter those three words literally in the table, even though text searches are terrible slow and you can't build indexes with text columns. Instead, you should create a table called "LeafTypes" and enter the different possible types along with an INT ID, and use that ID in your table where you collect data. You can index on that column, and when you wanted to write a report, your query would do a join on that LeafType table and would run extremely fast (i.e. "Display all records where the leaf type is 2 and the maturity is 4 and species is 7"). I've oversimplified, but do you get the idea?

Yeah, I had no idea if you were recording palm trees or blades of grass, so RFID may not be practical. I would suggest that on the QR label that you include at least a human readable ID, so that if the code itself couldn't be read, you could manually enter the ID and you could print out a new label.

Java was one suggestion, but you could also do this with Python of Jython. Also, a company called Inductive Automation sells an awesome development package that provides everything you need to develop a system with database connectivity, and uses Jython as the IDE, which also gives you the entire Java libraries. I'd suggest downloading the trail package and playing around with it. Literally, you could write a small GUI and start recording data in an hour.
 

SumnerH

Malt Liquor Picker
Dope
SoSH Member
Jul 18, 2005
31,885
Alexandria, VA
Java was one suggestion, but you could also do this with Python of Jython.
Jython’s a moribund project, I wouldn't start anything new using it. It’s been stagnant for years, and it only ever supported Python 2 (which is finally starting to phase out slowly)—and even that support is somewhat limited.

The last official release on their site is from 2015 and development has been virtually nonexistent in the past few years. There was an announcement in a few places of a new 2.7.1 release last July but it never actually made it to official channels.
 

Gagliano

Ask me about my mollusks
Lifetime Member
SoSH Member
Sep 19, 2001
5,812
Maine
Jython’s a moribund project, I wouldn't start anything new using it. It’s been stagnant for years, and it only ever supported Python 2 (which is finally starting to phase out slowly)—and even that support is somewhat limited.

The last official release on their site is from 2015 and development has been virtually nonexistent in the past few years. There was an announcement in a few places of a new 2.7.1 release last July but it never actually made it to official channels.
I only mentioned it because it's a way for somebody who hasn't done a lot of programming to become familiar with Java and python at the same time. Basically, you can write Java code using python syntax, while having access to the latest Java libraries. Just another option.
 

hawaiirsn

Member
SoSH Member
Sep 22, 2006
757
Honolulu, HI
Writing SQL queries is easy once you understand some basic syntax, IF, and this is a big if, the tables are designed correctly. Write down every property of a plant that you can think of, and try to anticipate how they would be used. As an example of bad database design, let's say your plants could have three different kinds of leaves- broad, slim, and oval. A beginner might create a text column and enter those three words literally in the table, even though text searches are terrible slow and you can't build indexes with text columns. Instead, you should create a table called "LeafTypes" and enter the different possible types along with an INT ID, and use that ID in your table where you collect data. You can index on that column, and when you wanted to write a report, your query would do a join on that LeafType table and would run extremely fast (i.e. "Display all records where the leaf type is 2 and the maturity is 4 and species is 7"). I've oversimplified, but do you get the idea?
Yeah this makes sense. I have dealt with SQL queries in a very very limited basis dealing with GIS databases, but nothing I have built myself. I have mostly numerical data, but I do have some text stuff like species, site name, population, etc. I can make tables for all of those things, that makes sense. Basically my plan is to have a master table that contains every individual plant with all the data that will not change once it is assigned to that plant, and a table for each plant that contains the measurements for each observation of that plant. Then I'll have tables with the IDs as you describe. That will be my basic structure I think and I can work from there.

I'm going to end up with a lot of site specific data about environment (temperature, soil moisture, soil nutrient levels, etc), so later maybe I can build a related structure with that data for each site. Will have to think about how I end up building my population model and using these things (plus related experiments I'm starting up) as predictors.

Jython’s a moribund project, I wouldn't start anything new using it. It’s been stagnant for years, and it only ever supported Python 2 (which is finally starting to phase out slowly)—and even that support is somewhat limited.

The last official release on their site is from 2015 and development has been virtually nonexistent in the past few years. There was an announcement in a few places of a new 2.7.1 release last July but it never actually made it to official channels.
I only mentioned it because it's a way for somebody who hasn't done a lot of programming to become familiar with Java and python at the same time. Basically, you can write Java code using python syntax, while having access to the latest Java libraries. Just another option.
This does sound appealing, but I suppose I'm better off spending my time learning to write code in a framework that is still active and developing. I'll keep exploring options and I'm open to any suggestions!

Thanks for all the help!
 

SumnerH

Malt Liquor Picker
Dope
SoSH Member
Jul 18, 2005
31,885
Alexandria, VA
This does sound appealing, but I suppose I'm better off spending my time learning to write code in a framework that is still active and developing. I'll keep exploring options and I'm open to any suggestions!
You're absolutely going to have to learn Javascript to write an offline application, at least enough for the service worker thread. Personally I'd use Python + Django for the back-end of what is essentially a form-driven application. There's probably a good Javascript-based backend that would work for you; the problem is that Javascript frameworks are a huge moving target, so it's difficult to say at any given point which is the preferred one, with good documentation for beginners who want to get going quickly.

This talk discusses building service workers in Javascript to support a Django backend app. The theory is going to be similar no matter what back-end you choose, though details will vary:

It's not rocket science but it may be intimidating for a new programmer; this is just into the realm where you may want to hire (or find an intern) someone with a little experience.