Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
309 changes: 162 additions & 147 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,147 +1,162 @@
# gpf-schema-store

> Work in progress (see [ROADMAP](https://github.com/ignfab/gpf-schema-store/wiki))

**Non official / experimental** implementation of [OGC API Features - schema](https://portal.ogc.org/files/108199) by enriching information from the Geoplateforme WFS to ease data discovery by AI (and humans).

## Data model

The data model is :

* **id** : WFS GetCap FeatureType `<Name>` (namespace:name = unique identifier)
* **namespace** : namespace identifier (e.g `BDTOPO_V3`)
* **name** : name identifier (e.g `batiment`)
* **title** : WFS GetCap `<Title>` "BDTOPO : Bâtiments"
* **description** : WFS GetCap `<Abstract>`
* **properties** : Array of property defined by `name`, `type`, `title` and `description`. `enum` is also available when necessary.

When merged with `data/overwrites`, title and description are overwritten when available.

## Usage

> **WARNING**: The MCP [ignfab/geocontext](https://github.com/ignfab/geocontext) relies on a published version. The following instructions are related to the maintenance of the schema.

### Build

```bash
npm install
npm run build
```

### Test

```bash
# To run unit test only :
npm run test

# To compute coverage :
npm run test:coverage

# To run integration test on https://data.geopf.fr/wfs
npm run test:all
```

### Configure filtering

Edit [data/namespace-filters.yaml](data/namespace-filters.yaml) to decide which namespaces are kept or ignored and to assign metadata (`product`, `ignoredReason`) using first-match-wins rules.

### Generate namespace report

Update [data/namespaces.csv](data/namespaces.csv) to review every discovered namespace, its computed metadata (`product`, `ignored`, `ignoredReason`), and its collections :

```bash
npx gpf-schema-store update-namespaces
```

### Fetch schema from GPF WFS

Fetch WFS schemas from GPF, apply the namespace filtering rules defined in [data/namespace-filters.yaml](data/namespace-filters.yaml), and regenerate `data/wfs` directory :

```bash
# download data/wfs/{namespace}/{name}.json
npx gpf-schema-store update
```

### Check local overwrites

Compare local WFS snapshots stored in `data/wfs` with local overwrite files in `data/overwrites`.

```bash
# check that overwrites are aligned with local snapshots in data/wfs
npx gpf-schema-store check-overwrites
```


### Test local search

Use the `search` command to quickly inspect the results returned by the search engine with its default options.

```bash
# display the top 5 results
npx gpf-schema-store search chef lieu commune --limit 5

# another example
npx gpf-schema-store search bdtopo batiment --limit 3
```

The output shows the collection identifier, the computed score, and MiniSearch match details, which makes it easier to compare ranking behavior before and after a search change.

### Render merged catalog files

Useful for debugging : Write the final merged collection JSON files, as seen by the local catalog after applying `data/overwrites`, to an output directory.

```bash
# write merged files to ./tmp/catalog/{namespace}/{name}.json
npx gpf-schema-store render-catalog ./tmp/catalog

# start from a clean output directory
npx gpf-schema-store render-catalog ./tmp/catalog --clean
```

## Test a local package build in geocontext

If you want to test a local change from this package inside [`geocontext`](https://github.com/ignfab/geocontext), the simplest and most reliable workflow is to install a local tarball generated with `npm pack`.

This is the recommended approach because it is very close to a real npm publish:

* it uses the package `files` / `exports` configuration
* it only installs what would actually be shipped
* it avoids some of the resolution quirks of `npm link`

From this repository:

```bash
npm run build
npm pack
```

This creates a tarball such as `ignfab-gpf-schema-store-0.1.0.tgz`.

Then, from your local `geocontext` checkout:

```bash
cd /path/to/geocontext
npm install /path/to/gpf-schema-store/ignfab-gpf-schema-store-0.1.0.tgz
npm run build
npm test
```

When you make a new change in `gpf-schema-store`, rebuild and regenerate the tarball, then reinstall it in `geocontext`.

If you only want to test locally without updating `package.json`, use `--no-save`:

```bash
npm install --no-save /path/to/gpf-schema-store/ignfab-gpf-schema-store-0.1.0.tgz
```

If you already installed the local tarball with a saved dependency, restore the published dependency afterwards:

```bash
npm install @ignfab/gpf-schema-store@^0.1.0
```

Using a direct local path like `npm install ../gpf-schema-store` can work too, but it is less predictable because it depends on the local package state and requires extra care to keep `dist/` up to date.

## License

[MIT](LICENSE)
# gpf-schema-store

> Work in progress (see [ROADMAP](https://github.com/ignfab/gpf-schema-store/wiki))

**Non official / experimental** implementation of [OGC API Features - schema](https://portal.ogc.org/files/108199) by enriching information from the Geoplateforme WFS to ease data discovery by AI (and humans).

## Data model

The data model is :

* **id** : WFS GetCap FeatureType `<Name>` (namespace:name = unique identifier)
* **namespace** : namespace identifier (e.g `BDTOPO_V3`)
* **name** : name identifier (e.g `batiment`)
* **title** : WFS GetCap `<Title>` "BDTOPO : Bâtiments"
* **description** : WFS GetCap `<Abstract>`
* **properties** : Array of property defined by `name`, `type`, `title` and `description`. `enum` is also available when necessary.

When merged with `data/overwrites`, title and description are overwritten when available.

## Usage

> **WARNING**: The MCP [ignfab/geocontext](https://github.com/ignfab/geocontext) relies on a published version. The following instructions are related to the maintenance of the schema.

### Build

```bash
npm install
npm run build
```

### Test

```bash
# To run unit test only :
npm run test

# To compute coverage :
npm run test:coverage

# To run integration test on https://data.geopf.fr/wfs
npm run test:all
```

### Configure filtering

Edit [data/namespace-filters.yaml](data/namespace-filters.yaml) to decide which namespaces are kept or ignored and to assign metadata (`product`, `ignoredReason`) using first-match-wins rules.

### Generate namespace report

Update [data/namespaces.csv](data/namespaces.csv) to review every discovered namespace, its computed metadata (`product`, `ignored`, `ignoredReason`), and its collections :

```bash
npx gpf-schema-store update-namespaces
```

### Fetch schema from GPF WFS

Fetch WFS schemas from GPF, apply the namespace filtering rules defined in [data/namespace-filters.yaml](data/namespace-filters.yaml), and regenerate `data/wfs` directory :

```bash
# download data/wfs/{namespace}/{name}.json
npx gpf-schema-store update
```

### Check local overwrites

Compare local WFS snapshots stored in `data/wfs` with local overwrite files in `data/overwrites`.

```bash
# check that overwrites are aligned with local snapshots in data/wfs
npx gpf-schema-store check-overwrites
```


### Test local search

Use the `search` command to quickly inspect the results returned by the search engine with its default options.

```bash
# display the top 5 results
npx gpf-schema-store search chef lieu commune --limit 5

# another example
npx gpf-schema-store search bdtopo batiment --limit 3
```

The output shows the collection identifier, the computed score, and MiniSearch match details, which makes it easier to compare ranking behavior before and after a search change.

### Inspect WFS keywords

Use the `wfs-keywords` command to request the public GPF WFS directly and list collection keywords sorted by occurrence count.

```bash
# show normalized keywords from the public GPF WFS
npx gpf-schema-store wfs-keywords

# show keywords after removing generic values such as "features" and "WFS"
npx gpf-schema-store wfs-keywords --filtered

# only show the 20 most frequent keywords
npx gpf-schema-store wfs-keywords --limit 20
```

### Render merged catalog files

Useful for debugging : Write the final merged collection JSON files, as seen by the local catalog after applying `data/overwrites`, to an output directory.

```bash
# write merged files to ./tmp/catalog/{namespace}/{name}.json
npx gpf-schema-store render-catalog ./tmp/catalog

# start from a clean output directory
npx gpf-schema-store render-catalog ./tmp/catalog --clean
```

## Test a local package build in geocontext

If you want to test a local change from this package inside [`geocontext`](https://github.com/ignfab/geocontext), the simplest and most reliable workflow is to install a local tarball generated with `npm pack`.

This is the recommended approach because it is very close to a real npm publish:

* it uses the package `files` / `exports` configuration
* it only installs what would actually be shipped
* it avoids some of the resolution quirks of `npm link`

From this repository:

```bash
npm run build
npm pack
```

This creates a tarball such as `ignfab-gpf-schema-store-0.1.0.tgz`.

Then, from your local `geocontext` checkout:

```bash
cd /path/to/geocontext
npm install /path/to/gpf-schema-store/ignfab-gpf-schema-store-0.1.0.tgz
npm run build
npm test
```

When you make a new change in `gpf-schema-store`, rebuild and regenerate the tarball, then reinstall it in `geocontext`.

If you only want to test locally without updating `package.json`, use `--no-save`:

```bash
npm install --no-save /path/to/gpf-schema-store/ignfab-gpf-schema-store-0.1.0.tgz
```

If you already installed the local tarball with a saved dependency, restore the published dependency afterwards:

```bash
npm install @ignfab/gpf-schema-store@^0.1.0
```

Using a direct local path like `npm install ../gpf-schema-store` can work too, but it is less predictable because it depends on the local package state and requires extra care to keep `dist/` up to date.

## License

[MIT](LICENSE)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "arrondissement_departemental",
"title": "ADMINEXPRESS COG 2017 Arrondissement départemental",
"description": "ADMINEXPRESS COG 2017 Arrondissement départemental",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
3 changes: 3 additions & 0 deletions data/wfs/ADMINEXPRESS-COG.2017/chef_lieu.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "chef_lieu",
"title": "ADMINEXPRESS COG 2017 Chef-lieu",
"description": "ADMINEXPRESS COG 2017 Chef-lieu",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
3 changes: 3 additions & 0 deletions data/wfs/ADMINEXPRESS-COG.2017/commune.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "commune",
"title": "ADMINEXPRESS COG 2017 Commune",
"description": "ADMINEXPRESS COG 2017 Commune",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
3 changes: 3 additions & 0 deletions data/wfs/ADMINEXPRESS-COG.2017/departement.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "departement",
"title": "ADMINEXPRESS COG 2017 Département",
"description": "ADMINEXPRESS COG 2017 Département",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
3 changes: 3 additions & 0 deletions data/wfs/ADMINEXPRESS-COG.2017/epci.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "epci",
"title": "ADMINEXPRESS COG 2017 EPCI",
"description": "ADMINEXPRESS COG 2017 EPCI",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
3 changes: 3 additions & 0 deletions data/wfs/ADMINEXPRESS-COG.2017/region.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "region",
"title": "ADMINEXPRESS COG 2017 Région",
"description": "ADMINEXPRESS COG 2017 Région",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "arrondissement_departemental",
"title": "ADMINEXPRESS COG 2018 Arrondissement départemental",
"description": "ADMINEXPRESS COG 2018 Arrondissement départemental",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
3 changes: 3 additions & 0 deletions data/wfs/ADMINEXPRESS-COG.2018/chef_lieu.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "chef_lieu",
"title": "ADMINEXPRESS COG 2018 Chef-lieu",
"description": "ADMINEXPRESS COG 2018 Chef-lieu",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
3 changes: 3 additions & 0 deletions data/wfs/ADMINEXPRESS-COG.2018/commune.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "commune",
"title": "ADMINEXPRESS COG 2018 Commune",
"description": "ADMINEXPRESS COG 2018 Commune",
"keywords": [
"Unités administratives"
],
"properties": [
{
"name": "id",
Expand Down
Loading
Loading