Skip to content

ابدأ الآن ​

التثبيت ​

bash
pnpm add belgica
bash
npm install belgica
bash
yarn add belgica

الحزمة بصيغة ESM، وتأتي مع تعريفات الأنواع الخاصة بها، وليس لها أي تبعيات وقت التشغيل، وتعمل في المتصفحات وعلى Node 22.12 أو أحدث، حيث يحمّلها require() أيضًا. وهي مختبرة على Node 22.12 و22 و24 و26.

استورد ما تحتاج إليه فقط ​

البيانات مضمّنة في JavaScript، لذا فإن الاستيراد من جذر الحزمة يحمّل كل مجموعات البيانات. لكل مجموعة بيانات entry point خاص بها، والمحاكم والكانتونات (مع النص القانوني لأقاليمها) هي الأكبر حجمًا بفارق كبير:

ts
import { getInterestRate } from 'belgica/interest-rates'
import { getCourt } from 'belgica/courts'
import { getCanton } from 'belgica/territory'
import { getMunicipalitiesForPostalCode } from 'belgica/postal-codes'

حدود الكانتونات هي الاستثناء: مليون موضع من البيانات الهندسية، موجودة فقط في belgica/canton-boundaries، ولا يحمّلها جذر الحزمة أبدًا.

Entry pointJavaScript المحمَّلgzip
belgica1031 KB110 KB
belgica/territory251 KB33 KB
belgica/canton-boundaries254 KB34 KB
belgica/arrondissement-boundaries254 KB34 KB
belgica/courts587 KB55 KB
belgica/court-locations80 KB10 KB
belgica/courts/format1 KB1 KB
belgica/courts/load16 KB2 KB
belgica/cantons67 KB8 KB
belgica/cantons/territory78 KB17 KB
belgica/prisons62 KB7 KB
belgica/houses-of-justice27 KB4 KB
belgica/interest-rates13 KB3 KB
belgica/calendar8 KB3 KB
belgica/postal-codes169 KB19 KB

نظرة أولى ​

ts
import {
    getCourt,
    findCourts,
    getCanton,
    getCantonsForMunicipality,
    getInterestRate,
} from 'belgica'

getCourt('justice-of-the-peace-gent-1').name.nl // 'Vredegerecht Gent 1'
findCourts({ type: 'enterprise-court', arrondissement: 'west-vlaanderen' })

getCantonsForMunicipality('44088') // [Canton merelbeke-melle]
getCantonsForMunicipality('44021') // Gent 1–5: مدينة مقسّمة، انظر `territory` لكل كانتون
getCanton('oudergem').seat.nl // 'Etterbeek'

getInterestRate('2024-06-15', 'legal') // { rate: 5.75, period: { from: '2024-01-01', to: '2024-12-31' } }
getInterestRate(new Date(2014, 5, 15), 'commercial', { contractAfter20130316: true }) // { rate: 8.5, … }

مهام شائعة ​

أي vredegerecht / justice de paix يختص بعنوان ما؟ ​

ابحث عن رمز REFNIS للبلدية واحصل على كانتوناتها، ثم على محكمة الكانتون، أي الـvredegerecht / justice de paix (محكمة الصلح).

ts
import { getCantonsForMunicipality, getJusticeOfThePeace } from 'belgica'

const cantons = getCantonsForMunicipality('44088')
if (cantons.length === 1) {
    const court = getJusticeOfThePeace(cantons[0].id) // لكل كانتون محكمته
}

// في يوم تبليغ الاستدعاء، لا في يوم اليوم
getCantonsForMunicipality('44088', { on: '2025-09-15' })

حين تكون المدينة مقسّمة على عدة كانتونات (Antwerpen وGent وBrussel وLuik، …) تحصل على أكثر من نتيجة. عنوان الشارع هو الفيصل، وterritory لكل كانتون يتضمن الوصف القانوني لجزئه. جرّبه في صفحة الإقليم والكانتونات.

وإذا توفرت إحداثيات العنوان، تحسم حدود الكانتونات المسألة:

ts
import { findCantonsAt } from 'belgica/canton-boundaries'

const [canton] = findCantonsAt(3.7268, 51.053) // خط الطول، خط العرض: gent-1
const court = getJusticeOfThePeace(canton.id)

أي محكمة تختص ببلدية ما؟ ​

كل محكمة غير الـvredegerecht / justice de paix تذكر الكانتونات التي تغطيها (cantons)، كما يحددها القانون. وتبحث findCourtsWithJurisdiction عن كانتونات البلدية فيها.

ts
import { findCourtsWithJurisdiction, getDivisions } from 'belgica'

findCourtsWithJurisdiction('23088', 'police-court') // [police-court-vilvoorde]، لا Brussel
findCourtsWithJurisdiction('21004', 'labour-court') // المحكمة الناطقة بالهولندية والمحكمة الناطقة بالفرنسية في Brussel

// المحكمة ككل؛ أما القسم الذي ينظر في القضية فليس في البيانات بعد
const [court] = findCourtsWithJurisdiction('44021', 'enterprise-court')
getDivisions(court.id) // enterprise-court-gent-gent, enterprise-court-gent-brugge, …

انطلاقًا من رمز بريدي ​

يأتي العنوان مع رمز بريدي، لا مع رمز REFNIS. تنتقل findCourtsForPostalCode من الرمز البريدي إلى البلدية (الرموز البريدية) ومن هناك إلى محاكم الـvredegerecht / justice de paix وإلى محاكم نوع معيّن. وهي تجيب لكل بلدية على حدة: ثلاثة رموز بريدية (1040 و1050 و1804) تنتمي إلى بلديتين، وعندها يكون الشارع هو الفيصل.

ts
import { findCourtsForPostalCode, getMunicipalitiesForPostalCode } from 'belgica'

const [gent] = findCourtsForPostalCode('9050', 'labour-court')
gent.municipality.name.nl // 'Gent'
gent.courts.map((c) => c.id) // ['labour-court-gent']
gent.justicesOfThePeace.map((c) => c.canton.id) // ['gent-1', …, 'gent-5']: الشارع هو الفيصل

findCourtsForPostalCode('1040', 'police-court').map((r) => r.municipality.name.nl) // ['Brussel', 'Etterbeek']
getMunicipalitiesForPostalCode('9050').map((m) => m.id) // ['44021']

في مدينة مقسّمة على كانتونات، يضيّق الرمز البريدي السؤال إلى البلدية؛ لكن الكانتون لا يزال يحتاج إلى الشارع، وحدوده نص قانوني نثري إلى أن تضيفها #29 بوصفها بيانات هندسية.

الفائدة المستحقة في يوم معيّن ​

ts
import { getInterestRate, getLatestKnownRateDate } from 'belgica'

const result = getInterestRate(new Date(), 'commercial')
if (!result) {
    console.warn(`No rate on file; latest known day is ${getLatestKnownRateDate('commercial')}`)
}

تُرجع getInterestRate القيمة null ليوم لا يوجد له سعر مسجَّل، حتى تتمكن من إصدار تحذير بدلًا من استخدام 0 % بصمت. وترمي RangeError ليوم مكتوب بصيغة خاطئة مثل '2024-6-1': مرّر YYYY-MM-DD أو Date.

أسماء المحاكم بلغة أخرى ​

الأسماء كما تنشرها كل محكمة، بكل لغة لها فيها صفحة. المحكمة في Vlaanderen (فلاندرز) تنشر بالهولندية فقط؛ والمحاكم الثنائية اللغة في Brussel بالهولندية والفرنسية؛ والمحاكم في Eupen بالألمانية والفرنسية.

ts
getCourt('court-of-appeal-brussel').name.fr // "Cour d'appel de Bruxelles"
getCourt('police-court-eupen-sankt-vith').name.de // 'Polizeigericht Eupen, Abteilung Sankt Vith'

JSON الخام ​

ملفات البيانات مُصدَّرة أيضًا:

ts
import courts from 'belgica/data/courts.json' with { type: 'json' }

المعرّفات جزء من الواجهة العامة ​

تخزّن المشاريع معرّفات مثل justice-of-the-peace-gent-1 أو oost-vlaanderen، لذا لا تتغير أبدًا ضمن إصدار major واحد (انظر المعرّفات)، وتتبع الإصدارات هذه القواعد:

التغييرالإصدار
إضافة بياناتminor
تصحيح قيمةpatch
حذف معرّف أو إعادة تسميتهmajor

الكود مرخّص بـMIT، والبيانات بـCC BY 4.0. بيانات مرجعية، لا استشارة قانونية: راجع المصادر الرسمية.