スキル一覧に戻る
Klimabevaegelsen

gcs-okonomi-data

by Klimabevaegelsen

Et projekt for at formidle data om dansk landbrug

26🍴 15📅 2026年1月19日
GitHubで見るManusで実行

SKILL.md


name: gcs-okonomi-data description: | Activates when querying financial/economic data from GCS. Use this skill for: subsidies, farm financials, property values, CVR enrichment, ownership data, støtte per hektar, samlet støtte, grundværdi. Keywords: økonomi, finance, subsidies, støtte, tilskud, CVR, property, ejendom, grundværdi

GCS Økonomi (Finance) Data Catalog

Financial and economic data for Danish agricultural businesses.

Frontend Metrics Supported

Metric KeyDanish NameDescription
subsidy_per_haStøtte per hektarSubsidy amount per hectare
total_subsidiesSamlet støtteTotal subsidy amount
land_valueGrundværdiProperty/land value

Available Datasets

Silver Layer

Subsidies (554K rows)

Path: gs://$GCS_BUCKET/silver/subsidies/*/data.parquet

ColumnTypeDescriptionExample
cvr_numberstringCompany CVR (8 digits)31373077
markbloknummerstringField block number610341-27
marknummerstringField number1-0
afg_kode_navnstringCrop code and name1 - Vårbyg
imkarealfloatDeclared area (ha)12.45
ansoegtha_grundbetfloatApplied area basic12.45
tilskudsberetha_grundbetfloatEligible area basic12.45
grundbetaling_dkkfloatBasic payment DKK2500.00
oeko_tilskud_dkkfloatOrganic subsidy DKK1500.00
pleje_af_graes_dkkfloatGrassland care DKK500.00

Schema (introspected):

cvr_number: string
markbloknummer: string
marknummer: string
afg_kode_navn: string
imkareal: double
ansoegtha_grundbet: double
tilskudsberetha_grundbet: double
[28 columns total - multiple subsidy types]

Property Owners (8.2M rows)

Path: gs://$GCS_BUCKET/silver/property_owners/*/data.parquet

ColumnTypeDescription
bestemtFastEjendomBFENrint64BFE number (cadastral ID)
ejendePersonstructPerson owner info (nested)
ejendeVirksomhedstructCompany owner info (nested)
ejendeVirksomhed.CVRNummerstringOwner's CVR number

Nested Structure:

bestemtFastEjendomBFENr: int64
ejendePerson:
  - Beskyttelser: list
  - Navn: struct
  - Standardadresse: struct
ejendeVirksomhed:
  - CVRNummer: string
  - beliggenhedsadresse: struct

Gold Layer

CVR Enrichment

Path: gs://$GCS_BUCKET/gold/cvr_enrichment/*/

Contains multiple enrichment files:

  • address_geocoding.parquet - Geocoded company addresses
  • company_summary.parquet - Aggregated company data
ColumnTypeDescription
cvr_numberstringCompany CVR
latitudefloatCompany location lat
longitudefloatCompany location lon
total_area_hafloatTotal farmed area
employee_countintNumber of employees

Common Queries

Get Total Subsidies by CVR

import pyarrow.parquet as pq
from google.cloud import storage
import io

client = storage.Client()
bucket = client.bucket('$GCS_BUCKET')

# Read subsidies
blob = bucket.blob('silver/subsidies/2025-01-10T00:00:26.377177/data.parquet')
buffer = io.BytesIO()
blob.download_to_file(buffer)
buffer.seek(0)
df = pq.read_table(buffer).to_pandas()

# Calculate total subsidies per CVR
totals = df.groupby('cvr_number').agg({
    'grundbetaling_dkk': 'sum',
    'oeko_tilskud_dkk': 'sum',
    'imkareal': 'sum'
}).reset_index()

# Add subsidy per hectare
totals['subsidy_per_ha'] = (
    totals['grundbetaling_dkk'] + totals['oeko_tilskud_dkk']
) / totals['imkareal']

Find Property Owner by CVR

# Read property owners
blob = bucket.blob('silver/property_owners/2025-01-10/data.parquet')
buffer = io.BytesIO()
blob.download_to_file(buffer)
buffer.seek(0)
df = pq.read_table(buffer).to_pandas()

# Filter by CVR (need to handle nested structure)
import pandas as pd

# Extract CVR from nested structure
df['owner_cvr'] = df['ejendeVirksomhed'].apply(
    lambda x: x.get('CVRNummer') if x else None
)
company_properties = df[df['owner_cvr'] == '31373077']

Subsidies for Specific Field Block

# Get all subsidies for a markblok
field_block_subsidies = df[df['markbloknummer'] == '610341-27']
print(f"Total area: {field_block_subsidies['imkareal'].sum():.2f} ha")
print(f"Total basic payment: {field_block_subsidies['grundbetaling_dkk'].sum():.2f} DKK")

Calculate Municipal Subsidy Statistics

# Join with municipality data for geographic aggregation
# Requires joining with field data that has municipality info
from gcs_data_catalog.landbrugsareal import read_field_data

fields = read_field_data(year=2024)
subsidies_with_geo = df.merge(
    fields[['markbloknummer', 'municipality']],
    on='markbloknummer',
    how='left'
)

municipal_stats = subsidies_with_geo.groupby('municipality').agg({
    'grundbetaling_dkk': 'sum',
    'imkareal': 'sum'
}).reset_index()

Join Keys

This DatasetJoin ColumnTarget DatasetTarget Column
subsidiescvr_numberfield_productioncvr_number
subsidiesmarkbloknummerfvm_markerblock_id
property_ownersbestemtFastEjendomBFENrcadastralbfe_number
property_ownersejendeVirksomhed.CVRNummersubsidiescvr_number

Data Quality Notes

Subsidies

  • Update frequency: Annual (after payment year closes)
  • Coverage: All EU agricultural subsidy recipients in Denmark
  • Caveat: Some CVR numbers may be inactive/closed companies

Property Owners

  • Update frequency: Weekly
  • Coverage: All registered property owners in Denmark
  • Caveat: Nested JSON structure requires careful handling
  • Privacy: Personal owner data (ejendePerson) may have restrictions
  • landbrugsareal/ - Field boundaries for geographic context
  • miljo/ - Environmental compliance affecting subsidies
  • husdyr/ - Livestock data for animal-based subsidies
  • medarbejdere/ - Employee data for labor cost analysis

GCS Paths Reference

# List available subsidy snapshots
gsutil ls gs://$GCS_BUCKET/silver/subsidies/

# List CVR enrichment data
gsutil ls gs://$GCS_BUCKET/gold/cvr_enrichment/

# List property owner snapshots
gsutil ls gs://$GCS_BUCKET/silver/property_owners/

スコア

総合スコア

45/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です