npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mostajs/transit-apc

v0.1.0

Published

Transit APC domain layer — passenger counting + fraud estimation for open-access (POP) public transport. Schemas, account-scoped repositories, reconciled Δ APC−validations estimator (A1+A3+A4+A5), VDV 457 equivalence test. Vendor-neutral, ITxPT-aligned.

Readme

@mostajs/transit-apc

Couche domaine APC (comptage automatique de voyageurs) + estimation de fraude pour le transport public en accès libre (proof-of-payment, sans portiques).

Auteur : Dr Hamid MADANI [email protected] Licence : AGPL-3.0-or-later

@mostajs/transit-apc est la couche métier (schémas, repositories, algorithme d'estimation) au-dessus du standard d'interopérabilité ITxPT/NeTEx. Elle ne contient ni capteur, ni edge AI, ni système billettique — seulement le contrat de données et la logique de revenue protection du back-office.


Installation

npm install @mostajs/transit-apc

Dépendances tirées automatiquement : @mostajs/orm, @mostajs/data-plug, @mostajs/url.


Démarrage rapide

1. Estimer la fraude (chaîne A1+A3+A4+A5 — pure, sans base de données)

import { computeFraudIndicator } from '@mostajs/transit-apc'

const indicator = computeFraudIndicator({
  lineId: 'T1',
  period: { start: '2026-05-22T06:00:00Z', end: '2026-05-22T07:00:00Z' },
  countEvents: [
    { boardings: 18, alightings: 0, confidence: 0.97 },
    { boardings: 12, alightings: 5, confidence: 0.97 },
    { boardings: 7, alightings: 14, confidence: 0.97 },
    { boardings: 0, alightings: 18, confidence: 0.97 },
  ],
  validationCount: 25,
})

console.log(indicator.estimatedFraud)        // ≈ 7.4  — le SEUL chiffre « fraude »
console.log(indicator.nonValidationTotal)    // 12     — non-validants (≠ fraude)
console.log(indicator.confidenceInterval)    // { low, high } — IC à 95 %

L'indicateur sépare structurellement trois grandeurs souvent confondues :

| Champ | Sens | |---|---| | rawDelta | montées réconciliées − validations (brut) | | nonValidationTotal | voyageurs non validants — inclut oublis & correspondances | | estimatedFraud | la fraude estimée, après attribution causale — le seul vrai chiffre |

2. Recette de précision VDV 457

import { assertVdv457Equivalence } from '@mostajs/transit-apc'

const report = assertVdv457Equivalence([
  { stopId: 's1', apc: 101, manual: 100 },
  { stopId: 's2', apc: 98, manual: 100 },
  // …
])
console.log(report.passed, report.systematicError, report.faultyStopRate)

3. Persistance — schémas & repositories account-scoped

import { getTransitApcRepos, seedTransitApcDev } from '@mostajs/transit-apc/server'

const repos = await getTransitApcRepos()        // dialecte résolu par data-plug
const seed = await seedTransitApcDev(repos, 'acc_1')

const events = await repos.countEvents.findMany('acc_1', { tripId: seed.tripId })

Tous les repositories sont account-scoped : chaque lecture/écriture est bornée au compte passé en premier argument — aucune requête ne fuit hors de son tenant.


Étalonnage (A3)

Les coefficients d'attribution (transferAllowance, forgetfulSubscriberRate) sont des lois Beta mises à jour par les enquêtes manuelles de terrain :

import { applyCalibration, DEFAULT_CALIBRATION } from '@mostajs/transit-apc'

const calibration = applyCalibration(DEFAULT_CALIBRATION, {
  sampledTrips: 80,
  observedTransferRate: 0.07,
  observedForgetfulRate: 0.34,
})
computeFraudIndicator({ /* … */, calibration })

Périmètre

@mostajs/transit-apc fait : schémas du domaine, repositories multi-tenant, estimation de fraude réconciliée et bornée, test d'équivalence VDV 457, URLs signées de partage de rapport.

Il ne fait pas : pilotage de capteurs, edge AI/YOLO, scoring ML des hotspots (le schéma FraudHotspot est défini mais rempli par transit-scoring), UI.


Tests

npm test

Références

  • llms.txt — fiche API condensée.
  • AUDIT-TRANSIT-APC-BENCHMARK-V2-22052026.md — audit & spécification de conception.
  • ETUDE-AMELIORATION-METHODE-DELTA-APC-22052026.md — fondement méthodologique de la chaîne A1-A5.