@geoalgeria/poste 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -62
- package/package.json +9 -3
- package/types/index.d.ts +93 -0
package/README.md
CHANGED
|
@@ -1,47 +1,81 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# @geoalgeria/poste
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
**Every Algérie Poste office and ATM — as data you can install.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@geoalgeria/poste)
|
|
8
|
+
[](https://www.npmjs.com/package/@geoalgeria/poste)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
3,908 post offices and 2,026 ATMs across Algeria — with **real postal codes**, bilingual (French / Arabic) names, GPS coordinates, and commune/wilaya linkage. Sourced from Algérie Poste, shipped as JSON, CSV, and GeoJSON. Part of [GeoAlgeria](https://github.com/yasserstudio/geoalgeria).
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @geoalgeria/poste
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import poste from "@geoalgeria/poste";
|
|
21
|
+
|
|
22
|
+
const offices = poste.postOffices(); // 3,908
|
|
23
|
+
const atms = poste.atms(); // 2,026
|
|
24
|
+
|
|
25
|
+
// Post offices in a commune (joins GeoAlgeria's code_commune)
|
|
26
|
+
const inAdrar = offices.filter((o) => o.commune_code === "0101");
|
|
27
|
+
|
|
28
|
+
// Nearest ATM? Everything has lat/lng to compute against.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What you can build
|
|
32
|
+
|
|
33
|
+
- **Postal-code validation & lookup** — every office carries its real `postal_code`.
|
|
34
|
+
- **Branch / ATM locators** — coordinates on (almost) every record, ready for distance sorting or a map.
|
|
35
|
+
- **Fintech & logistics** — match addresses to the nearest post office or GAB.
|
|
36
|
+
- **Maps** — drop-in GeoJSON point layers for the whole postal network.
|
|
37
|
+
|
|
38
|
+
## What's inside
|
|
5
39
|
|
|
6
40
|
| Dataset | Count | Notes |
|
|
7
41
|
| --- | --- | --- |
|
|
8
|
-
| Post offices | **3,908** | each with its own postal code (`
|
|
42
|
+
| Post offices | **3,908** | each with its own postal code (`postal_code`) |
|
|
9
43
|
| ATMs | **2,026** | Algérie Poste GAB network |
|
|
10
|
-
| Distinct postal codes | **3,908** | one per office |
|
|
11
44
|
|
|
12
|
-
##
|
|
45
|
+
## Formats
|
|
13
46
|
|
|
14
|
-
|
|
15
|
-
(<https://baridimap.poste.dz>):
|
|
47
|
+
The npm package ships the **JSON** (importable directly):
|
|
16
48
|
|
|
17
|
-
|
|
18
|
-
|
|
49
|
+
```js
|
|
50
|
+
import offices from "@geoalgeria/poste/data/postoffices.json" with { type: "json" };
|
|
51
|
+
// or via CDN, no install:
|
|
52
|
+
// https://cdn.jsdelivr.net/npm/@geoalgeria/poste/data/postoffices.json
|
|
53
|
+
```
|
|
19
54
|
|
|
20
|
-
|
|
21
|
-
from the live API. The same run also mirrors the data into the sibling
|
|
22
|
-
`geoalgeria` package at `packages/dataset/data/poste/`, so the two never drift —
|
|
23
|
-
this package is the canonical source. Re-fetch periodically — Algérie Poste
|
|
24
|
-
updates offices and, eventually, the post-2025 wilaya reorganization (BaridiMap
|
|
25
|
-
currently still files offices under the 58-wilaya scheme, so new wilayas 59–69
|
|
26
|
-
appear under their mother wilaya).
|
|
55
|
+
The loaders and record shapes are fully **typed** — TypeScript definitions ship in the package:
|
|
27
56
|
|
|
28
|
-
|
|
57
|
+
```ts
|
|
58
|
+
import poste, { type PostOffice, type Atm } from "@geoalgeria/poste";
|
|
59
|
+
const offices: PostOffice[] = poste.postOffices();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**CSV and GeoJSON** are in the repo under [`data/`](data) and bundled in every
|
|
63
|
+
[GitHub Release](https://github.com/yasserstudio/geoalgeria/releases):
|
|
29
64
|
|
|
30
65
|
```
|
|
31
66
|
data/
|
|
32
|
-
postoffices.json
|
|
33
|
-
atms.json
|
|
34
|
-
metadata.json
|
|
35
|
-
csv/postoffices.csv
|
|
67
|
+
postoffices.json # 3,908 offices (array)
|
|
68
|
+
atms.json # 2,026 ATMs (array)
|
|
69
|
+
metadata.json # source, counts, generated_at
|
|
70
|
+
csv/postoffices.csv # repo + Release bundle (not in npm tarball)
|
|
36
71
|
csv/atms.csv
|
|
37
|
-
geojson/postoffices.geojson
|
|
72
|
+
geojson/postoffices.geojson # Point features (records with coordinates)
|
|
38
73
|
geojson/atms.geojson
|
|
39
74
|
```
|
|
40
75
|
|
|
41
|
-
> GeoJSON
|
|
42
|
-
>
|
|
43
|
-
>
|
|
44
|
-
> (the source API does not provide one).
|
|
76
|
+
> GeoJSON includes only records that have coordinates — a handful of offices and
|
|
77
|
+
> ATMs report no `lat`/`lng` and are omitted there (but remain in JSON/CSV). ATM
|
|
78
|
+
> records have no `commune_code` (the source API doesn't provide one).
|
|
45
79
|
|
|
46
80
|
## Record shapes
|
|
47
81
|
|
|
@@ -54,7 +88,6 @@ data/
|
|
|
54
88
|
"name_ar": "أدرار م ر",
|
|
55
89
|
"class": "CE",
|
|
56
90
|
"postal_code": "01000",
|
|
57
|
-
"postal_code_old": null,
|
|
58
91
|
"address": "ADRAR CENTRE RUE DES MARYTIM",
|
|
59
92
|
"commune_code": "0101",
|
|
60
93
|
"commune_fr": "ADRAR",
|
|
@@ -67,46 +100,29 @@ data/
|
|
|
67
100
|
}
|
|
68
101
|
```
|
|
69
102
|
|
|
70
|
-
`class` is the office category (`CE`, `R1`–`R4`, `HC`, `GA`). `commune_code`
|
|
71
|
-
|
|
72
|
-
`code_commune` field.
|
|
103
|
+
`class` is the office category (`CE`, `R1`–`R4`, `HC`, `GA`). `commune_code` is
|
|
104
|
+
Algérie Poste's 4-digit commune code, which joins to GeoAlgeria's `code_commune`.
|
|
73
105
|
|
|
74
|
-
**ATM**
|
|
106
|
+
**ATM** — same shape, keyed by `id`/`name`/`postal_code`/`wilaya_*` with `lat`/`lng`; no `commune_code`.
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
"id": "1165",
|
|
79
|
-
"name": "AOULEF",
|
|
80
|
-
"status": "1",
|
|
81
|
-
"postal_code": "01003",
|
|
82
|
-
"postal_code_old": null,
|
|
83
|
-
"address": null,
|
|
84
|
-
"commune_fr": "AOULEF",
|
|
85
|
-
"commune_ar": "أولف",
|
|
86
|
-
"wilaya_code": "01",
|
|
87
|
-
"wilaya_fr": "ADRAR",
|
|
88
|
-
"wilaya_ar": "أدرار",
|
|
89
|
-
"lat": 26.9728317,
|
|
90
|
-
"lng": 1.07709
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Usage
|
|
95
|
-
|
|
96
|
-
```js
|
|
97
|
-
import poste from "@geoalgeria/poste";
|
|
108
|
+
## Need the administrative divisions too?
|
|
98
109
|
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
If you also need wilayas, dairas, and communes, use the main
|
|
111
|
+
**[`geoalgeria`](https://www.npmjs.com/package/geoalgeria)** package — it mirrors
|
|
112
|
+
this postal data in and exposes `postOffices` / `atms` alongside the full
|
|
113
|
+
division dataset. Use `@geoalgeria/poste` when you *only* need postal/banking data.
|
|
101
114
|
|
|
102
|
-
|
|
103
|
-
const inCommune = offices.filter((o) => o.commune_code === "1731");
|
|
104
|
-
```
|
|
115
|
+
## Source
|
|
105
116
|
|
|
106
|
-
|
|
117
|
+
Data comes from **Algérie Poste** via the public BaridiMap API
|
|
118
|
+
(<https://baridimap.poste.dz>). Run `npm run fetch` to regenerate every output
|
|
119
|
+
from the live API; the same run mirrors the data into the `geoalgeria` package so
|
|
120
|
+
the two never drift (this package is the canonical source). Re-fetch periodically
|
|
121
|
+
— BaridiMap still files offices under the 58-wilaya scheme, so new wilayas 59–69
|
|
122
|
+
currently appear under their mother wilaya.
|
|
107
123
|
|
|
108
124
|
## License & attribution
|
|
109
125
|
|
|
110
|
-
Code is MIT. The underlying data is © **Algérie Poste
|
|
111
|
-
|
|
112
|
-
|
|
126
|
+
Code is [MIT](LICENSE). The underlying data is © **Algérie Poste**, redistributed
|
|
127
|
+
for reference and to power [GeoAlgeria](https://geoalgeria.com). Verify against
|
|
128
|
+
Algérie Poste for authoritative, real-time information.
|
package/package.json
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoalgeria/poste",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Algeria post offices (3908) and ATMs (2026) — real postal codes, bilingual names, coordinates, commune/wilaya linkage. Sourced from Algérie Poste (baridimap.poste.dz). JSON, CSV, GeoJSON.",
|
|
6
6
|
"main": "index.js",
|
|
7
|
+
"types": "types/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./types/index.d.ts",
|
|
11
|
+
"default": "./index.js"
|
|
12
|
+
},
|
|
9
13
|
"./data/*": "./data/*"
|
|
10
14
|
},
|
|
11
15
|
"files": [
|
|
12
16
|
"data/**/*.json",
|
|
17
|
+
"types/",
|
|
13
18
|
"index.js"
|
|
14
19
|
],
|
|
15
20
|
"scripts": {
|
|
16
|
-
"fetch": "node scripts/fetch.mjs"
|
|
21
|
+
"fetch": "node scripts/fetch.mjs",
|
|
22
|
+
"test": "node ../../scripts/validate-packages.mjs poste"
|
|
17
23
|
},
|
|
18
24
|
"keywords": [
|
|
19
25
|
"algeria",
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Type definitions for @geoalgeria/poste
|
|
2
|
+
// Data sourced from Algérie Poste (baridimap.poste.dz).
|
|
3
|
+
|
|
4
|
+
/** A post office (bureau de poste). */
|
|
5
|
+
export interface PostOffice {
|
|
6
|
+
/** Numeric office id. */
|
|
7
|
+
id: number;
|
|
8
|
+
/** Office name (French / transliterated). */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Office name in Arabic. */
|
|
11
|
+
name_ar: string;
|
|
12
|
+
/** Office class/category (e.g. "RP"). */
|
|
13
|
+
class: string;
|
|
14
|
+
/** 5-digit postal code. */
|
|
15
|
+
postal_code: string;
|
|
16
|
+
/** Previous postal code, if the office was renumbered. */
|
|
17
|
+
postal_code_old: string | null;
|
|
18
|
+
/** Street address. */
|
|
19
|
+
address: string;
|
|
20
|
+
/** 4-digit zero-padded commune code; links to geoalgeria communes. */
|
|
21
|
+
commune_code: string;
|
|
22
|
+
/** Commune name in French. */
|
|
23
|
+
commune_fr: string;
|
|
24
|
+
/** Commune name in Arabic. */
|
|
25
|
+
commune_ar: string;
|
|
26
|
+
/** Wilaya code as a string ("1".."58"). */
|
|
27
|
+
wilaya_code: string;
|
|
28
|
+
/** Wilaya name in French. */
|
|
29
|
+
wilaya_fr: string;
|
|
30
|
+
/** Wilaya name in Arabic. */
|
|
31
|
+
wilaya_ar: string;
|
|
32
|
+
/** Latitude, or null when the office is not geocoded. */
|
|
33
|
+
lat: number | null;
|
|
34
|
+
/** Longitude, or null when the office is not geocoded. */
|
|
35
|
+
lng: number | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** An ATM (distributeur automatique). */
|
|
39
|
+
export interface Atm {
|
|
40
|
+
/** ATM id. */
|
|
41
|
+
id: string;
|
|
42
|
+
/** ATM name/label. */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Operational status. */
|
|
45
|
+
status: string;
|
|
46
|
+
/** 5-digit postal code of the hosting office. */
|
|
47
|
+
postal_code: string;
|
|
48
|
+
/** Previous postal code, if renumbered. */
|
|
49
|
+
postal_code_old: string | null;
|
|
50
|
+
/** Street address. Currently null for every ATM (the source omits it); typed
|
|
51
|
+
* as `string | null` so a future populated value is not a breaking change. */
|
|
52
|
+
address: string | null;
|
|
53
|
+
/** Commune name in French. */
|
|
54
|
+
commune_fr: string;
|
|
55
|
+
/** Commune name in Arabic. */
|
|
56
|
+
commune_ar: string;
|
|
57
|
+
/** Wilaya code as a string ("1".."58"). */
|
|
58
|
+
wilaya_code: string;
|
|
59
|
+
/** Wilaya name in French. */
|
|
60
|
+
wilaya_fr: string;
|
|
61
|
+
/** Wilaya name in Arabic. */
|
|
62
|
+
wilaya_ar: string;
|
|
63
|
+
/** Latitude, or null when not geocoded. */
|
|
64
|
+
lat: number | null;
|
|
65
|
+
/** Longitude, or null when not geocoded. */
|
|
66
|
+
lng: number | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Dataset metadata (data/metadata.json). */
|
|
70
|
+
export interface Metadata {
|
|
71
|
+
source: string;
|
|
72
|
+
api: string;
|
|
73
|
+
license: string;
|
|
74
|
+
postoffices: number;
|
|
75
|
+
atms: number;
|
|
76
|
+
distinct_postal_codes: number;
|
|
77
|
+
/** ISO date (YYYY-MM-DD) the snapshot was generated. */
|
|
78
|
+
generated_at: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** All post offices. */
|
|
82
|
+
export function postOffices(): PostOffice[];
|
|
83
|
+
/** All ATMs. */
|
|
84
|
+
export function atms(): Atm[];
|
|
85
|
+
/** Dataset metadata. */
|
|
86
|
+
export function metadata(): Metadata;
|
|
87
|
+
|
|
88
|
+
declare const _default: {
|
|
89
|
+
postOffices: typeof postOffices;
|
|
90
|
+
atms: typeof atms;
|
|
91
|
+
metadata: typeof metadata;
|
|
92
|
+
};
|
|
93
|
+
export default _default;
|