Skip to main content

A tool for navigating and processing the Abitudini della Vita Quotiiana ISTAT microdata

Project description

ISTAT Microdata Extractor – Aspetti della Vita Quotidiana (AVQ)

This project provides tools for navigating and processing the ISTAT microdata. It includes the Python class ISTATMicrodataExtractor with structured methods to explore, query, and analyze the microdata efficiently.

Available microdata:

  • AVQ: Indagine sugli Aspetti della Vita Quotidiana (AVQ) delle famiglie italiane
  • HBS: Indagine sulle spese delle famiglie italiane

📦 Project Structure

The central component is the ISTATMicrodataExtractor class, which offers:

  • 🚀 Simplified access to the dataset structure
  • 🧠 Attribute encoding utilities
  • 🔎 Filtering and pairing logic for household members
  • 📊 Joint and conditional distribution tools
  • 📁 Integration-ready design for larger analytical pipelines

📚 Dataset Overview

Aspetti della Vita Quotidiana (AVQ) is an annual survey by ISTAT capturing detailed aspects of daily life in Italian households. It includes information on:

  • Demographics
  • Education and employment
  • Health and access to services
  • Household composition and living conditions
  • Digital device usage and internet access
  • Family dynamics and caregiving
  • Purchase habits

🧩 Key Features of ISTATMicrodataExtractor

Method/Attribute Description
load_data() Loads and prepares the AVQ microdata from raw files
attribute_categories Attribute that contains all the categories for the attributes
get_attribute_metadata() Retrieves metadata/encodings for categorical variables
get_attributes_by_categories() Filters attributes by categories
filter() Applies logical filters on individual-level records
pair_family_members() Pairs individuals within the same household according to flexible rules
joint_distribution() Computes joint/marginal distributions for selected variables

Installing & Setup

git clone git@github.com:Clearbox-AI/ISTAT-microdata-extractor.git

pip install -r path/to/ISTAT-microdata-extractor/requirements.txt

pip install -e path/to/ISTAT-microdata-extractor

Updating version

To update your local version go to your local folder and run:

git pull origin main

pip install -e ISTAT-microdata-extractor

To setup the data, unzip the data folder you need here and provide the path to the unzipped folder to the load_data() method of your ISTATMicrodataExtractor class.

Unlike raw data, this data was processed to allow some methods of the class BIMicrodataExtractor to work smoothly.

📊 Examples

from microdata_extractor import ISTATMicrodataExtractor

# Supposing your AVQ Microdata ISTAT is stored in "AVQ_2023_IT"
mde = ISTATMicrodataExtractor(df_name="AVQ",year=2023)
mde.load_data("AVQ_2023_IT")

# Consult the available attribute categories 
mde.attribute_categories

# Filter attributes by relevant categories
_ = mde.get_attributes_by_categories("demographics","sport", "health_conditions", condition="or")

# Check encodings for categorical variables
encoding = mde.get_attribute_metadata("FREQSPO", print_output=True)

# Filter main dataset based on user-defined rules
# Tuples within the same inner list are AND-ed, tuples belonging to different inner lists are OR-ed
# The following rules express: (age>=18 AND BMI<=3)  OR  (age<18 AND BMIMIN==1)
rules = [
    [("ETAMi",">=",7),("BMI","<=",3)],  # Adults (age>=18) AND BMI==[1,2,3]
                                        # OR
    [("ETAMi","<",7),("BMIMIN","==",1)] # minors (age<18) AND BMIMIN==1
]

df_filtered = mde.filter(rules)

Check out the Examples folder for more!

Contacts

📧 info@clearbox.ai

🌐 www.clearbox.ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microdata-extractor-0.0.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microdata_extractor-0.0.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file microdata-extractor-0.0.1.tar.gz.

File metadata

  • Download URL: microdata-extractor-0.0.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for microdata-extractor-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bd3268f84e9855fabcba84252d0a257f416b0f784cc9821b0ecd920866a9b6e2
MD5 1159a0e7846602104ce6a2f8e3e0d164
BLAKE2b-256 0169ab152c4b85f75eef41398372de1f4fc92f738e3d21844a50fb80ec1b3688

See more details on using hashes here.

File details

Details for the file microdata_extractor-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for microdata_extractor-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 046bbf02e06bdf4be8fce6e26b46300e03737a471b222d815646b3b084c9659c
MD5 97357742c02691ec5ebf2aaff4acfa54
BLAKE2b-256 81c7e4f3ad2ad49ee2aa0c4c80f6da0b66c017fd6b970e41532c7f8d43927f0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page