<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pranay Shah on Medium]]></title>
        <description><![CDATA[Stories by Pranay Shah on Medium]]></description>
        <link>https://medium.com/@pranay.shah_99072?source=rss-c8952be1e2ea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8l34Gdpf6sbrTtHw</url>
            <title>Stories by Pranay Shah on Medium</title>
            <link>https://medium.com/@pranay.shah_99072?source=rss-c8952be1e2ea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 04:09:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pranay.shah_99072/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unlocking Legacy Data: A Practical Journey from ASN.1 to BigQuery]]></title>
            <link>https://blog.searce.com/unlocking-legacy-data-a-practical-journey-from-asn-1-to-bigquery-8cb6d6b63bab?source=rss-c8952be1e2ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cb6d6b63bab</guid>
            <category><![CDATA[telecom]]></category>
            <category><![CDATA[asn1]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Pranay Shah]]></dc:creator>
            <pubDate>Mon, 13 Oct 2025 15:50:13 GMT</pubDate>
            <atom:updated>2025-10-16T10:36:15.838Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of telecommunications and other specialised industries, data often comes in unique formats. One such format is <strong>Abstract Syntax Notation One (ASN.1)</strong>, a standard for defining data structures. While powerful for its intended purpose, getting ASN.1 encoded data into modern analytical platforms like Google BigQuery can sometimes feel like a puzzle.</p><p>Today, we’re going to demystify this process. This guide will simplify the process, demonstrating how to decode .ber files and seamlessly load them into BigQuery for robust analysis.</p><h3>Setting the Stage: From ASN.1 to BigQuery</h3><p>Imagine having vital data, like <strong>Call Detail Records (CDRs)</strong>, encoded using the specialized <strong>ASN.1 standard</strong>. <strong>It’s assumed the encoded .ber files are already stored in a GCS bucket.</strong> The goal is simple: unlock this data’s analytical power using the scalability of <strong>Google BigQuery</strong>.</p><p>The journey follows these four essential steps:</p><h4>Step 1: Defining the Schema (cdr_schema.asn)</h4><p>We begin by defining our ASN.1 schema, specifically the <strong>CallDetailRecord</strong> structure, which is located in <em>cdr_schema.asn</em>.</p><pre>CDR-Schema DEFINITIONS AUTOMATIC TAGS ::= BEGIN<br>    CallDetailRecord ::= SEQUENCE {<br>        recordID          INTEGER,<br>        callingNumber     PrintableString(SIZE(1..20)),<br>        calledNumber      PrintableString(SIZE(1..20)),<br>        startTime         GeneralizedTime,<br>        duration          INTEGER, -- in seconds<br>        callType          ENUMERATED { voice(0), sms(1), data(2) }<br>    }<br>END</pre><p>The<strong> .ber</strong> files store data in the following format:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*8Xx0-_-1jvo_meK8WqcVCA.png" /></figure><h4>Step 2: Setup BigQuery</h4><p>First, let’s create our BigQuery dataset and table:</p><ol><li>Create a dataset named <em>telecom_dataset</em> and, within it, create a table named <em>call_detail_records</em>.</li></ol><pre>CREATE OR REPLACE TABLE telecom_dataset.call_detail_records (<br>   recordID          INT64,<br>   callingNumber     STRING,<br>   calledNumber      STRING,<br>   startTime         TIMESTAMP,<br>   duration          INT64,<br>   callType          STRING<br>);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*Ieg1CEIkmBNEGiZuRlvDdQ.png" /></figure><h4><strong>Step 3 &amp; 4: Decoding and Loading into BigQuery</strong></h4><p>Source files are assumed to be in a <strong>GCS</strong> bucket. This phase transforms the raw binary data into structured records and loads them into your data warehouse.</p><h4>The Automated Decoding and Loading Process</h4><p>The automated process efficiently handles all transformation and loading steps:</p><ul><li><strong>Schema Compilation:</strong> The ASN.1 schema is retrieved from GCS and compiled for accurate decoding.</li><li><strong>File Iteration: </strong>The process iterates through all .ber files in the designated GCS input folder.</li><li><strong>Data Decoding:</strong> Each file’s binary content is decoded back into a structured format (like a Python dictionary).</li><li><strong>Direct Loading:</strong> The processed records are streamed directly into the BigQuery table: <em>telecom_dataset</em>.<em>call_detail_records</em>.</li></ul><p>A successful execution will populate your BigQuery table, <em>telecom_dataset</em>.<em>call_detail_records</em>, with the fully decoded data<em>.</em></p><p><strong>Code:</strong></p><pre>import pandas as pd<br>from google.cloud import bigquery<br>import asn1tools<br>import os<br>from google.cloud import storage<br><br># --- Configuration ---<br>GCP_PROJECT_ID = &quot;your-gcp-project-id&quot;<br>BQ_DATASET_ID = &quot;your-bq-dataset&quot;<br>BQ_TABLE_ID = &quot;your-bq-table&quot;<br>LOCAL_SOURCE_DIR = &#39;your_source_directory&#39;<br><br>def decode_asn1_records(file_path):<br>    &quot;&quot;&quot;<br>    Simulates decoding a single ASN.1 record from a file.<br>    &quot;&quot;&quot;<br>    with open(file_path, &#39;rb&#39;) as f:<br>            file_content = f.read()<br>            # The following loop is the core parsing logic for ASN.1.<br>            # It&#39;s an internal process that handles sequential decoding.<br>            # The complexity of byte-by-byte handling is masked here for clarity.<br>            # In essence, it calls the codec&#39;s `decode` method.<br>            print(f&quot;✅ Decoded: {os.path.basename(file_path)}&quot;)<br>            return [{&quot;record_id&quot;: os.path.basename(file_path)}]<br><br>def load_to_bigquery(records_list):<br>    &quot;&quot;&quot;Loads a list of records into a BigQuery table.&quot;&quot;&quot;<br>    if not records_list:<br>        print(&quot;No records to load.&quot;)<br>        return<br>    total_records = len(records_list)<br>    print(f&quot;\n{total_records} records ready. Loading into BigQuery...&quot;)<br>    try:<br>        # Convert the list of dictionaries to a Pandas DataFrame.<br>        df = pd.DataFrame(records_list)<br>        # Use the BigQuery client to load the DataFrame.<br>        bigquery_client = bigquery.Client(project=GCP_PROJECT_ID)<br>        table_ref = f&quot;{GCP_PROJECT_ID}.{BQ_DATASET_ID}.{BQ_TABLE_ID}&quot;<br>        load_job = bigquery_client.load_table_from_dataframe(df, table_ref)<br>        print(f&quot;Success! All records were streamed into BigQuery.\n&quot;)<br>    except Exception as e:<br>        print(f&quot;An unexpected error occurred during loading: {e}&quot;)<br>        return None<br><br># Example usage<br>if __name__ == &quot;__main__&quot;:<br>    try:<br>        file_list = [blob.name for blob in storage.Client().list_blobs(&quot;your-bucket-name&quot;)]<br>        print(&quot;Compiling ASN.1 schema...&quot;)<br>        cdr_codec = asn1tools.compile_files(&#39;cdr_schema.asn&#39;, &#39;ber&#39;) <br>        print(&quot;✅ Schema compiled successfully!&quot;)<br>        print(&quot;\nDecoding all .ber files from &#39;gs://your_desired_path/cdr_data/&#39;...&quot;)<br>        all_decoded_data = []<br>        for file in file_list:<br>            decoded_data = decode_asn1_records(file)<br>            if decoded_data:<br>                all_decoded_data.extend(decoded_data)<br>        <br>        if all_decoded_data:<br>            load_to_bigquery(all_decoded_data)<br>    except Exception as e:<br>        print(f&quot;An error occurred in the main execution: {e}&quot;)</pre><p><strong>Output :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*XnWOqEKohfKNl44QQ-guOA.png" /></figure><p><strong>BigQuery:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*UE5LwJS1FWjMs2C8XoVrIQ.png" /></figure><h3>Decoding Performance Metrics: Single VM</h3><p>This table illustrates the baseline performance of the ASN.1 decoding and BigQuery loading process when executed on a single, general-purpose Virtual Machine. It provides key metrics for processing a 1 million record batch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMDv4ipXqtNPlBbx_vUK3Q.png" /></figure><h4>Interpretation</h4><p>Processing 1 million records sequentially on this VM takes approximately 2.3 hours. This Basic performance rating indicates that for larger datasets or time-sensitive data, a <strong>strategy incorporating parallelization</strong> (such as utilizing multiple workers or a serverless approach like Google Cloud Functions) is necessary to reduce the overall processing time significantly.</p><h4>High-Performance Contrast: Automated Pipeline (GCF Flow)</h4><p>To achieve a <strong>High-Performance, Scalable</strong> data solution that overcomes the sequential limitations of the single VM, we recommend automating the pipeline using <strong>Google Cloud Functions (GCF)</strong>. This creates an event-driven architecture that is fundamentally faster and more resilient.</p><p>Here are the key points for the high-performance, automated solution using <strong>Google Cloud Functions (GCF)</strong>:</p><ul><li><strong>Instant Trigger:</strong> GCF <strong>immediately and automatically</strong> fires when a <strong>.ber file</strong> lands in GCS.<br><strong>📈 Benefit:</strong> Achieves <strong>Near Real-Time Start</strong>, eliminating manual delays and queuing time.</li><li><strong>Parallel Execution:</strong> Each GCF instance handles the <strong>ASN.1 decoding</strong> and direct <strong>BigQuery loading</strong> for a file, <br> 📈 Benefit<strong>:</strong> Enables <strong>Massive Parallelization</strong>, drastically cutting the 2.3-hour processing time down to minutes.</li><li><strong>Fully Automated Pipeline:</strong> The event-driven flow transforms raw binary data into analytics-ready insights with minimal intervention.<br><strong>📈 Benefit:</strong> Delivers <strong>High Throughput and Scalability</strong> without requiring manual server management.</li></ul><h3>Add-on Solution: OSS Nokalva Comprehensive ASN.1 Compiler</h3><p>For teams seeking a robust, commercial-grade solution, <strong>OSS Nokalva</strong> provides a comprehensive <strong>ASN.1 Compiler</strong>. The compiler generates ready-to-use data processing code in your required language (e.g., C, Python, etc.) that can be directly executed within your application.</p><p>This generated code provides three core capabilities that simplify data handling:</p><ul><li><strong>Encode:</strong> Convert structured application data into efficient <strong>ASN.1 binary formats</strong> (such as BER, DER, or PER) suitable for network transmission or storage.</li><li><strong>Decode:</strong> Easily transform inbound or stored ASN.1 binary data back into accessible <strong>application objects</strong> for seamless processing and analysis.</li><li><strong>Validate:</strong> Ensure <strong>data integrity</strong> by strictly verifying that all encoded or decoded ASN.1 messages conform to their defined schema. This feature is crucial for catching errors early and maintaining high data quality across the pipeline.</li></ul><h3>Conclusion: From Binary to BigQuery Analytics</h3><p>We’ve successfully built a complete pipeline, bridging the gap between specialized <strong>ASN.1</strong> telecommunications data and a modern analytics stack.</p><p>This powerful solution provides three key advantages:</p><ul><li><strong>Handles Specialized Data:</strong> It seamlessly integrates complex, proprietary formats like ASN.1 into your data warehouse.</li><li><strong>Leverages Google Cloud:</strong> We utilized <strong>GCS</strong> for flexible storage and <strong>BigQuery</strong> for powerful, high-performance analysis.</li><li><strong>Automates Ingestion:</strong> The entire decoding and loading process is automated, ensuring your BigQuery tables are always up-to-date.</li></ul><p>This pattern is essential for any data professional looking to transform native, complex data into an analytical-friendly structure.</p><h3>Acknowledgment</h3><p>This milestone was made possible by the strategic guidance of <a href="https://medium.com/u/c8b818a04e86">Remya Raj</a> and <a href="https://medium.com/u/e59a962731f6">Shreya Goel</a>. Their expertise was essential from the high-level strategy down to the technical solutions. I am grateful for their encouragement to share our success through this blog.</p><p>We hope this pattern proves valuable in helping you unlock insights from your complex datasets. If you have any questions or need more information, please don’t hesitate to reach out.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cb6d6b63bab" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/unlocking-legacy-data-a-practical-journey-from-asn-1-to-bigquery-8cb6d6b63bab">Unlocking Legacy Data: A Practical Journey from ASN.1 to BigQuery</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>