# Transferring Raw Data to MySQL

**URL:** <https://forum.getodk.org/t/transferring-raw-data-to-mysql/3670>\
**Category:** Support\
**Created:** [September 25, 2014, 9:04pm UTC](https://forum.getodk.org/t/transferring-raw-data-to-mysql/3670 "2014-09-25T21:04:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Makhate\_Makhate](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/e99b99/32.png) [@Makhate\_Makhate](https://forum.getodk.org/u/Makhate_Makhate)\
**Post date:** [September 25, 2014, 9:04pm UTC](https://forum.getodk.org/t/transferring-raw-data-to-mysql/3670/1 "2014-09-25T21:04:39Z")

</div>

Dear Community,

I'm based in Lesotho and am experiencing some predicament here (i'm new to  
this technology); we have a complete functional web-based information  
system stores its data on MySQL. Just like in any developing country we're  
faced with the challenge of limited internet connectivity.  
So this is where i hit the wall; I want to know if i can collect data using  
ODK Collect and then have all the data collected transferred straight to  
MySQL so that information system will play with the data.

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [September 25, 2014, 9:47pm UTC](https://forum.getodk.org/t/transferring-raw-data-to-mysql/3670/2 "2014-09-25T21:47:28Z")

</div>

First, note that ODK Collect is designed to work under conditions of  
limited, intermittent network connectivity, or even without any internet.

There are two ways this could work:

(1) you can use ODK Aggregate installed on Google AppEngine as the  
recipient of all your data submissions from your surveyors' devices. This  
would require each surveyor to be within reach of a full internet  
connection at the time of their upload of data.

Then, you can use ODK Briefcase at your data processing center to download  
a full copy of the uploaded data from ODK Aggregate, and export CSV files  
for all of that data. These CSV files can then be imported into your MySQL  
server via LOAD DATA INFILE  
[http://dev.mysql.com/doc/refman/5.6/en/load-data.html](http://dev.mysql.com/doc/refman/5.6/en/load-data.html)

The entire system requires occasional internet connectivity from all data  
collection points and from your data center where you are running ODK  
Briefcase.

ODK Briefcase now has command line functionality which should allow you to  
automate the extract-and-transfer process using, e.g., a scheduled task  
(cron job).

A minor variant of this would involve setting up your own ODK Aggregate  
server to receive all submissions from ODK Collect within your own data  
center, rather than leveraging Google AppEngine to host it. This requires  
greater technical expertise.

Another minor variant would have you implement a webserver that implemented  
one of the data formats that ODK Aggregate can publish. This webserver  
would then take the published data and insert it into your database. The  
various publishers are described here  
[http://opendatakit.org/use/aggregate/data-transfer/](http://opendatakit.org/use/aggregate/data-transfer/) ODK Aggregate would  
then be configured to publish submitted data into this webserver as it  
flowed in. If ODK Aggregate were hosted on Google AppEngine, there are  
various retry mechanisms that should allow the publisher to continue  
operating even if the internet connectivity to your data center is  
intermittent.

(2) or, you can skip ODK Aggregate entirely.

This is a much more manual submission workflow:

Field supervisors review the contents of each device at the end of the day  
or survey period

All surveys are required to be Finalized -- any that are not are deleted.

Using a file manager like OI File Manager on the device, the supervisor  
creates a ZIP file of the /sdcard/odk directory, naming it something like  
deviceID-2014-09-26.zip

They then send that zip via some mechanism (USB drive, e-mail, etc.) to a  
data center (there is an option to send a file via e-mail within OI File  
Manager).

They then open ODK Collect and use the Delete Saved Forms button to delete  
all the filled-in submissions on the device.

Finally, they review receipt-confirmations (sent from the data center) for  
the zip files sent on previous days, and delete all zip files on the device  
that have had their receipt confirmed (the one from the current survey  
period remains on the device until it is confirmed in this manner).

At the data center, you have a staff that accepts the zip files (via  
courier, mail, e-mail, etc.).

They do a quality assurance pass by deleting the /sdcard/odk directory on a  
device, copying the zip to the device, un-zipping it, and opening ODK  
Collect to review the submitted data, and confirm that all submissions are  
finalized. This works best if the devices used during this step exactly  
match the devices used in the field.

If the quality assurance pass succeeds, they then send the zip on to a data  
curator.

The data curator unzips the file and uses ODK Briefcase to directly input  
the data onto their desktop computer.

And then you use the Export capability to generate a CSV and load it into  
your local MySQL database, as in (1)

> **···**
>
> ------- Mitch
> 
> On Thu, Sep 25, 2014 at 2:04 PM, Makhate Makhate [makhatemakhate@gmail.com](mailto:makhatemakhate@gmail.com) wrote:
> 
> > Dear Community,
> > 
> > I'm based in Lesotho and am experiencing some predicament here (i'm new to  
> > this technology); we have a complete functional web-based information  
> > system stores its data on MySQL. Just like in any developing country we're  
> > faced with the challenge of limited internet connectivity.  
> > So this is where i hit the wall; I want to know if i can collect data  
> > using ODK Collect and then have all the data collected transferred  
> > straight to MySQL so that information system will play with the data.
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)

---

<div class="post-metadata">

**Author:** ![Makhate\_Makhate](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/e99b99/32.png) [@Makhate\_Makhate](https://forum.getodk.org/u/Makhate_Makhate)\
**Post date:** [September 26, 2014, 7:50am UTC](https://forum.getodk.org/t/transferring-raw-data-to-mysql/3670/3 "2014-09-26T07:50:48Z")

</div>

Thank you very much Mitch,

Let me assimilate all of these....

> **···**
>
> On Thu, Sep 25, 2014 at 11:47 PM, Mitch Sundt wrote:
> 
> > First, note that ODK Collect is designed to work under conditions of  
> > limited, intermittent network connectivity, or even without any internet.
> > 
> > There are two ways this could work:
> > 
> > (1) you can use ODK Aggregate installed on Google AppEngine as the  
> > recipient of all your data submissions from your surveyors' devices. This  
> > would require each surveyor to be within reach of a full internet  
> > connection at the time of their upload of data.
> > 
> > Then, you can use ODK Briefcase at your data processing center to download  
> > a full copy of the uploaded data from ODK Aggregate, and export CSV files  
> > for all of that data. These CSV files can then be imported into your MySQL  
> > server via LOAD DATA INFILE  
> > [http://dev.mysql.com/doc/refman/5.6/en/load-data.html](http://dev.mysql.com/doc/refman/5.6/en/load-data.html)
> > 
> > The entire system requires occasional internet connectivity from all data  
> > collection points and from your data center where you are running ODK  
> > Briefcase.
> > 
> > ODK Briefcase now has command line functionality which should allow you to  
> > automate the extract-and-transfer process using, e.g., a scheduled task  
> > (cron job).
> > 
> > A minor variant of this would involve setting up your own ODK Aggregate  
> > server to receive all submissions from ODK Collect within your own data  
> > center, rather than leveraging Google AppEngine to host it. This requires  
> > greater technical expertise.
> > 
> > Another minor variant would have you implement a webserver that  
> > implemented one of the data formats that ODK Aggregate can publish. This  
> > webserver would then take the published data and insert it into your  
> > database. The various publishers are described here  
> > [http://opendatakit.org/use/aggregate/data-transfer/](http://opendatakit.org/use/aggregate/data-transfer/) ODK Aggregate would  
> > then be configured to publish submitted data into this webserver as it  
> > flowed in. If ODK Aggregate were hosted on Google AppEngine, there are  
> > various retry mechanisms that should allow the publisher to continue  
> > operating even if the internet connectivity to your data center is  
> > intermittent.
> > 
> > (2) or, you can skip ODK Aggregate entirely.
> > 
> > This is a much more manual submission workflow:
> > 
> > Field supervisors review the contents of each device at the end of the day  
> > or survey period
> > 
> > All surveys are required to be Finalized -- any that are not are deleted.
> > 
> > Using a file manager like OI File Manager on the device, the supervisor  
> > creates a ZIP file of the /sdcard/odk directory, naming it something like  
> > deviceID-2014-09-26.zip
> > 
> > They then send that zip via some mechanism (USB drive, e-mail, etc.) to a  
> > data center (there is an option to send a file via e-mail within OI File  
> > Manager).
> > 
> > They then open ODK Collect and use the Delete Saved Forms button to delete  
> > all the filled-in submissions on the device.
> > 
> > Finally, they review receipt-confirmations (sent from the data center) for  
> > the zip files sent on previous days, and delete all zip files on the device  
> > that have had their receipt confirmed (the one from the current survey  
> > period remains on the device until it is confirmed in this manner).
> > 
> > At the data center, you have a staff that accepts the zip files (via  
> > courier, mail, e-mail, etc.).
> > 
> > They do a quality assurance pass by deleting the /sdcard/odk directory on  
> > a device, copying the zip to the device, un-zipping it, and opening ODK  
> > Collect to review the submitted data, and confirm that all submissions are  
> > finalized. This works best if the devices used during this step exactly  
> > match the devices used in the field.
> > 
> > If the quality assurance pass succeeds, they then send the zip on to a  
> > data curator.
> > 
> > The data curator unzips the file and uses ODK Briefcase to directly input  
> > the data onto their desktop computer.
> > 
> > And then you use the Export capability to generate a CSV and load it into  
> > your local MySQL database, as in (1)
> > 
> > * * *
> > 
> > Mitch
> > 
> > On Thu, Sep 25, 2014 at 2:04 PM, Makhate Makhate \<[makhatemakhate@gmail.com](mailto:makhatemakhate@gmail.com) wrote:
> > 
> > > Dear Community,
> > > 
> > > I'm based in Lesotho and am experiencing some predicament here (i'm new  
> > > to this technology); we have a complete functional web-based information  
> > > system stores its data on MySQL. Just like in any developing country we're  
> > > faced with the challenge of limited internet connectivity.  
> > > So this is where i hit the wall; I want to know if i can collect data  
> > > using ODK Collect and then have all the data collected transferred  
> > > straight to MySQL so that information system will play with the data.
> > > 
> > > ## --
> > > 
> > > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > > 
> > > * * *
> > > 
> > > You received this message because you are subscribed to the Google Groups  
> > > "ODK Community" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Mitch Sundt  
> > Software Engineer  
> > University of Washington  
> > [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "ODK Community" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/opendatakit/RqnzfWwlYOQ/unsubscribe](https://groups.google.com/d/topic/opendatakit/RqnzfWwlYOQ/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,  
> Makhate Makhate (Lesotho)
> 
> "Forgiveness received makes a jubilant soul, forgiveness granted purifies a  
> soul"

---

<div class="post-metadata">

**Author:** ![Twentyonex30](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/t/df788c/32.png) [@Twentyonex30](https://forum.getodk.org/u/Twentyonex30)\
**Post date:** [January 28, 2015, 4:06am UTC](https://forum.getodk.org/t/transferring-raw-data-to-mysql/3670/4 "2015-01-28T04:06:59Z")

</div>

hi mitch,

can i ask something about my project - im trying to send a RAW data from a laboratory machine "SWELAB" TO mysql / php ., can you please help me or suggest any way for this - what process do i need to do ., thank you in advance for helping me about this matters. ill send you a sample of the raw data which i copy using the hyperterminal -- TIA 🙂

[parse.txt](https://getodk.b-cdn.net/uploads/default/original/2X/b/b7eec98cecb4e7d607de654772537ef6e583b7ff.txt) (8.79 KB)

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [January 29, 2015, 8:23pm UTC](https://forum.getodk.org/t/transferring-raw-data-to-mysql/3670/5 "2015-01-29T20:23:04Z")

</div>

I do not give generic advice like this.

> **···**
>
> On Tue, Jan 27, 2015 at 8:06 PM, wrote:
> 
> > hi mitch,
> > 
> > can i ask something about my project - im trying to send a RAW data from  
> > a laboratory machine "SWELAB" TO mysql / php ., can you please help me or  
> > suggest any way for this - what process do i need to do ., thank you in  
> > advance for helping me about this matters. ill send you a sample of  
> > the raw data which i copy using the hyperterminal -- TIA 🙂
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)
