Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3605266
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:06:08+00:00 2026-05-18T21:06:08+00:00

Backdrop: I have a file hierarchy of cvs files for multiple locations named by

  • 0

Backdrop:

I have a file hierarchy of cvs files for multiple locations named by dates they cover …by month specifically. Each cvs file in the folder is named after the location.

eg’,
folder name: 2010-feb

contains:
location1.csv
location2.csv

Each CSV file holds records like this:

2010-06-28, 20:30:00 , 0
2010-06-29, 08:30:00 , 0
2010-06-29, 09:30:00 , 0
2010-06-29, 10:30:00 , 0
2010-06-29, 11:30:00 , 0

meaning of record columns ( column names ):

Date, time, # of sessions

I have a perl script that pulls the data from this mess and originally I was going to store it as json files, but am thinking a database might be more appropriate long term …comparing year to year trends …fun stuff like that.

Pt 2 – My question/problem:

So I now have a REST service that coughs up json with a test database. My question is [ I suck at db design ], how best to design a database backend for this?

I am thinking the following tables would suffice and keep it simple:

Location: (PK)location_code, name 
session: (PK)id, (FK)location_code, month, hour, num_sessions

I need to be able to average sessions (plus min and max) for each hour across days of week in addition to days of week in a given month or months. I’ve been using perl hashes to do this and am trying to decide how best to implement this with a database.

Do you think stored procedures should be used?

As to the database, depending on info gathered here, it will be postgresql or sqlite.
If there is no compelling reason for postgresql I’ll stick with sqlite.

How and where should I compare the data to hours of operation. I am storing the hours
of operation in a yaml file. I currently ‘match’ the hour in the data to a hash from the yaml to do this. Would a database open simpler methods? I am thinking I would do this comparison as I do now then insert the data. Can be recalled with:

SELECT hour, num_sessions FROM session WHERE location_code=LOC1

Since only hours of operation are present, I do not need to worry about it.
Should I calculate all results as I do now then store as a stats table for
different ‘reports’? This, rather than processing on demand? How would this look?

Anyway …I ramble.

Thanks for reading!

Bubnoff

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:06:08+00:00Added an answer on May 18, 2026 at 9:06 pm

    From what I read of SQLite, it offers the functions you need for doing the analysis you want (sum, avg, etc), and it looks like you’ll be doing that at your own api level as opposed to allowing an end user to do it themselves through an interface. So for the simple design + small dataset you have I would look at getting all your data into SQLite. I’d also put it in the format SQLite can understand natively, so that you can use its SQL functions without needing to convert anything first or without needing to create special functions to be used within SQL to do the conversion.

    Aside from that, your design looks fine to me except for the month and hour fields. I would leave those as full date and time fields, or possibly combine them to just one date_time field if there’s an appropriate SQLite data type for that, and put the full date/time data in them (in case you’ll need it later). Then use SQLite time functions to extract the month and hour as appropriate from your full date/time fields. As a convenience, and if SQLite supports it, you could create calculated fields for month and hour in the session table, which would let you immediately return the data you’re looking for from a query, instead of explicitly calling time extraction functions in every query you want a month or hour for.

    Also, don’t forget to put indexes on fields that you set criteria on in queries. You may not notice a difference with small data sets, but as your db gets bigger, they could make a huge difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this xml file. <movies> <movie> <score>8.582207</score> <popularity>3</popularity> <translated>true</translated> <adult>false</adult> <language>en</language> <original_name>Transformers</original_name> <name>Transformers</name>
I have a selection of images that I will build a backdrop to a
Basically I have 2 methods in the same class, getMovie and getGenres. They are
I have a problem with the twitter bootstrap modal setting the backdrop over the
As a quick backdrop for my question, with x86, it is guaranteed that a
I have this nice dialog view I set my UserInputDialog class to: <LinearLayout android:id=@+id/LinearLayout01
I have a list of items, and upon clicking on one of the items,
Ive been writing my code and have declared and defined all the necessary variables
I have a modal created using Twitter Bootstrap. I want to open using javascript.
I have the following setup: class App.Views.Maps extends Backbone.View el: '#map' events: initialize: ->

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.