CSV export / import

Dirk Hohndel dirk at hohndel.org
Sun Dec 21 12:43:48 PST 2014


So one of the things that I thought we should make easier for new users is
the ability to add dives that they have in a paper logbook.

What I hadn't realized (because, frankly, I never tried) is that our CSV
output is completely disjoint from what we are doing with CSV import. Oh,
and that the CSV import dialog has a few other shortcomings.

Let's imagine this little dive, that I created as manually added dive
within Subsurface.

<divelog program='subsurface' version='2'>
<settings>
</settings>
<dives>
<dive number='1' rating='5' visibility='5' date='2014-12-01' time='13:00:05' duration='46:06 min'>
  <location>My pool</location>
  <divemaster>Miika</divemaster>
  <buddy>Glance</buddy>
  <notes>Just a test of our export</notes>
  <suit>dry Whites Fusion</suit>
  <cylinder size='11.1 l' workpressure='207.0 bar' description='unknown' />
  <divetemperature air='25.0 C' water='10.0 C'/>
  <divecomputer model='manually added dive' date='2014-12-21' time='13:31:05'>  ### <--- fun, that's the time I did the "add manual dive" - we didn't copy the dive time down here
  <depth max='15.0 m' mean='13.671 m' />
  <sample time='0:00 min' depth='0.0 m' />
  <sample time='1:00 min' depth='15.0 m' />
  <sample time='40:00 min' depth='15.0 m' />
  <sample time='42:00 min' depth='5.0 m' />
  <sample time='45:00 min' depth='5.0 m' />
  <sample time='46:06 min' depth='0.0 m' />
  </divecomputer>
</dive>
</dives>
</divelog>

If I export this to CSV I get this:

"dive number","date","time","duration","depth","temperature","pressure"
"1","2014-12-01","13:00:05","0:00","0.0",,
"1","2014-12-01","13:00:05","1:00","15.0",,
"1","2014-12-01","13:00:05","40:00","15.0",,
"1","2014-12-01","13:00:05","42:00","5.0",,
"1","2014-12-01","13:00:05","45:00","5.0",,
"1","2014-12-01","13:00:05","46:06","0.0",,

OK, that's spectacularly useless. Now one could argue that it doesn't make
much sense to have a "correct" and "complete" CSV export (since XML and
git are our two supported formats), but I'm thinking again about the
specific use case. We have a diver with a few hundred dives on paper who
wants to add those to Subsurface.

So what I think we SHOULD support is something like this:

"dive number", "date", "time", "duration", "max depth", "avg depth", "air temp", "water temp", "start pressure", "end pressure", "location", "divemaster", "buddy", "notes", "suit", "rating", "visibility"

So forget about the profile, these are manually added dives, we will just
create our wonderful fake profiles for the user. But these are the items
that may or may not be in a paper logbook. And we should be able to
consistently export and import them as CSV (so people can edit them in a
spreadsheet or text editor.

For the export this should be simple - just always export all of these
columns, even if the values end up being empty. Oh, and please allow
export in imperial or metric and mark that somewhere in the exported data.

And the import just needs this exact format as one of the default choices
and then do the right thing.

Makes sense? What am I missing?

/D


More information about the subsurface mailing list