If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Trouble visualizing design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-09, 11:48
supermancc0386 supermancc0386 is offline
Registered User
 
Join Date: Mar 2009
Posts: 5
Trouble visualizing design

I'd like to apologize in advance if this is silly easy. I haven't had too much experience in database design and I'm struggling with trying to grasp how to go about this. I've read over a few examples here and the JDBC tutorial over at Sun but I'm having trouble making the connection from what they are doing to what I'm doing and I think that I'm just thinking about it wrong.

I am working on an application in Java. The application is a large statistical simulation for soil. Basically, the model takes in a geographical location then allows users to put in up to 10 different soil make-ups (I call them covers) and simulate various variables about the soil over the course of the year. Each cover can be up to 100 inches thick. At every 5 minutes throughout the year, I need to write out variables for each inch such as temp, moisture, porosity, ect.

I'd like to get this all into a database so I can quickly and easily retrieve the data for graphing. I'm having trouble visualizing how to set this up. I think what is confusing me is trying to put this into tables with the time.

Recap
I've got a list of up to 10 covers.
Each cover has up to 100 inchs
Each inch has 20 variables that get recorded every 5 minutes.

***EDIT***

Right now I can see having a table with the Cover and Inch and then a table for each Inch with the Time and Var1, Var2, Var3. ect. I don't see how to join them though?

Last edited by supermancc0386; 03-02-09 at 12:17.
Reply With Quote
  #2 (permalink)  
Old 03-02-09, 12:16
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
... location then allows users to put in up to 10 different soil make-ups (I call them covers)
Can a location have more than one soil cover?
If so then is that a mixture or is it layered?
Do you have a complete list ofvariables?
Are they all numeric?
What's the purpose of the application?
Is it a college project?
Reply With Quote
  #3 (permalink)  
Old 03-02-09, 13:06
supermancc0386 supermancc0386 is offline
Registered User
 
Join Date: Mar 2009
Posts: 5
Yes, each location can have more than one cover

The covers aren't layered or mixed. The reason for multiple covers is to allow the user to see results from different types of covers and then decide which one to choose.

Yes, I know the variables I need written.

Yes, they are all numeric.

The purpose of the application is to be able to see visually (via graph) how each of these variables changes over the course of the year at the selected depth(inch). The end result is a compilation of graphs where you can select any cover, and then select 3 different inches and view the changes at each inch. So I could select Cover 1, and then select nodes 3, 35, and 87 and the various graphs will then show the changes in each variable. So I'd have a graph of something like Temperature for Cover 1 and there are three lines, one for 3in deep, one for 35in deep, and one for 87in deep. Then if the user wants, they can select a different cover with different depths.

This is not a college project even though I am a college student. I am working on this where I am interning. I was not hired on to do database design. I work mostly in Java designing applications. It is not a software design company so I am kind of on my own. I have not yet begun database design in my college classes. Right now, the program writes to a CSV file and is painfully slow to switch depths. The amount of data is too much to keep in memory so I have to write it out at each time step. This results in a very poorly organized CSV file which makes it very slow to parse out all of the necessary information. From what I know about databases, I feel like a database would be a much better solution. Working on this now will also hopefully give me a better understanding of databases and I will have an easier time with my future classes. So I'm really doing this more for me on a personal level. The application works as is, but I want to figure out how to improve it.
Reply With Quote
  #4 (permalink)  
Old 03-02-09, 14:29
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
My 1st guess would be:

Location: id ,name?, gps
Cover: id, name
Depth: depth?
Sample: loc_id, cover_id, depth, time, temp, moisture, porosity, etc

Not sure if you'd want a depth table or just use the depth field in Sample and make sure it's within a certain range. Wasn't sure if locations would have a name or just a gps tag. You could also experiment with the following set up which would work and perhaps make it slightly easier to build your screens etc :

Location: id ,name?, gps
Cover: id, name
Depth: depth?
Variable: name
Sample: loc_id, cover_id, depth, time, variable, value

I also just tried to guess the amount of data you intend to store, roughly 100m records for each location (using 1st method). This seems a lot of data for what you're doing.
Reply With Quote
  #5 (permalink)  
Old 03-03-09, 10:48
supermancc0386 supermancc0386 is offline
Registered User
 
Join Date: Mar 2009
Posts: 5
Thanks but the idea is that you have one location and you put in 10 possible covers. Seeing the results allows the user to determine which cover design they want to go with.

But I've been reading a bit more about database design. It said if you are stuck with normalization, make a table. So I did.

My columns are as follows:

Cover
Depth
Day
Time
Rain
ETO
TimeEvap
PET
WaterPot
WaterCon
Temp
HFAvg
Flux
MethConc
OxyConc
MethFlux
SumInF
SoilTAdd
SurfaceH2O
CH4Oxid


So now when the user wants to change what they are viewing, I want them to select the Cover they want to view from and the depth they want to view. Then I want each graph to update accordingly. So say the user switches the Temp Graph from Cover 4, Depth 36 to Cover 1, Depth 12. Now I need to retrieve all of the Temp data for Cover 1, Depth 12. I also need to know the day and time so that the data is displayed in chronological order (X would be the time, Y would be the temp on the graph). So would my primary key be a combination of my Cover and Depth? And then would I need anymore normalization for this? Because I would be getting the day, time, and temp where Cover = 1, and Depth = 12;
Reply With Quote
  #6 (permalink)  
Old 03-03-09, 15:16
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Thanks but the idea is that you have one location and you put in 10 possible covers.
But previously you said ...
Quote:
Yes, each location can have more than one cover
Quote:
So would my primary key be a combination of my Cover and Depth?
No you need to add date time as well.
Should you be creating a Cover table to provide a list of available covers?

Should you be creating a Variables table to provide a list of variables and perhaps the field name to use?
Reply With Quote
  #7 (permalink)  
Old 03-05-09, 12:14
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Just saw this on TED which may interest you - it's about restoring a rainforest via soil & plants etc.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On