Register weighted-microdata rules: weights aren't values
Les mainteneurs répondent en général sous 2 jours
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 18/100
Piste de recherche
The work is registering four rules in rules/registry.toml plus AST guards for the shapes they describe. Read the issue's list of rule IDs and the cited Simulation API line first, then check whether linked pull request #3938 already covers them, since it is still open. Done means the three guarded rules are enforced with no findings on the current code, and the doc-only rule is registered.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Problem
A weighted MicroSeries or MicroDataFrame weights every .sum(), .mean() and .count(). Aggregating a weight column through one weights it by itself, and returns the sum of squared weights.
That happened in the Simulation API (PolicyEngine/policyengine-sim-api#766, fixed by PolicyEngine/policyengine-sim-api#767). budget.households was about 10^4 times too high on every run, and its test missed it because it used plain pd.DataFrames.
Once the unused economy comparison module is removed, nothing in the Public API handles microdata. Nothing stops new code from making the same mistake, though.
Proposal
Phase 1 step 1.9. Register the rule that weights aren't values, plus AST guards for the shapes a source check can recognise, in rules/registry.toml:
api.microdata.weights-not-values(doc-only): weights, values, labels and counts each allow different operations.api.microdata.weights-not-aggregated-as-values: a weight is never the value of a weightedMicroSeries, the variable of a weighted aggregator, orframe[<weight>]followed by a weighted reduction.api.microdata.weight-stripping-confined: raw values (np.array,.values,.to_numpy()and so on) are read from weighted microdata only in a designated module. None is designated yet.api.microdata.unweighted-series-are-labels: aMicroSeriesbuilt withoutweights=is only a grouping or filter key.
The aggregation rule's proof is the real pre-#767 Simulation API line. With no current code in scope, all three guarded rules start enforced, with no findings.
- Langage dominant
- Python
- Étoiles
- 18
- Forks
- 33
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 26
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PolicyEngine/policyengine-api
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
PolicyEngine/policyengine-api#3911 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
PolicyEngine/policyengine-api#3910 ·
Les mainteneurs répondent en général sous 2 jours
-
Remove the unused economy comparison modulePeut-être pris @anth-volk l’a pris il y a 2 jours. Ouverte
Difficulté 3/5 Une demi-journée Accessibilité débutants 18/100
PolicyEngine/policyengine-api#3935 ·
Les mainteneurs répondent en général sous 2 jours
-
Refactor tests, scripts and the rules tool, then select every ruff rule (ALL)Peut-être pris @anth-volk l’a pris il y a 2 jours. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
PolicyEngine/policyengine-api#3931 ·
Les mainteneurs répondent en général sous 2 jours
-
Refactor the application package within ruff's complexity limitsPeut-être pris @anth-volk l’a pris il y a 2 jours. Ouverte
Difficulté 4/5 Plus d'une semaine Accessibilité débutants 18/100
PolicyEngine/policyengine-api#3930 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de PolicyEngine/policyengine-api
Issues similaires
-
python triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
microsoft/semantic-kernel#14615 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
shackett/shackett-utils#19 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
UKGovernmentBEIS/control-arena#917 ·
Les mainteneurs répondent en général sous 1 jour