473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need help with data analysis

Folks,
I need help with this task. I have a set of data that needs to be plotted on
timeline chart.
Example:
Unit ProcStart ProcEnd Machine
U1 5/5/03 6:01 5/5/03 6:04 M1
U2 5/5/03 6:03 5/5/03 6:05 M1
U3 5/5/03 6:03 5/5/03 6:04 M2
:
etc. There are about 40K units and 30 serving machines. The data is in
MSAccess / SQLServer. My overall task is to plot concurrent processing at
each machine at each 1-minute interval.
Example for M1:
count
3|
2| * *
1| * * *
|______________________________
6:01 6:02 6:03 6:04 6:05 6:06

My thought is that if I can break down each row of data into smaller
timechunk, then I can do grouping and counts based on the new data -- which
is something like:
Unit ProcTime Machine
U1 6:01 M1
U1 6:02 M1
U1 6:03 M1
U1 6:04 M1
U2 6:03 M1
U2 6:04 M1
U2 6:05 M1
U3 6:03 M2
U3 6:04 M2
Then I was thinking to do query with: Machine, ProcTime, Count(Unit). Then I
can export the data into Excel and plot it.

My questions:
1) How to break the original data into smaller chunk timeframe (i.e. query,
stored procedure, etc.)?
2) Is this a sound approach? Any suggestions for better idea to achieve the
task?

Cheers,
-Jon

Jul 20 '05 #1
2 2968
"News" <ws*********@worldnet.att.net> wrote in message
news:8s*********************@bgtnsc04-news.ops.worldnet.att.net...
Folks,
I need help with this task. I have a set of data that needs to be plotted on
timeline chart.
Example:
Unit ProcStart ProcEnd Machine
U1 5/5/03 6:01 5/5/03 6:04 M1
U2 5/5/03 6:03 5/5/03 6:05 M1
U3 5/5/03 6:03 5/5/03 6:04 M2
:
etc. There are about 40K units and 30 serving machines. The data is in
MSAccess / SQLServer. My overall task is to plot concurrent processing at
each machine at each 1-minute interval.
Example for M1:
count
3|
2| * *
1| * * *
|______________________________
6:01 6:02 6:03 6:04 6:05 6:06

My thought is that if I can break down each row of data into smaller
timechunk, then I can do grouping and counts based on the new data -- which
is something like:
Unit ProcTime Machine
U1 6:01 M1
U1 6:02 M1
U1 6:03 M1
U1 6:04 M1
U2 6:03 M1
U2 6:04 M1
U2 6:05 M1
U3 6:03 M2
U3 6:04 M2
Then I was thinking to do query with: Machine, ProcTime, Count(Unit). Then I
can export the data into Excel and plot it.

My questions:
1) How to break the original data into smaller chunk timeframe (i.e. query,
stored procedure, etc.)?
2) Is this a sound approach? Any suggestions for better idea to achieve the
task?

Cheers,
-Jon


CREATE TABLE Processes
(
unit VARCHAR(10) NOT NULL,
proc_start SMALLDATETIME NOT NULL,
proc_end SMALLDATETIME NOT NULL,
machine VARCHAR(10) NOT NULL,
CONSTRAINT time_ck CHECK (proc_start <= proc_end),
PRIMARY KEY (machine, proc_start, proc_end, unit)
)

-- Sample data
INSERT INTO Processes (unit, proc_start, proc_end, machine)
SELECT 'U1', '20030505 6:01', '20030505 6:04', 'M1'
UNION ALL
SELECT 'U2', '20030505 6:03', '20030505 6:05', 'M1'
UNION ALL
SELECT 'U3', '20030505 6:03', '20030506 6:04', 'M2'

CREATE TABLE Digits
(
d TINYINT NOT NULL PRIMARY KEY CHECK (d BETWEEN 0 AND 9)
)

INSERT INTO Digits (d)
SELECT 0
UNION ALL
SELECT 1
UNION ALL
SELECT 2
UNION ALL
SELECT 3
UNION ALL
SELECT 4
UNION ALL
SELECT 5
UNION ALL
SELECT 6
UNION ALL
SELECT 7
UNION ALL
SELECT 8
UNION ALL
SELECT 9

CREATE TABLE NonnegativeIntegers
(
n INT NOT NULL PRIMARY KEY CHECK (n >= 0)
)

INSERT INTO NonnegativeIntegers (n)
SELECT Ones.d + 10 * Tens.d + 100 * Hundreds.d +
1000 * Thousands.d
FROM Digits AS Ones
CROSS JOIN
Digits AS Tens
CROSS JOIN
Digits AS Hundreds
CROSS JOIN
Digits AS Thousands

SELECT P.machine AS machine,
DATEADD(MINUTE, Minutes.m, Days.d) AS time,
COUNT(*) AS process_total
FROM (SELECT n
FROM NonnegativeIntegers
WHERE n < 1440) AS Minutes(m) -- minutes in 1 day
CROSS JOIN
(SELECT Interval.first_date + I.n
FROM (SELECT CAST(CONVERT(CHAR(8), MIN(proc_start), 112)
AS SMALLDATETIME) AS first_date,
DATEDIFF(DAY, MIN(proc_start),
MAX(proc_end)) AS days
FROM Processes) AS Interval
INNER JOIN
NonnegativeIntegers AS I
ON I.n <= Interval.days) AS Days(d)
INNER JOIN
Processes AS P
ON DATEADD(MINUTE, Minutes.m, Days.d) BETWEEN
P.proc_start AND P.proc_end
GROUP BY P.machine, Days.d, Minutes.m
ORDER BY P.machine, Days.d, Minutes.m

machine time process_total
m1 2003-05-05 06:01:00 1
m1 2003-05-05 06:02:00 1
m1 2003-05-05 06:03:00 2
m1 2003-05-05 06:04:00 2
m1 2003-05-05 06:05:00 1
m2 2003-05-05 06:03:00 1
m2 2003-05-05 06:04:00 1

Regards,
jag
Jul 20 '05 #2
Jon
John,
Thanks for the clue. It's elegant. I really appreciate it.

Cheers,
-Jon

"John Gilson" <ja*@acm.org> wrote in message
news:A3********************@twister.nyc.rr.com...
"News" <ws*********@worldnet.att.net> wrote in message
news:8s*********************@bgtnsc04-news.ops.worldnet.att.net...
Folks,
I need help with this task. I have a set of data that needs to be plotted on timeline chart.
Example:
Unit ProcStart ProcEnd Machine
U1 5/5/03 6:01 5/5/03 6:04 M1
U2 5/5/03 6:03 5/5/03 6:05 M1
U3 5/5/03 6:03 5/5/03 6:04 M2
:
etc. There are about 40K units and 30 serving machines. The data is in
MSAccess / SQLServer. My overall task is to plot concurrent processing at each machine at each 1-minute interval.
Example for M1:
count
3|
2| * *
1| * * *
|______________________________
6:01 6:02 6:03 6:04 6:05 6:06

My thought is that if I can break down each row of data into smaller
timechunk, then I can do grouping and counts based on the new data -- which is something like:
Unit ProcTime Machine
U1 6:01 M1
U1 6:02 M1
U1 6:03 M1
U1 6:04 M1
U2 6:03 M1
U2 6:04 M1
U2 6:05 M1
U3 6:03 M2
U3 6:04 M2
Then I was thinking to do query with: Machine, ProcTime, Count(Unit). Then I can export the data into Excel and plot it.

My questions:
1) How to break the original data into smaller chunk timeframe (i.e. query, stored procedure, etc.)?
2) Is this a sound approach? Any suggestions for better idea to achieve the task?

Cheers,
-Jon
CREATE TABLE Processes
(
unit VARCHAR(10) NOT NULL,
proc_start SMALLDATETIME NOT NULL,
proc_end SMALLDATETIME NOT NULL,
machine VARCHAR(10) NOT NULL,
CONSTRAINT time_ck CHECK (proc_start <= proc_end),
PRIMARY KEY (machine, proc_start, proc_end, unit)
)

-- Sample data
INSERT INTO Processes (unit, proc_start, proc_end, machine)
SELECT 'U1', '20030505 6:01', '20030505 6:04', 'M1'
UNION ALL
SELECT 'U2', '20030505 6:03', '20030505 6:05', 'M1'
UNION ALL
SELECT 'U3', '20030505 6:03', '20030506 6:04', 'M2'

CREATE TABLE Digits
(
d TINYINT NOT NULL PRIMARY KEY CHECK (d BETWEEN 0 AND 9)
)

INSERT INTO Digits (d)
SELECT 0
UNION ALL
SELECT 1
UNION ALL
SELECT 2
UNION ALL
SELECT 3
UNION ALL
SELECT 4
UNION ALL
SELECT 5
UNION ALL
SELECT 6
UNION ALL
SELECT 7
UNION ALL
SELECT 8
UNION ALL
SELECT 9

CREATE TABLE NonnegativeIntegers
(
n INT NOT NULL PRIMARY KEY CHECK (n >= 0)
)

INSERT INTO NonnegativeIntegers (n)
SELECT Ones.d + 10 * Tens.d + 100 * Hundreds.d +
1000 * Thousands.d
FROM Digits AS Ones
CROSS JOIN
Digits AS Tens
CROSS JOIN
Digits AS Hundreds
CROSS JOIN
Digits AS Thousands

SELECT P.machine AS machine,
DATEADD(MINUTE, Minutes.m, Days.d) AS time,
COUNT(*) AS process_total
FROM (SELECT n
FROM NonnegativeIntegers
WHERE n < 1440) AS Minutes(m) -- minutes in 1 day
CROSS JOIN
(SELECT Interval.first_date + I.n
FROM (SELECT CAST(CONVERT(CHAR(8), MIN(proc_start), 112)
AS SMALLDATETIME) AS

first_date, DATEDIFF(DAY, MIN(proc_start),
MAX(proc_end)) AS days FROM Processes) AS Interval
INNER JOIN
NonnegativeIntegers AS I
ON I.n <= Interval.days) AS Days(d)
INNER JOIN
Processes AS P
ON DATEADD(MINUTE, Minutes.m, Days.d) BETWEEN
P.proc_start AND P.proc_end
GROUP BY P.machine, Days.d, Minutes.m
ORDER BY P.machine, Days.d, Minutes.m

machine time process_total
m1 2003-05-05 06:01:00 1
m1 2003-05-05 06:02:00 1
m1 2003-05-05 06:03:00 2
m1 2003-05-05 06:04:00 2
m1 2003-05-05 06:05:00 1
m2 2003-05-05 06:03:00 1
m2 2003-05-05 06:04:00 1

Regards,
jag

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: S. Baseyko | last post by:
Hi for all. I need your advice in following: I've web app implemented in apache + php + mysql, that parsing some data from client's browser and displaying analysis of this data to user....
3
by: sarah28 | last post by:
Hi,I have MS SQL Server (& Analysis Server) installed on a Windows 2000 server machine.I installed the MS SQL Server client and Analysis server on my local machine too(Windows NT).Now,I created an...
2
by: Pawel | last post by:
I have small problem with XslTransformation. I get from WebService xml document. I have xslt and I want transform xml document to html code. It's look easy but I cant't manage with xPath. Maybe...
0
by: AOstarello | last post by:
Hi all, I'm trying to link to some OLAP cubes that were created using the MS SQL Server Analysis Tools. The cubes reside on an Analysis Server. I'm trying to find a simple way for users to...
6
by: Mudcat | last post by:
Hi, I am trying to build a tool that analyzes stock data. Therefore I am going to download and store quite a vast amount of it. Just for a general number - assuming there are about 7000 listed...
4
by: naknak4 | last post by:
Introduction This assignment requires you to develop solutions to the given problem using several different approaches (which actually involves using three different STL containers). You will...
6
by: naknak | last post by:
Introduction This assignment requires you to develop solutions to the given problem using several different approaches (which actually involves using three different STL containers). You will...
3
by: -1 | last post by:
I have a php file that I have briefly shown some of the code of at the bottom of this message. Part A of the script runs an analysis and then based upon the analysis, either does no data output...
9
by: Algonquin J. Calhoun | last post by:
I've developed an application that exceeds the Access 2GB limit. This application was developed as a prototype and the users have found it very useful. Approximately 45,000 records are added to...
9
by: moondaddy | last post by:
using c# 3.5 I have list of business objects which I will use in lists for databinding and I want to hide some of the fields so they don't show up in the list control. some of my list will be:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.