Skip to content

Health Software Common Practices

HSCP-T-011 · open test

Supported device list: bounded by the end of manufacturer fixes, profiles tested, withdrawals justified and announced

Serves HSCP-G-241 · Recipe: HSCP-R-024

Code under the licence Apache 2.0 · Python 3.10 or later, standard library only, no network access

What the test checks

The evidence is the list of device profiles, one JSON object per profile (JSON Lines), following the recipe's data model:

Field Required Meaning
profil yes profile name
type yes ordinateur (computer), poste-partage (shared workstation), telephone (phone) or tablette (tablet)
systeme yes operating system and minimum version
navigateur no browser and minimum version, null for a native app
fin_correctifs yes end of security fixes announced by the manufacturer, null if not announced
statut yes pris-en-charge (supported) or retire (withdrawn)
essai_le supported profile date the product was last tested
retrait withdrawn profile date, motif (fin-correctifs, securite, interoperabilite), explication, annonce_le

The test accepts the list if it has at least one supported profile, if each supported profile was tested within the review period and has not passed the end of its manufacturer's fixes, and if each withdrawal carries a date, a listed reason and an explanation: a withdrawal for end of fixes does not precede that end, any other withdrawal was announced at least the notice period before its date.

It reports, without refusing, each end of fixes that was not announced.

Running the test

python3 verifier.py liste.jsonl --date 2026-12-02 --revue-mois 12 --preavis-mois 6

--date sets the check date (today by default), --revue-mois the review period (12 by default), --preavis-mois the notice period for a withdrawal (6 by default), --json returns the answer in JSON. Exit code: 0 evidence accepted, 1 evidence refused, 2 incorrect call. Python 3.10 or later, no dependencies.

Examples

  • exemples/valide/: a shared care workstation and an entry-level phone, supported and tested; a tablet withdrawn at the end of its manufacturer's fixes; a computer withdrawn for a security reason announced six months ahead. Accepted, with the unannounced end of fixes reported.
  • exemples/refuse/: a workstation supported after the end of fixes, a profile last tested more than a year ago, a withdrawal for end of fixes before that end, a withdrawal announced two weeks ahead, a type outside the list and a missing end of fixes. Refused.

What the test does not say

  • It does not say that the list starts from the devices users actually use, nor that it keeps the oldest profiles still maintained: the review judges that.
  • It does not say that the tests were run, nor on a real device.
  • It does not say that no security requirement was weakened to keep a profile.

Code

Download the test (zip archive: program, examples, README, licence) (11 KB) · verifier.py

The code and its messages are not translated (French).

#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 les contributeurs des Gestes communs du logiciel de santé
"""HSCP-T-011 : liste des terminaux pris en charge, bornée par la fin des correctifs du fabricant, retraits motivés et
annoncés.

    python3 verifier.py <liste.jsonl> [--date AAAA-MM-JJ] [--revue-mois N] [--preavis-mois N] [--json]

Lit la liste des profils, un objet JSON par profil (JSON Lines) : profil, type, systeme, navigateur, fin_correctifs,
statut, essai_le, retrait {date, motif, explication, annonce_le}.
Refus : ligne illisible ; champ obligatoire absent ; type ou statut hors liste ; profil en double ; profil pris en
charge sans essai, essayé depuis plus de --revue-mois mois (12 par défaut), ou dont la fin des correctifs est passée ;
profil retiré sans date, motif de la liste ou explication ; retrait pour fin des correctifs avant cette fin ; autre
retrait annoncé moins de --preavis-mois mois (6 par défaut) avant sa date ; aucun profil pris en charge.
Note seulement : fin des correctifs non annoncée.
Il ne dit pas que la liste part des terminaux réellement employés, ni que les essais ont été faits.

Codes de retour : 0 pièce acceptée, 1 pièce refusée, 2 appel incorrect.
Bibliothèque standard seulement, aucun accès réseau.
"""
import argparse
import datetime as dt
import json
import sys

ID = "HSCP-T-011"
TYPES = {"ordinateur", "poste-partage", "telephone", "tablette"}
STATUTS = {"pris-en-charge", "retire"}
MOTIFS = {"fin-correctifs", "securite", "interoperabilite"}
OBLIGATOIRES = ("profil", "type", "systeme", "statut")


def jour(v):
    try:
        return dt.date.fromisoformat(str(v))
    except ValueError:
        return None


def mois_avant(d, n):
    m = d.month - 1 - n
    a, m = d.year + m // 12, m % 12 + 1
    return d.replace(year=a, month=m, day=min(d.day, 28))


def verifier(chemin, aujourdhui, revue, preavis):
    refus, notes, vus, n, actifs = [], [], set(), 0, 0
    for num, ligne in enumerate(open(chemin, encoding="utf-8"), 1):
        if not ligne.strip():
            continue
        try:
            p = json.loads(ligne)
            assert isinstance(p, dict)
        except (ValueError, AssertionError):
            refus.append(f"ligne {num} : objet JSON illisible")
            continue
        n += 1
        nom = p.get("profil") or f"ligne {num}"
        manque = [c for c in OBLIGATOIRES if p.get(c) in (None, "")] + ([] if "fin_correctifs" in p else ["fin_correctifs"])
        if manque:
            refus.append(f"{nom} : champ(s) absent(s) : {', '.join(manque)}")
            continue
        if nom in vus:
            refus.append(f"{nom} : profil en double")
        vus.add(nom)
        if p["type"] not in TYPES:
            refus.append(f"{nom} : type hors liste")
        fin = None
        if p["fin_correctifs"] is None:
            notes.append(f"{nom} : fin des correctifs non annoncée")
        else:
            fin = jour(p["fin_correctifs"])
            if fin is None:
                refus.append(f"{nom} : fin des correctifs illisible")
        if p["statut"] == "pris-en-charge":
            actifs += 1
            essai = jour(p.get("essai_le"))
            if essai is None:
                refus.append(f"{nom} : profil pris en charge sans date d'essai")
            elif essai < mois_avant(aujourdhui, revue):
                refus.append(f"{nom} : dernier essai plus ancien que {revue} mois")
            if fin and fin < aujourdhui:
                refus.append(f"{nom} : pris en charge après la fin des correctifs de son fabricant")
        elif p["statut"] == "retire":
            r = p.get("retrait") if isinstance(p.get("retrait"), dict) else {}
            date, motif = jour(r.get("date")), r.get("motif")
            if date is None or motif not in MOTIFS or not r.get("explication"):
                refus.append(f"{nom} : retrait sans date, motif de la liste ou explication")
                continue
            if motif == "fin-correctifs":
                if fin is None or date < fin:
                    refus.append(f"{nom} : retiré pour fin des correctifs avant cette fin")
            else:
                annonce = jour(r.get("annonce_le"))
                if annonce is None or annonce > mois_avant(date, preavis):
                    refus.append(f"{nom} : retrait annoncé moins de {preavis} mois avant sa date")
        else:
            refus.append(f"{nom} : statut hors liste")
    if n == 0:
        refus.append("liste vide")
    elif actifs == 0:
        refus.append("aucun profil pris en charge")
    return refus, notes, n


def main(argv):
    p = argparse.ArgumentParser(prog="verifier.py", description=__doc__.splitlines()[0])
    p.add_argument("liste")
    p.add_argument("--date", default=dt.date.today().isoformat())
    p.add_argument("--revue-mois", type=int, default=12)
    p.add_argument("--preavis-mois", type=int, default=6)
    p.add_argument("--json", action="store_true")
    try:
        a = p.parse_args(argv)
        aujourdhui = dt.date.fromisoformat(a.date)
    except (SystemExit, ValueError):
        return 2
    try:
        refus, notes, n = verifier(a.liste, aujourdhui, a.revue_mois, a.preavis_mois)
    except OSError as e:
        print(f"{ID} : pièce illisible : {e}", file=sys.stderr)
        return 2
    if a.json:
        print(json.dumps({"test": ID, "accepte": not refus, "profils": n, "refus": refus, "notes": notes},
                         ensure_ascii=False, indent=2))
    else:
        print(f"{ID} : {'pièce acceptée' if not refus else 'pièce refusée'} ({n} profil(s))")
        for r in refus:
            print("  refus :", r)
        for x in notes:
            print("  note :", x)
    return 0 if not refus else 1


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))

Files of the test