Repository: usdot-fhwa-stol/asn1-specification-splitter
Pull request #1: Initial project setup
Author: login: BhanuYeswanthReddy03
Created: 2025-03-19T18:02:56Z | Merged: 2025-03-25T21:14:46Z

<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
Initial Project Setup for ASN1 Spec Splitter.
<!--- Describe your changes in detail -->

## Related GitHub Issue

<!--- This project only accepts pull requests related to open GitHub issues or Jira Keys -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please DO NOT name partially fixed issues, instead open an issue specific to this fix -->
<!--- Please link to the issue here: -->

## Related Jira Key
N/A

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Defect fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.



Diff:
diff --git a/POC/README.md b/POC/README.md
new file mode 100644
index 0000000..1f9e5e7
--- /dev/null
+++ b/POC/README.md
@@ -0,0 +1,44 @@
+# POC for asn1 - splitter
+
+### Introduction
+
+- This proof of concept (PoC) was developed to validate the feasibility of the initial logic for processing ASN.1 files. It takes a monolithic ASN.1 file, identifies and extracts     individual namespaces and components, and splits them into modular, manageable .asn1 files. This approach enables better organization and dependency management. As the project evolves, this PoC will be extended into a fully-featured, production-grade solution built to meet industry standards and scalability requirements.
+
+
+### Set up Environment
+
+- Setting up a virtual environment in the root directory and run the following commands:
+    -  python -m venv venv   (or) python3 -m venv venv
+    -  For MacOS
+        - . ./venv/bin/activate 
+    -  For Windows
+        - venv/scripts/activate
+
+
+- Once inside the root directory run:
+    - pip install asn1tools
+
+- Your environment to run .py files will be ready after installation.
+
+### Execution
+
+- Setup environment and make sure venv is activated before proceeding to next steps.
+
+- Once virutal environment is activated. 
+    - Navigate to the directory in which parser.py is present. 
+    - Make sure to have the input file path.
+    - To run the file use python parser.py <file_path>.
+    - Once the parser runs successfully you can find the individual files in messages.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/POC/files/messages/.gitkeep b/POC/files/messages/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/POC/files/namespace/.gitkeep b/POC/files/namespace/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/POC/files/schema/.gitkeep b/POC/files/schema/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/POC/files/schema_updated/.gitkeep b/POC/files/schema_updated/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/POC/py/parser.py b/POC/py/parser.py
new file mode 100644
index 0000000..e29b54a
--- /dev/null
+++ b/POC/py/parser.py
@@ -0,0 +1,317 @@
+# Copyright (C) 2025 LEIDOS.
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
+        line=lines[count]
+        if "--" in line:
+            line=line.split("--")[0]
+
+        if "::=" in line:
+            if component_name!="":
+                components[component_name]={
+                    "start":start+1,
+                    "end":count
+                }
+            component_name=line.split()[0]
+            start=count
+        count+=1
+
+    
+    if component_name!="":
+        components[component_name]={
+            "start":start,
+            "end":count
+        }
+
+    for i in components:
+        if i[0].islower():
+            continue
+        with open(f"../files/schema/{i}.asn1",'w') as file:
+            for j in range(components[i]["start"]-1,components[i]["end"]):
+                file.write(lines[j]+'\n')
+
+# with open("components.json",'w') as file:
+#     json.dump(components,file,indent=4)
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+available_namespaces=[i for i in namespaces]
+constant_names=[i for i in constant_mapper]
+
+def clean_string(s):
+    return re.sub(r'[^a-zA-Z0-9-]', '', s)  # Allow '-' in the string
+
+
+
+"""
+    Modify the words by removing namespace
+"""
+print(available_namespaces)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+        for i in available_namespaces:
+            data=data.replace(i+".","")
+
+    with open(f"../files/schema/{schema_file}",'w') as file:
+        file.write(data)
+
+
+dependency_matrix={}
+
+for schema_file in schema_files:
+
+    dependencies=set()
+    updated_data=[]
+    name=schema_file.split(".")[0]
+    visited=set()
+    with open(f"../files/schema/{name}.asn1",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        
+        lines=data.splitlines()
+        for line in lines:
+            updated_data.append(line)
+        
+        for line in lines:
+            if "--" in line:
+                line=line.split("--")[0]
+
+            words=line.split()
+            # print(words)
+            for word in words:
+                
+                word=clean_string(word)
+
+                if word in schema_names and word!=name:
+                    dependencies.add(word)
+                
+
+    dependency_matrix[name]=list(dependencies)
+
+
+deps={k: v for k, v in sorted(dependency_matrix.items(), key=lambda item: item[0])}
+with open("deps.json",'w') as file:
+    json.dump(deps,file,indent=4)
+
+
+def get_deps(key,visited):
+    if key in deps:
+        for i in deps[key]:
+            if i not in visited:
+                visited.add(i)
+                get_deps(i,visited)
+    
+
+combined_deps={}
+
+for dep in deps:
+    queue = deque()
+    visited=set()
+    if len(deps[dep])==0:
+        combined_deps[dep]=deps[dep]
+
+    else:
+        for i in deps[dep]:
+            visited.add(i)
+            queue.append(i)
+            get_deps(i,visited)
+        combined_deps[dep]=list(visited)
+
+        
+         
+
+with open("combined_deps.json",'w') as file:
+    json.dump(combined_deps,file,indent=4)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+       
+        ds=combined_deps[name]
+
+        for d in ds:
+            with open(f"../files/schema/{d}.asn1",'r') as file:
+                data+=file.read()
+
+    with open(f"../files/schema_updated/{schema_file}",'w') as file:
+        file.write(data)
+    
+
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+for schema_file in schema_files:
+    with open(f"../files/schema_updated/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+    
+        lines=data.splitlines()
+
+        lines=[f"{name} DEFINITIONS ::= BEGIN\n"]+lines+["END"]
+
+    with open(f"../files/schema_updated/{schema_file}",'w') as file:
+        for line in lines:
+            file.write(line+'\n')
+
+error_count=0
+error_files={}
+for file in schema_files:
+    print("compiling file:",file)
+    try:
+        asn1tools.compile_files(f"../files/schema_updated/{file}", 'uper')
+    except Exception as e:
+        print("Error in file:",file)
+        error_files[file]=str(e)
+        print(e)
+        error_count+=1
+        print("\n\n")
+
+print("Total Errors:",error_count)
+print("Total Files:",len(schema_files))
+
+
+with open("error_files.json",'w') as file:
+    json.dump(error_files,file,indent=4)
+
+for i in deps['MessageTypes']:    
+    # copy the file from schema_updated dir to messages dir
+    shutil.copy(f"../files/schema_updated/{i}.asn1", f"../files/messages/{i}.asn1")
+
+
+
+
+
+# with open("constant_mapper.json",'w') as file:
+#     json.dump(constant_mapper,file,indent=4)


Reviews:
user: login: saina-ramyar
state: CHANGES_REQUESTED
author_association: NONE
submitted_at: 2025-03-21T20:49:01Z
user: login: saina-ramyar
state: COMMENTED
author_association: NONE
submitted_at: 2025-03-24T16:43:16Z
user: login: saina-ramyar
state: APPROVED
author_association: NONE
submitted_at: 2025-03-25T21:14:34Z

Review comments:
diff_hunk: @@ -0,0 +1,298 @@
+import sys
path: POC/parser.py
user: login: saina-ramyar
body: please add the following copyright statement to each new file that is added:

/*
 * Copyright (C) 2025 LEIDOS.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
created_at: 2025-03-19T20:26:38Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
path: POC/py/parser.py
user: login: saina-ramyar
body: please add the copyright statement in the beginning of this file
created_at: 2025-03-21T20:40:35Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
path: POC/py/parser.py
user: login: saina-ramyar
body: I have seen some spec files ending with .asn
is that something that should be considered here?
created_at: 2025-03-21T20:41:27Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
path: POC/py/parser.py
user: login: saina-ramyar
body: make the error more descriptive, saying this something like code accepts ".asn1" types
created_at: 2025-03-21T20:42:52Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
path: POC/py/parser.py
user: login: saina-ramyar
body: what is the purpose of these next few lines?
created_at: 2025-03-21T20:43:45Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
path: POC/py/parser.py
user: login: saina-ramyar
body: for each function defined, please add a description introducing purpose of the function, its input and its output
created_at: 2025-03-21T20:45:03Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
path: POC/py/parser.py
user: login: saina-ramyar
body: is this for future use?
created_at: 2025-03-21T20:45:40Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
path: POC/py/parser.py
user: login: saina-ramyar
body: please add description to this while loop and its "if" conditions
created_at: 2025-03-21T20:46:25Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
+        line=lines[count]
+        if "--" in line:
+            line=line.split("--")[0]
+
+        if "::=" in line:
+            if component_name!="":
+                components[component_name]={
+                    "start":start+1,
+                    "end":count
+                }
+            component_name=line.split()[0]
+            start=count
+        count+=1
+
+    
+    if component_name!="":
+        components[component_name]={
+            "start":start,
+            "end":count
+        }
+
+    for i in components:
+        if i[0].islower():
+            continue
+        with open(f"../files/schema/{i}.asn1",'w') as file:
+            for j in range(components[i]["start"]-1,components[i]["end"]):
+                file.write(lines[j]+'\n')
+
+# with open("components.json",'w') as file:
+#     json.dump(components,file,indent=4)
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+available_namespaces=[i for i in namespaces]
+constant_names=[i for i in constant_mapper]
+
+def clean_string(s):
path: POC/py/parser.py
user: login: saina-ramyar
body: please add description as requested above
created_at: 2025-03-21T20:47:18Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
+        line=lines[count]
+        if "--" in line:
+            line=line.split("--")[0]
+
+        if "::=" in line:
+            if component_name!="":
+                components[component_name]={
+                    "start":start+1,
+                    "end":count
+                }
+            component_name=line.split()[0]
+            start=count
+        count+=1
+
+    
+    if component_name!="":
+        components[component_name]={
+            "start":start,
+            "end":count
+        }
+
+    for i in components:
+        if i[0].islower():
+            continue
+        with open(f"../files/schema/{i}.asn1",'w') as file:
+            for j in range(components[i]["start"]-1,components[i]["end"]):
+                file.write(lines[j]+'\n')
+
+# with open("components.json",'w') as file:
+#     json.dump(components,file,indent=4)
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+available_namespaces=[i for i in namespaces]
+constant_names=[i for i in constant_mapper]
+
+def clean_string(s):
+    return re.sub(r'[^a-zA-Z0-9-]', '', s)  # Allow '-' in the string
+
+
+
+"""
+    Modify the words by removing namespace
+"""
+print(available_namespaces)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+        for i in available_namespaces:
+            data=data.replace(i+".","")
+
+    with open(f"../files/schema/{schema_file}",'w') as file:
+        file.write(data)
+
+
+dependency_matrix={}
+
+for schema_file in schema_files:
path: POC/py/parser.py
user: login: saina-ramyar
body: add description here
created_at: 2025-03-21T20:47:39Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
+        line=lines[count]
+        if "--" in line:
+            line=line.split("--")[0]
+
+        if "::=" in line:
+            if component_name!="":
+                components[component_name]={
+                    "start":start+1,
+                    "end":count
+                }
+            component_name=line.split()[0]
+            start=count
+        count+=1
+
+    
+    if component_name!="":
+        components[component_name]={
+            "start":start,
+            "end":count
+        }
+
+    for i in components:
+        if i[0].islower():
+            continue
+        with open(f"../files/schema/{i}.asn1",'w') as file:
+            for j in range(components[i]["start"]-1,components[i]["end"]):
+                file.write(lines[j]+'\n')
+
+# with open("components.json",'w') as file:
+#     json.dump(components,file,indent=4)
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+available_namespaces=[i for i in namespaces]
+constant_names=[i for i in constant_mapper]
+
+def clean_string(s):
+    return re.sub(r'[^a-zA-Z0-9-]', '', s)  # Allow '-' in the string
+
+
+
+"""
+    Modify the words by removing namespace
+"""
+print(available_namespaces)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+        for i in available_namespaces:
+            data=data.replace(i+".","")
+
+    with open(f"../files/schema/{schema_file}",'w') as file:
+        file.write(data)
+
+
+dependency_matrix={}
+
+for schema_file in schema_files:
+
+    dependencies=set()
+    updated_data=[]
+    name=schema_file.split(".")[0]
+    visited=set()
+    with open(f"../files/schema/{name}.asn1",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        
+        lines=data.splitlines()
+        for line in lines:
+            updated_data.append(line)
+        
+        for line in lines:
+            if "--" in line:
+                line=line.split("--")[0]
+
+            words=line.split()
+            # print(words)
+            for word in words:
+                
+                word=clean_string(word)
+
+                if word in schema_names and word!=name:
+                    dependencies.add(word)
+                
+
+    dependency_matrix[name]=list(dependencies)
+
+
+deps={k: v for k, v in sorted(dependency_matrix.items(), key=lambda item: item[0])}
+with open("deps.json",'w') as file:
+    json.dump(deps,file,indent=4)
+
+
+def get_deps(key,visited):
path: POC/py/parser.py
user: login: saina-ramyar
body: add description
created_at: 2025-03-21T20:48:20Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
+        line=lines[count]
+        if "--" in line:
+            line=line.split("--")[0]
+
+        if "::=" in line:
+            if component_name!="":
+                components[component_name]={
+                    "start":start+1,
+                    "end":count
+                }
+            component_name=line.split()[0]
+            start=count
+        count+=1
+
+    
+    if component_name!="":
+        components[component_name]={
+            "start":start,
+            "end":count
+        }
+
+    for i in components:
+        if i[0].islower():
+            continue
+        with open(f"../files/schema/{i}.asn1",'w') as file:
+            for j in range(components[i]["start"]-1,components[i]["end"]):
+                file.write(lines[j]+'\n')
+
+# with open("components.json",'w') as file:
+#     json.dump(components,file,indent=4)
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+available_namespaces=[i for i in namespaces]
+constant_names=[i for i in constant_mapper]
+
+def clean_string(s):
+    return re.sub(r'[^a-zA-Z0-9-]', '', s)  # Allow '-' in the string
+
+
+
+"""
+    Modify the words by removing namespace
+"""
+print(available_namespaces)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+        for i in available_namespaces:
+            data=data.replace(i+".","")
+
+    with open(f"../files/schema/{schema_file}",'w') as file:
+        file.write(data)
+
+
+dependency_matrix={}
+
+for schema_file in schema_files:
+
+    dependencies=set()
+    updated_data=[]
+    name=schema_file.split(".")[0]
+    visited=set()
+    with open(f"../files/schema/{name}.asn1",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        
+        lines=data.splitlines()
+        for line in lines:
+            updated_data.append(line)
+        
+        for line in lines:
+            if "--" in line:
+                line=line.split("--")[0]
+
+            words=line.split()
+            # print(words)
+            for word in words:
+                
+                word=clean_string(word)
+
+                if word in schema_names and word!=name:
+                    dependencies.add(word)
+                
+
+    dependency_matrix[name]=list(dependencies)
+
+
+deps={k: v for k, v in sorted(dependency_matrix.items(), key=lambda item: item[0])}
+with open("deps.json",'w') as file:
+    json.dump(deps,file,indent=4)
+
+
+def get_deps(key,visited):
+    if key in deps:
+        for i in deps[key]:
+            if i not in visited:
+                visited.add(i)
+                get_deps(i,visited)
+    
+
+combined_deps={}
+
path: POC/py/parser.py
user: login: saina-ramyar
body: add comments 
created_at: 2025-03-21T20:48:27Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
+        line=lines[count]
+        if "--" in line:
+            line=line.split("--")[0]
+
+        if "::=" in line:
+            if component_name!="":
+                components[component_name]={
+                    "start":start+1,
+                    "end":count
+                }
+            component_name=line.split()[0]
+            start=count
+        count+=1
+
+    
+    if component_name!="":
+        components[component_name]={
+            "start":start,
+            "end":count
+        }
+
+    for i in components:
+        if i[0].islower():
+            continue
+        with open(f"../files/schema/{i}.asn1",'w') as file:
+            for j in range(components[i]["start"]-1,components[i]["end"]):
+                file.write(lines[j]+'\n')
+
+# with open("components.json",'w') as file:
+#     json.dump(components,file,indent=4)
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+available_namespaces=[i for i in namespaces]
+constant_names=[i for i in constant_mapper]
+
+def clean_string(s):
+    return re.sub(r'[^a-zA-Z0-9-]', '', s)  # Allow '-' in the string
+
+
+
+"""
+    Modify the words by removing namespace
+"""
+print(available_namespaces)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+        for i in available_namespaces:
+            data=data.replace(i+".","")
+
+    with open(f"../files/schema/{schema_file}",'w') as file:
+        file.write(data)
+
+
+dependency_matrix={}
+
+for schema_file in schema_files:
+
+    dependencies=set()
+    updated_data=[]
+    name=schema_file.split(".")[0]
+    visited=set()
+    with open(f"../files/schema/{name}.asn1",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        
+        lines=data.splitlines()
+        for line in lines:
+            updated_data.append(line)
+        
+        for line in lines:
+            if "--" in line:
+                line=line.split("--")[0]
+
+            words=line.split()
+            # print(words)
+            for word in words:
+                
+                word=clean_string(word)
+
+                if word in schema_names and word!=name:
+                    dependencies.add(word)
+                
+
+    dependency_matrix[name]=list(dependencies)
+
+
+deps={k: v for k, v in sorted(dependency_matrix.items(), key=lambda item: item[0])}
+with open("deps.json",'w') as file:
+    json.dump(deps,file,indent=4)
+
+
+def get_deps(key,visited):
+    if key in deps:
+        for i in deps[key]:
+            if i not in visited:
+                visited.add(i)
+                get_deps(i,visited)
+    
+
+combined_deps={}
+
+for dep in deps:
+    queue = deque()
+    visited=set()
+    if len(deps[dep])==0:
+        combined_deps[dep]=deps[dep]
+
+    else:
+        for i in deps[dep]:
+            visited.add(i)
+            queue.append(i)
+            get_deps(i,visited)
+        combined_deps[dep]=list(visited)
+
+        
+         
+
path: POC/py/parser.py
user: login: saina-ramyar
body: add comments to this section
created_at: 2025-03-21T20:48:38Z
author_association: NONE
diff_hunk: @@ -0,0 +1,306 @@
+import sys
+import re
+import os
+import json
+import asn1tools
+import shutil
+from collections import deque
+
+#accept multiple files
+#check and validate for well formness of asn1 file by compiling input using asn1 tools
+
+# take a file name as arg
+file_path=sys.argv[1]
+
+if file_path.endswith('.asn1'):
+    with open(file_path, 'r') as file:
+        data = file.read()
+        # print(data)
+else:
+    print("Invalid file type")
+    sys.exit(1)
+
+
+
+
+
+# parse the file line by line to find ::= pattern
+# if found, extract the schema name and type
+
+lines=data.splitlines()
+# print(lines)
+
+count=0
+lines_count=len(lines)
+namesspaces=[]
+
+dirs=["../files/schema","../files/schema_updated"]
+
+for dir in dirs:
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    files=os.listdir(dir)
+    for file in files:
+        os.remove(f"{dir}/{file}")
+
+
+"""
+Namespace parser
+"""
+isNamespace=False
+start=0
+end=0
+namespaces={}
+while count<lines_count:
+    line=lines[count]
+    if "::= BEGIN" in line:
+        namespace=line.split()[0].strip()
+        # print("Namespace:",namespace) 
+        isNamespace=True
+        start=count
+    if "END" in line:
+        isNamespace=False
+        end=count
+        end+=1
+        namespaces[namespace]={
+            "start":start,
+            "end":end
+        }
+    
+    count+=1
+
+"""
+    Write each namespace data to a file
+"""
+# print(namesspaces)
+for i in namespaces:
+    with open(f"../files/namespace/{i}.asn1",'w') as file:
+        for j in range(namespaces[i]["start"],namespaces[i]["end"]):
+            file.write(lines[j]+'\n')
+
+
+namespace_files=os.listdir("../files/namespace")
+
+
+"""
+Parse Each file and load into Memory
+"""
+# possible_types=["ENUMERATED","INTEGER","CHOICE","IA5String","CLASS","BIT","SEQUENCE","BOOLEAN","OCTET"]
+# schema_types=set()
+
+def find_between_parentheses(s):
+    return re.findall(r'\((.*?)\)', s)
+
+mapper={}
+constant_mapper={}
+constants_data={}
+
+for file in namespace_files:
+    with open(f"../files/namespace/{file}",'r') as file:
+        data=file.read()
+        # print(data)
+        # print("\n")
+
+
+    lines=data.splitlines()
+    lines=lines[1:-2]
+    lines_count=len(lines)
+    count=0
+    components={}
+    component_name=""
+    start=0
+    is_component=False
+    # print(lines)
+
+    while count<lines_count:
+        line=lines[count]
+        if "--" in line:
+            line=line.split("--")[0]
+
+        if "::=" in line:
+            if component_name!="":
+                components[component_name]={
+                    "start":start+1,
+                    "end":count
+                }
+            component_name=line.split()[0]
+            start=count
+        count+=1
+
+    
+    if component_name!="":
+        components[component_name]={
+            "start":start,
+            "end":count
+        }
+
+    for i in components:
+        if i[0].islower():
+            continue
+        with open(f"../files/schema/{i}.asn1",'w') as file:
+            for j in range(components[i]["start"]-1,components[i]["end"]):
+                file.write(lines[j]+'\n')
+
+# with open("components.json",'w') as file:
+#     json.dump(components,file,indent=4)
+
+schema_files=os.listdir("../files/schema")
+schema_names=[i.split(".")[0] for i in schema_files]
+
+available_namespaces=[i for i in namespaces]
+constant_names=[i for i in constant_mapper]
+
+def clean_string(s):
+    return re.sub(r'[^a-zA-Z0-9-]', '', s)  # Allow '-' in the string
+
+
+
+"""
+    Modify the words by removing namespace
+"""
+print(available_namespaces)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+        for i in available_namespaces:
+            data=data.replace(i+".","")
+
+    with open(f"../files/schema/{schema_file}",'w') as file:
+        file.write(data)
+
+
+dependency_matrix={}
+
+for schema_file in schema_files:
+
+    dependencies=set()
+    updated_data=[]
+    name=schema_file.split(".")[0]
+    visited=set()
+    with open(f"../files/schema/{name}.asn1",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        
+        lines=data.splitlines()
+        for line in lines:
+            updated_data.append(line)
+        
+        for line in lines:
+            if "--" in line:
+                line=line.split("--")[0]
+
+            words=line.split()
+            # print(words)
+            for word in words:
+                
+                word=clean_string(word)
+
+                if word in schema_names and word!=name:
+                    dependencies.add(word)
+                
+
+    dependency_matrix[name]=list(dependencies)
+
+
+deps={k: v for k, v in sorted(dependency_matrix.items(), key=lambda item: item[0])}
+with open("deps.json",'w') as file:
+    json.dump(deps,file,indent=4)
+
+
+def get_deps(key,visited):
+    if key in deps:
+        for i in deps[key]:
+            if i not in visited:
+                visited.add(i)
+                get_deps(i,visited)
+    
+
+combined_deps={}
+
+for dep in deps:
+    queue = deque()
+    visited=set()
+    if len(deps[dep])==0:
+        combined_deps[dep]=deps[dep]
+
+    else:
+        for i in deps[dep]:
+            visited.add(i)
+            queue.append(i)
+            get_deps(i,visited)
+        combined_deps[dep]=list(visited)
+
+        
+         
+
+with open("combined_deps.json",'w') as file:
+    json.dump(combined_deps,file,indent=4)
+
+for schema_file in schema_files:
+    with open(f"../files/schema/{schema_file}",'r') as file:
+        data=file.read()
+        print("Schema File:",schema_file)
+        name=schema_file.split(".")[0]
+       
+        ds=combined_deps[name]
+
+        for d in ds:
+            with open(f"../files/schema/{d}.asn1",'r') as file:
+                data+=file.read()
+
+    with open(f"../files/schema_updated/{schema_file}",'w') as file:
+        file.write(data)
+    
+
path: POC/py/parser.py
user: login: saina-ramyar
body: add comments to this section
created_at: 2025-03-21T20:48:52Z
author_association: NONE
diff_hunk: @@ -0,0 +1,39 @@
+# POC for asn1 - splitter
+
path: POC/README.md
user: login: saina-ramyar
body: please add an introduction section here, describing that this is a POC for splitting asn1 spec files, how it is developed and that it will be different from the main product
created_at: 2025-03-24T16:43:11Z
author_association: NONE

PR comments:
user: login: saina-ramyar
created_at: 2025-03-19T20:24:51Z
body: please fill up the Pull Request Form wherever applicable
author_association: NONE
user: login: saina-ramyar
created_at: 2025-03-19T20:25:01Z
body: please remove all the empty files
author_association: NONE
user: login: saina-ramyar
created_at: 2025-03-19T20:35:35Z
body: please remove the messages folder, after discussion with the team we think it must not be available publicly, and it is easily generated. Please follow the following steps to ensure it is removed from Git history:
first delete the files, do "git commit --amend ..." to update that commit on their local, then force push it, that should overwrite it entirely on github
author_association: NONE
user: login: saina-ramyar
created_at: 2025-03-19T20:36:07Z
body: please add brief instructions on how to use the splitter in Readme.md, or create another .md file
author_association: NONE