Is the naming of instance files significant?

Hi,

With reference to my earlier post[1] I have a follow up question.

From what I can see the naming convention for saved instances in the
/odk//instances/ directory is as follows:

[form name]-[date and time it was finalised].xml

There is nothing in the name which makes it unique. I have a feeling
this naming convention is used because it is the only piece of
metatada that shows when the form was finalised.

I have a number of devices that wil be running one of our custom
applications[2] generating instance files containing environment
sensor readings. Using the naming convention above, it is likely that
two devices will generate an instance with the same name.

To make it easier to collect all of the responses, and to implement
distributed storage of instance files, I'm storing copies of all of
the instance files from all of the devices in my mesh network into the
/odk/instances/ directory on each device.

I have a feeling the naming convention is significant because it is
the only piece of metatada that shows when the form was finalised.

However, the lack of guaranteed unique names is a concern.

With this in mind, I was wondering if I can add a third field which
would be the device id of the collecting device. The naming convention
for these instance files would become:

[form name]-[date and time it was finalised]-[device id].xml

Is this going to break anything? Especially the collection of
instances using ODK Collect and then the subsequent upload into ODK
Aggregate?

Alternate strategies for unique names are very welcome.

With thanks.

-Corey

Corey Wallis
Senior Software Engineer, MaGDAA Project (http://magdaaproject.org)
Senior Software Engineer, The Serval Project (http://www.servalproject.org)

[1] https://groups.google.com/d/topic/opendatakit/IhbXyBvm-XA/discussion
[2] http://wiki.magdaaproject.org/software:mem

ODK Briefcase expects that the XML filename match the enclosing folder name
(e.g., that you have
Sample_2012-04-25_12-19-11/Sample_2012-04-25_12-19-11.xml ), with one
enclosing folder per filled-in instance. Preserving the directory nesting
is only important if you want to use ODK Briefcase or if your form gathers
audio, image or video captures. The filenames of the capture files are the
integer epoch-seconds value at the time of the media capture, so these too
could collide if you did not retain the enclosing folder on the server.

For maximum compatibility, you should preserve that naming convention.
Otherwise, other than the workings internal to ODK Collect and this
assumption in ODK Briefcase, the names of the instance files are not
important or used for anything.

Note that ODK Collect will not "discover" instance files copied onto the
device. It only tracks the instances it has created (more when I respond to
the earlier recovery e-mail).

Mitch

··· On Wed, Oct 10, 2012 at 2:12 AM, Corey Wallis wrote:

Hi,

With reference to my earlier post[1] I have a follow up question.

From what I can see the naming convention for saved instances in the
/odk//instances/ directory is as follows:

[form name]-[date and time it was finalised].xml

There is nothing in the name which makes it unique. I have a feeling
this naming convention is used because it is the only piece of
metatada that shows when the form was finalised.

I have a number of devices that wil be running one of our custom
applications[2] generating instance files containing environment
sensor readings. Using the naming convention above, it is likely that
two devices will generate an instance with the same name.

To make it easier to collect all of the responses, and to implement
distributed storage of instance files, I'm storing copies of all of
the instance files from all of the devices in my mesh network into the
/odk/instances/ directory on each device.

I have a feeling the naming convention is significant because it is
the only piece of metatada that shows when the form was finalised.

However, the lack of guaranteed unique names is a concern.

With this in mind, I was wondering if I can add a third field which
would be the device id of the collecting device. The naming convention
for these instance files would become:

[form name]-[date and time it was finalised]-[device id].xml

Is this going to break anything? Especially the collection of
instances using ODK Collect and then the subsequent upload into ODK
Aggregate?

Alternate strategies for unique names are very welcome.

With thanks.

-Corey

Corey Wallis
Senior Software Engineer, MaGDAA Project (http://magdaaproject.org)
Senior Software Engineer, The Serval Project (http://www.servalproject.org
)

[1] https://groups.google.com/d/topic/opendatakit/IhbXyBvm-XA/discussion
[2] http://wiki.magdaaproject.org/software:mem

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Hi Mitch,

Thanks for your reply.

I should have mentioned that I'm preserving the directory and file
structure at this stage.

The methodology I think I'll adopt when copying instances between
devices in the mesh network is to:

  1. check for an existing file / directory before save
  2. if on exists, turn the textual representation of the date back into a number
  3. add one second
  4. turn the number back into the textual representation
  5. check for a duplicate
  6. if a duplicate exists go back to 2
  7. otherwise save the file

In this way the naming convention is maintained and no data will be lost.

Many thanks for your help.

-Corey

··· On Thu, Oct 11, 2012 at 4:34 AM, Mitch S wrote: > ODK Briefcase expects that the XML filename match the enclosing folder name > (e.g., that you have > Sample_2012-04-25_12-19-11/Sample_2012-04-25_12-19-11.xml ), with one > enclosing folder per filled-in instance. Preserving the directory nesting > is only important if you want to use ODK Briefcase or if your form gathers > audio, image or video captures. The filenames of the capture files are the > integer epoch-seconds value at the time of the media capture, so these too > could collide if you did not retain the enclosing folder on the server. > > For maximum compatibility, you should preserve that naming convention. > Otherwise, other than the workings internal to ODK Collect and this > assumption in ODK Briefcase, the names of the instance files are not > important or used for anything. > > Note that ODK Collect will not "discover" instance files copied onto the > device. It only tracks the instances it has created (more when I respond to > the earlier recovery e-mail). > > Mitch > > On Wed, Oct 10, 2012 at 2:12 AM, Corey Wallis wrote: >> >> Hi, >> >> With reference to my earlier post[1] I have a follow up question. >> >> From what I can see the naming convention for saved instances in the >> /odk//instances/ directory is as follows: >> >> [form name]-[date and time it was finalised].xml >> >> There is nothing in the name which makes it unique. I have a feeling >> this naming convention is used because it is the only piece of >> metatada that shows when the form was finalised. >> >> I have a number of devices that wil be running one of our custom >> applications[2] generating instance files containing environment >> sensor readings. Using the naming convention above, it is likely that >> two devices will generate an instance with the same name. >> >> To make it easier to collect all of the responses, and to implement >> distributed storage of instance files, I'm storing copies of all of >> the instance files from all of the devices in my mesh network into the >> /odk/instances/ directory on each device. >> >> I have a feeling the naming convention is significant because it is >> the only piece of metatada that shows when the form was finalised. >> >> However, the lack of guaranteed unique names is a concern. >> >> With this in mind, I was wondering if I can add a third field which >> would be the device id of the collecting device. The naming convention >> for these instance files would become: >> >> [form name]-[date and time it was finalised]-[device id].xml >> >> Is this going to break anything? Especially the collection of >> instances using ODK Collect and then the subsequent upload into ODK >> Aggregate? >> >> Alternate strategies for unique names are very welcome. >> >> With thanks. >> >> -Corey >> >> >> Corey Wallis >> Senior Software Engineer, MaGDAA Project (http://magdaaproject.org) >> Senior Software Engineer, The Serval Project >> (http://www.servalproject.org) >> >> [1] https://groups.google.com/d/topic/opendatakit/IhbXyBvm-XA/discussion >> [2] http://wiki.magdaaproject.org/software:mem >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en > > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitchellsundt@gmail.com > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en