Skip to content

Commit

Permalink
Merge branch 'master' into object-export
Browse files Browse the repository at this point in the history
  • Loading branch information
paulboosz committed Oct 8, 2024
2 parents 7c87de8 + 3bcc269 commit 51cb3e4
Show file tree
Hide file tree
Showing 13 changed files with 3,736 additions and 946 deletions.
4,472 changes: 3,645 additions & 827 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions public/data/textile/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"countryFabric": "RAS",
"countryDyeing": "RAS",
"countryMaking": "RAS",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand All @@ -89,7 +88,6 @@
"countryFabric": "CN",
"countryDyeing": "CN",
"countryMaking": "CN",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 115,
"numberOfReferences": 12000,
Expand Down Expand Up @@ -118,7 +116,6 @@
"countryFabric": "CN",
"countryDyeing": "CN",
"countryMaking": "CN",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 115,
"numberOfReferences": 12000,
Expand Down Expand Up @@ -244,7 +241,6 @@
"countryFabric": "RAS",
"countryDyeing": "RAS",
"countryMaking": "RAS",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand Down Expand Up @@ -273,7 +269,6 @@
"countryFabric": "CN",
"countryDyeing": "CN",
"countryMaking": "CN",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 115,
"numberOfReferences": 12000,
Expand Down Expand Up @@ -342,7 +337,6 @@
}
],
"product": "jupe",
"airTransportRatio": 1,
"marketingDuration": 65,
"numberOfReferences": 100000,
"price": 15
Expand All @@ -361,7 +355,6 @@
}
],
"product": "chemise",
"airTransportRatio": 1,
"marketingDuration": 65,
"numberOfReferences": 100000,
"price": 15
Expand All @@ -381,7 +374,6 @@
],
"product": "jean",
"fading": true,
"airTransportRatio": 1,
"marketingDuration": 65,
"numberOfReferences": 100000,
"price": 20
Expand All @@ -400,7 +392,6 @@
}
],
"product": "pantalon",
"airTransportRatio": 1,
"marketingDuration": 65,
"numberOfReferences": 100000,
"price": 20
Expand All @@ -419,7 +410,6 @@
}
],
"product": "manteau",
"airTransportRatio": 1,
"marketingDuration": 65,
"numberOfReferences": 100000,
"price": 40
Expand All @@ -438,7 +428,6 @@
}
],
"product": "tshirt",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand All @@ -463,7 +452,6 @@
"countryFabric": "---",
"countryDyeing": "---",
"countryMaking": "---",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand All @@ -485,7 +473,6 @@
}
],
"product": "pull",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand All @@ -506,7 +493,6 @@
}
],
"product": "chaussettes",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand All @@ -527,7 +513,6 @@
}
],
"product": "calecon",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand All @@ -548,7 +533,6 @@
}
],
"product": "slip",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand All @@ -569,7 +553,6 @@
}
],
"product": "maillot-de-bain",
"airTransportRatio": 1,
"business": "large-business-without-services",
"marketingDuration": 65,
"numberOfReferences": 100000,
Expand Down
40 changes: 1 addition & 39 deletions public/data/textile/processes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2583,44 +2583,6 @@
"waste": 0,
"alias": "passenger-car"
},
{
"name": "Mise en décharge de textiles, FR",
"displayName": "Mise en décharge de textiles, FR",
"info": "Traitement de fin de vie > Mise en décharge > Fractions de déchets",
"unit": "kg",
"source": "Ecobalyse",
"correctif": "Précalcul Ecobalyse à partir de Base Impacts",
"step_usage": "Utilisation",
"uuid": "9adaf403-4eda-4d9c-80c3-f231754644ca",
"impacts": {
"acd": 0,
"cch": 0,
"etf": 0,
"etf-c": 0,
"fru": 0,
"fwe": 0,
"htc": 0,
"htc-c": 0,
"htn": 0,
"htn-c": 0,
"ior": 0,
"ldu": 0,
"mru": 0,
"ozd": 0,
"pco": 0,
"pma": 0,
"swe": 0,
"tre": 0,
"wtu": 0,
"ecs": 66.8698252969278,
"pef": 68.14941102161761
},
"heat_MJ": 0,
"elec_pppm": 0,
"elec_MJ": 0,
"waste": 0,
"alias": null
},
{
"name": "Fin de vie hors voiture (transport en camion, incinération, mise en décharge)",
"displayName": "Fin de vie hors voiture (transport en camion, incinération, mise en décharge)",
Expand Down Expand Up @@ -2964,7 +2926,7 @@
"alias": "dyeing-cellulosic-fiber"
},
{
"name": "Blanchiment",
"name": "bleaching, textile//[RoW] bleaching, textile",
"displayName": "Blanchiment",
"info": "Textile > Ennoblissement > Blanchiment",
"unit": "kg",
Expand Down
5 changes: 3 additions & 2 deletions src/Data/Common/DecodeUtils.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import Json.Decode.Extra as DE


{-| A stricter Decode.maybe using Json.Decode.Extra's optionalField here because we want
a failure when a Maybe decoded field value is invalid.
a failure when a Maybe decoded field value is invalid, while we still want to treat `null`
as an acepted value.
-}
strictOptional : String -> Decoder a -> Decoder (Maybe a -> b) -> Decoder b
strictOptional field decoder =
DE.andMap (DE.optionalField field decoder)
DE.andMap (DE.optionalNullableField field decoder)
2 changes: 1 addition & 1 deletion src/Data/Food/Query.elm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ buildApiQuery clientUrl query =
-H "content-type: application/json" \\
-d '%json%'
"""
|> String.replace "%apiUrl%" (clientUrl ++ "api/food/recipe")
|> String.replace "%apiUrl%" (clientUrl ++ "api/food")
|> String.replace "%json%" (encode query |> Encode.encode 0)


Expand Down
6 changes: 5 additions & 1 deletion src/Data/Gitbook.elm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Path
| FoodTransformation -- Transformation des ingrédients
| FoodTransport -- Transport entre étapes
| FoodUse -- Consommation
| TextileCircularFootprintFormula -- Circular Footprint Formula (CFF)
| TextileComplementMicrofibers -- Complément textile microfibres
| TextileDistribution -- Distribution textile
| TextileDurability -- Durabilité textile
Expand Down Expand Up @@ -69,6 +70,9 @@ pathToString path =
FoodUse ->
"alimentaire/etapes-du-cycles-de-vie/consommation"

TextileCircularFootprintFormula ->
"textile/cycle-de-vie-des-produits-textiles/circular-footpring-formula-cff"

TextileComplementMicrofibers ->
"textile/complements-hors-acv/microfibres"

Expand Down Expand Up @@ -124,7 +128,7 @@ pathToString path =
"textile/etapes-du-cycle-de-vie/etape-1-matieres"

TextileSpinning ->
"textile/etapes-du-cycle-de-vie/etape-2-fabrication-du-fil-new"
"textile/cycle-de-vie-des-produits-textiles/etape-2-fabrication-du-fil"

TextileTransport ->
"textile/parametres-transverses/transport"
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Textile/Query.elm
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ isAdvancedQuery query =
, query.makingDeadStock /= Nothing
, query.makingWaste /= Nothing
, query.materials |> List.any (.spinning >> (/=) Nothing)
, query.physicalDurability /= Nothing
, query.surfaceMass /= Nothing
, not query.upcycled && List.length query.disabledSteps > 0
, query.yarnSize /= Nothing
Expand All @@ -254,6 +255,7 @@ regulatory query =
, makingDeadStock = Nothing
, makingWaste = Nothing
, materials = query.materials |> List.map (\m -> { m | spinning = Nothing })
, physicalDurability = Nothing
, surfaceMass = Nothing
, yarnSize = Nothing
}
Expand Down
13 changes: 0 additions & 13 deletions src/Page/Explore/Common.elm
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module Page.Explore.Common exposing
( boolText
, impactBarGraph
, scopesView
)

import Data.Scope as Scope exposing (Scope)
import Html exposing (..)
import Html.Attributes exposing (..)
import Views.Format as Format
Expand All @@ -19,17 +17,6 @@ boolText bool =
"non"


scopesView : { a | scopes : List Scope } -> Html msg
scopesView =
.scopes
>> List.map
(\scope ->
span [ class "badge badge-success" ]
[ text <| Scope.toLabel scope ]
)
>> div [ class "d-flex gap-1" ]


impactBarGraph : Bool -> Float -> Float -> Html msg
impactBarGraph detailed max score =
let
Expand Down
6 changes: 0 additions & 6 deletions src/Page/Explore/Countries.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Data.Transport as Transport
import Dict.Any as Dict
import Html exposing (..)
import Html.Attributes exposing (..)
import Page.Explore.Common as Common
import Page.Explore.Table as Table exposing (Table)
import Route
import Views.Format as Format
Expand Down Expand Up @@ -68,11 +67,6 @@ table distances countries { detailed, scope } =

else
Nothing
, Just
{ label = "Domaines"
, toValue = Table.StringValue <| .scopes >> List.map Scope.toLabel >> String.join "/"
, toCell = Common.scopesView
}
, if detailed then
Just
{ label = "Distances"
Expand Down
24 changes: 12 additions & 12 deletions src/Page/Explore/Impacts.elm
Original file line number Diff line number Diff line change
Expand Up @@ -41,45 +41,45 @@ table { detailed, scope } =
, toValue = Table.StringValue <| .unit
, toCell = \def -> code [] [ text def.unit ]
}
, { label = "Normalisation (PEF)"
, { label = "Normalisation (Coût Evt)"
, toValue =
Table.FloatValue <|
.pefData
.ecoscoreData
>> Maybe.map (.normalization >> Unit.impactToFloat)
>> Maybe.withDefault 0
, toCell =
\def ->
def.pefData
def.ecoscoreData
|> Maybe.map (.normalization >> Unit.impactToFloat >> Format.formatRichFloat 2 def.unit)
|> Maybe.withDefault (text "N/A")
}
, { label = "Pondération (PEF)"
, { label = "Pondération (Coût Evt)"
, toValue =
Table.FloatValue <|
.pefData
.ecoscoreData
>> Maybe.map (.weighting >> Split.toFloat)
>> Maybe.withDefault 0
, toCell = .pefData >> Maybe.map (.weighting >> Format.splitAsPercentage 2) >> Maybe.withDefault (text "N/A")
, toCell = .ecoscoreData >> Maybe.map (.weighting >> Format.splitAsPercentage 2) >> Maybe.withDefault (text "N/A")
}
, { label = "Normalisation (Sc. Imp.)"
, { label = "Normalisation (PEF)"
, toValue =
Table.FloatValue <|
.ecoscoreData
.pefData
>> Maybe.map (.normalization >> Unit.impactToFloat)
>> Maybe.withDefault 0
, toCell =
\def ->
def.ecoscoreData
def.pefData
|> Maybe.map (.normalization >> Unit.impactToFloat >> Format.formatRichFloat 2 def.unit)
|> Maybe.withDefault (text "N/A")
}
, { label = "Pondération (Sc. Imp.)"
, { label = "Pondération (PEF)"
, toValue =
Table.FloatValue <|
.ecoscoreData
.pefData
>> Maybe.map (.weighting >> Split.toFloat)
>> Maybe.withDefault 0
, toCell = .ecoscoreData >> Maybe.map (.weighting >> Format.splitAsPercentage 2) >> Maybe.withDefault (text "N/A")
, toCell = .pefData >> Maybe.map (.weighting >> Format.splitAsPercentage 2) >> Maybe.withDefault (text "N/A")
}
, { label = "Description"
, toValue = Table.StringValue .description
Expand Down
Loading

0 comments on commit 51cb3e4

Please sign in to comment.