This repository contains a Python script designed to process JSON files for specific data extraction and transformation tasks. It groups data related to medical diagnosis classifications and outputs the result in a structured JSON format.
- Reads and processes JSON data from the current directory.
- Extracts information based on specified keys such as
tumor_classification
andDiagnose ICD-10
. - Groups data into main categories and subcategories.
- Generates an organized JSON output file named
output.json
.
- Python 3.x
- Place a JSON file in the script's directory.
- Run the script:
python script_name.py
- The processed data will be saved in a file named
output.json
in the same directory.
The output JSON file contains:
- Main categories with keys and descriptions.
- Subcategories nested under each main category.
Example structure:
{
"subgroup": [
{
"key": "main_key.%",
"name": "main_key.%",
"description": "description",
"subgroup": [
{ "key": "sub_key", "name": "sub_name", "description": "sub_description" },
{ "visibility": "false", "key": "main_key", "name": "main_key", "description": "" }
]
}
]
}
- If no JSON file is found in the directory, the script will raise an error.
- If relevant data is not found, a message will be printed indicating the absence of
Diagnose ICD-10
data.
- Ensure that the input JSON file contains a structure compatible with the script’s requirements.
- Modify the script as needed to fit different data formats or extraction needs.