Divide and Conquer Timeline Data with Typescript

Published On

Thu Oct 10 2024

Original Post

Medium Link

Topics

  • typescript
  • fintech
  • javascript
  • algorithms
  • software-development

Typescript time series and Date objects

Photo by Ishant Mishra on Unsplash

If your application is encountering performance issues with large data, checkout this date search typescript package. It works in node and browser runtimes.

date-search

Web apps are used in all sorts of applications. Frontend developers are constantly challenged to visualize more and more big data while still providing an excellent User Experience.

As data sets grow processing the information to glean insights and render a cool interface gets progressively challenging with the JavaScript standard library. One thing that makes this especially challenging for web developers is the range of clients trying to run their code. A customer could potentially try to process as massive data set spanning several years on a Chromebook or on a gaming PC with the latest top of the line hardware.

Encountering large datasets to visualize in the frontend is very common in commercial or industrial applications. Often these large datasets are stored by dates. Think of data like event logs, or financial transactions.

Even if we only have a piece of data per every 15 minute interval of data, that list would be over 525,600 data points for a year.

For cases when we need to know if a point exists, like “is there data on this date?” and “filter the transactions to this date” looping through the entire data set may not cut it.

// itterates through the entire data set
bigData.filter((data) => data.date === mydate);

// itterates though a portion of the data set
// or the whole data set if there is no match.
bigData.has((data) => data.date === mydate)

This is where a divide and conquer algorithm like binary search comes in handy.

Even if your comparison algorithm requires some compute, the worse case scenario for a 525K point data set is 19 iterations.

As you can see, this scales quite well.

  1. Financial applications: Time series data is commonly used in finance for predicting stock prices, analyzing market trends, and forecasting future values of financial instruments.
  2. Internet of Things (IoT) applications: IoT devices often generate time series data, such as temperature, humidity, and pressure readings, that need to be analyzed over time to identify patterns and anomalies.
  3. Health monitoring applications: Time series data is often used to monitor vital signs, such as heart rate, blood pressure, and oxygen levels, to identify trends and patterns that can help in disease diagnosis and treatment.
  4. Web analytics applications: Time series data is used to track website traffic, user engagement, and other metrics over time to identify trends and make data-driven decisions.

date-search


Divide and Conquer Timeline Data with Typescript was originally published in JavaScript in Plain English on Medium, where people are continuing the conversation by highlighting and responding to this story.

Blog Posts

I share insights from my journey in software development, user experience, and entrepreneurship, with a focus on building scalable systems, tackling complex challenges, and driving innovation.