Skip to content

Commit 5667fb6

Browse files
authored
Merge pull request #21 from sine-fdn/raimundo/tad
feat: add Action TransportActivityData
2 parents 921c032 + 05804aa commit 5667fb6

File tree

1 file changed

+176
-19
lines changed

1 file changed

+176
-19
lines changed

specs/index.bs

+176-19
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ Advisement: The current technical specifications are undergoing continuous refin
131131
:: See [Pathfinder Tech Specs](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#host-system) for the definition.
132132
Here, a host system additionally implements support for 1 or more data transactions ([[#txns]]).
133133

134+
: <dfn>Data Owner</dfn>
135+
:: See [Pathfinder Tech Specs](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#data-owner) for the definition.
136+
137+
: <dfn>Data Recipient</dfn>
138+
:: See [Pathfinder Tech Specs](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#data-recipient) for the definition.
139+
134140
: <dfn>ShipmentFootprint</dfn>
135141
:: See [[#dt-sf]] for the definition.
136142

@@ -149,7 +155,12 @@ Advisement: The current technical specifications are undergoing continuous refin
149155

150156
: <dfn>PCF</dfn>
151157
::
152-
Product Carbon Footprint. See [Pathfinder Tech Specs](https://wbcsd.github.io/tr/data-exchange-protocol/#dt-carbonfootprint) for further details.
158+
Product Carbon Footprint. See [Pathfinder Tech Specs](https://wbcsd.github.io/tr/data-exchange-protocol/#dt-carbonfootprint) for further details
159+
160+
: <dfn>Access Token</dfn>
161+
:: :: See [Pathfinder Tech Specs](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#access-token) for the definition.
162+
163+
Issue: add a pathfinder tech specs normative reference to this document
153164

154165
# Business Cases # {#business-cases}
155166

@@ -535,7 +546,7 @@ The highlighted lines show 2 TCEs which `Z` has collected and calculated for `S`
535546

536547
# Data Model # {#data-model}
537548

538-
ISSUE: Add a brief Intro to the data model? Potentially with brief diagram or explanation on how shipment, TCE, TOC etc. relate to each other?
549+
ISSUE: Add a brief Intro to the data model? Potentially with brief diagram or explanation on how shipment, TCE, TOC etc. relate to each other?
539550

540551
## ShipmentFootprint ## {#dt-sf}
541552

@@ -547,7 +558,7 @@ By collecting 1 or more ShipmentFootprint for a shipment from [=Transport Operat
547558
a [=Transport Service User=] can construct Transport Chains ([=TCs=]), and thereby calculate
548559
logistics emissions.
549560

550-
ISSUE: The way the above paragraphs are defined might lead to confusion.
561+
ISSUE: The way the above paragraphs are defined might lead to confusion.
551562

552563
To calculate a ShipmentFootprint, the [=Transport Operator=] or [=Transport Service Organizer=] MUST
553564

@@ -587,7 +598,7 @@ A ShipmentFootprint has the following properties:
587598
<td><dfn>typeOfItems</dfn>
588599
<td>String
589600
<td>O
590-
<td>The type of units the shipment, including the goods transported and any packaging provided by the [=Transport Service User=], is composed of. For example, boxes, pallets, bottles, etc.
601+
<td>The type of units the shipment, including the goods transported and any packaging provided by the [=Transport Service User=], is composed of. For example, boxes, pallets, bottles, etc.
591602
<tr>
592603
<td><dfn>shipmentId</dfn>
593604
<td>String
@@ -894,8 +905,8 @@ The Data Type <{TOC}> has the following properties:
894905
<td>
895906

896907
<tr>
897-
<td><dfn>loadFactor</dfn>
898-
<td>Number
908+
<td><dfn>loadFactor</dfn> : [=Decimal=]
909+
<td>String
899910
<td>O
900911
<td>
901912
Ratio of the mass of the actual load to the maximum legally authorized load of a particular vehicle on a TOC level.
@@ -904,8 +915,8 @@ The Data Type <{TOC}> has the following properties:
904915
The value of this property must be between `0` (excluding) and `1` (including).
905916

906917
<tr>
907-
<td><dfn>emptyDistanceFactor</dfn>
908-
<td>Number
918+
<td><dfn>emptyDistanceFactor</dfn> : [=Decimal=]
919+
<td>String
909920
<td>O
910921
<td>
911922
Ratio of the section of the route of a vehicle during which no freight is transported over the total distance (loaded plus empty distance) of a vehicle on a TOC level
@@ -1514,22 +1525,170 @@ The following properties are defined for data type <dfn element>Feedstock</dfn>:
15141525
</table>
15151526
</figure>
15161527

1517-
# Pathfinder Integration # {#pcf-mapping}
1528+
# HTTP REST API # {#http-rest-api}
15181529

1519-
The Data types defined in [[#data-model]] are specific to [[!ISO14083]] and the [[!GLEC]] Framework.
1520-
1521-
This chapter specifies the integration of the data types <{ShipmentFootprint}> and <{TOC}> into the Pathfinder Data Model ([[!PACTDX]] Chapter 4).
1522-
1523-
By doing so, the existing data exchange protocol ([[!PACTDX]] Network API (see Chapter 6) can be re-used for logistics emissions data exchange as well.
1530+
The exchange of logistics emissions data throught the [[#data-model]] presupposes the implementation of the HTTP REST API defined in [[!PACTDX]] (Chapter 6).
15241531

1525-
Such re-use simplifies the integration of logistics emissions data into existing [=host systems=] software, especially if they are already used by [=Transport Service Users=].
1532+
Reusing the [[!PACTDX]] data exchange protocol simplifies the integration of logistics emissions data into existing [=host systems=] software, especially if they are already used by [=Transport Service Users=].
15261533

15271534
They can then use 1 interoperable API for the exchange of different categories of carbon emissions data related to GHG Protocol lifecycle stages (such as material acquisition and transport).
15281535

15291536
Additionally, by mapping the GLEC Data model into the [[!PACTDX]] data model, existing [=host systems=] can be gradually extended to support calculation of logistics emissions in accordance with the [[!GLEC]] Framework and [[!ISO14083]].
15301537

1538+
A [=host system=] MUST implement:
1539+
1. The endpoint for the exchange of [=Transport Activity Data=] (see [[#action-tad]]); and
1540+
1. The exchange of <{ShipmentFootprint}> and <{TOC}> as specified in [[#pcf-mapping]].
1541+
1542+
## Action TransportActivityData ## {#action-tad}
1543+
1544+
Lists the [=data owner=]'s [=Transport Activity Data=] with [[#pagination]] and optional [[#filtering]]
1545+
1546+
A [=Host system=] SHOULD implement an access management system to return only the [=transport activity data=] intended for the requesting [=data recipient=].
1547+
1548+
### Filtering ### {#filtering}
1549+
1550+
Filtering CAN be requested by a [=data recipient=] by supplying a [=filter statement=] through the [=Filter=] request parameter.
1551+
1552+
Note: The filter statement syntax is described at the [=Filter=] request parameter.
1553+
1554+
If a [=host system=] does not implement filtering, it MUST process the request as if no [=Filter=] was provided.
1555+
1556+
If a [=host system=] implements filtering, it CAN process the filter statement on a best-effort basis:
1557+
1558+
1. it CAN ignore the filter statement or parts of the filter statement, or
1559+
1. it CAN return an error response as defined in the [Pathfinder Technical Specifications](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#api-error-responses).
1560+
For instance, a host system CAN return an error with code `NotImplemented` if it does not support a specific filter pair.
1561+
1. it CAN treat concatenated filters disjunctively, i.e., returning the union of the results of the individual filters.
1562+
1563+
1564+
### Pagination ### {#pagination}
1565+
1566+
[=Host systems=] MUST implement pagination server-side such that
1567+
1568+
1. The host system MAY return less [=Transport Activity Data=] than requested through the [=Limit=] request parameter
1569+
1. The host system MUST return a `Link` header if there is additional [=Transport Activity Data=] ready to be retrieved, such that
1570+
1. The `Link` header conforms to [[!RFC8288]]
1571+
1. The value of the `rel` parameter is equal to `next`
1572+
1. the target IRI (RFC8288, section 3.1) of the `Link` header is absolute
1573+
1. The value of `host` of the target IRI is equal to the value of the `host` request header from the original `TransportActivityData` HTTP request
1574+
1575+
The target IRI from a pagination `link` header is called a <dfn>pagination link</dfn>.
1576+
1577+
Upon a [=host system=] returning a [=pagination link=]
1578+
1579+
1. a data recipient CAN call the pagination link more than once
1580+
1. upon each call, the host system
1581+
1. MUST return the same Transport Activity Data upon successful authentication (i.e. a Bearer token authentication as defined in [[!PACTDX]] Section 6.3)
1582+
1. MUST NOT return more data than requested in case [=Limit=] was defined by a [=data recipient=]
1583+
1. MUST return a `Link` header conforming with the previous description in case there is additional Transport Activity Data available
1584+
1. If a response contains a second pagination link and the data recipient upon calling the second pagination link, the previous pagination link MAY no longer work
1585+
- i.e. data recipients MUST NOT assume that previous pagination links continue to return results after advancing in the pagination process
1586+
1. a pagination link MUST be valid for at least 180 seconds after creation
1587+
1. a data recipient SHOULD retry calling the pagination link after the server returned an error
1588+
1. and SHOULD use a randomized exponential back-off strategy when retrying
1589+
1590+
### Request Syntax ### {#action-tad-request}
1591+
1592+
<pre highlight=http>
1593+
GET <l>[=Subpath=]</l>/2/ileap/tad?<l>[=Filter=]</l>&<l>[=Limit=]</l> HTTP/1.1
1594+
host: <l>[=Hostname=]</l>
1595+
authorization: Bearer <l>[=BearerToken=]</l>
1596+
</pre>
1597+
1598+
: <dfn>Subpath</dfn>
1599+
:: If a host system uses a relative subpath, then the requesting data recipient MUST prepend this subpath.
1600+
1601+
: <dfn>Hostname</dfn>
1602+
:: The requesting data recipient MUST use the domain name of the host system.
1603+
1604+
: <dfn>BearerToken</dfn>
1605+
:: See [[!PACTDX]] section 6.3 Authentication Flow.
1606+
1607+
: <dfn>Filter</dfn>
1608+
::
1609+
`Filter` is an OPTIONAL request parameter containing a filter statement.
1610+
A <dfn>filter statement</dfn> is a list of name-value filter pairs.
1611+
Each filter pair has a `$name=$value` syntax where `$name` is the (case-sensitive) name
1612+
of the field to filter by, and `$value` the (case-insensitive) value to filter for.
1613+
Filter pairs CAN be concatenated with `&`.
15311614

1532-
## ServiceFootprint ## {#pcf-mapping-sf}
1615+
<div class=example>
1616+
Get transport activity data with [=Feedstock=] `"Fossil"` and <{TAD/packagingOrTrEqType}> `"Pallet"`
1617+
1618+
```http
1619+
GET /2/ileap/tad?feedstock=Fossil&packagingOrTrEqType=pallet HTTP/1.1
1620+
```
1621+
</div>
1622+
1623+
: <dfn>Limit</dfn>
1624+
::
1625+
`Limit` is an OPTIONAL request parameter. If defined,
1626+
1. the name of the HTTP request parameter MUST be `limit`
1627+
2. and the value MUST be a positive integer.
1628+
1629+
### Response Syntax ### {#action-tad-response}
1630+
1631+
Response without a `link` header:
1632+
1633+
<pre highlight=http>
1634+
HTTP/1.1 <l>[=TadStatusCode=]</l> <l>[=TadStatusText=]</l>
1635+
content-type: application/json
1636+
content-length: <l>[=ContentLength=]</l>
1637+
1638+
<l>[=TadResponseBody=]</l>
1639+
</pre>
1640+
1641+
1642+
Paginated response with a `link` header:
1643+
1644+
<pre highlight=http>
1645+
HTTP/1.1 <l>[=TadStatusCode=]</l> <l>[=TadStatusText=]</l>
1646+
content-type: application/json
1647+
content-length: <l>[=ContentLength=]</l>
1648+
link: <<l>[=PaginationLink=]</l>>; rel="next"
1649+
1650+
<l>[=TadResponseBody=]</l>
1651+
</pre>
1652+
1653+
1654+
1655+
With response parameters
1656+
1657+
: <dfn>TadStatusCode</dfn>
1658+
::
1659+
If the host system returns transport activity data, the `HttpStatusCode` MUST be 200.
1660+
1661+
If the host system responds with an error response, the `HttpStatusCode` MUST match the HTTP Status Code of the respective error response code, as defined in the [Pathfinder Technical Specifications](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#api-error-responsesm).
1662+
1663+
: <dfn>TadStatusText</dfn>
1664+
::
1665+
The HTTP Status text conforming to the HTTP status code [=TadStatusCode=].
1666+
1667+
: <dfn>TadResponseBody</dfn>
1668+
::
1669+
If the host system accepts the [=access token=], the body MUST be a JSON object with property `data` with value the list of [=Transport Activity Data=].
1670+
The list MUST be encoded as a JSON array.
1671+
1672+
If the host system does not accept the access token, the body MUST be an error response with code [AccessDenied](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#accessdenied).
1673+
1674+
If the host system does not accept the access token because it expired, the body SHOULD be an error response with code [TokenExpired](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#tokenexpired).
1675+
1676+
In all other cases, for instance in case of a malformed value of the header authorization, the body SHOULD be an error response with code [BadRequest](https://wbcsd.github.io/tr/2023/data-exchange-protocol-20231207/#badrequest).
1677+
1678+
: <dfn>ContentLength</dfn>
1679+
:: The length of the Body. See [[!rfc9112]].
1680+
1681+
: <dfn>PaginationLink</dfn>
1682+
:: see [=pagination link=] and [[#pagination]].
1683+
1684+
1685+
## Pathfinder Integration ## {#pcf-mapping}
1686+
1687+
The Data types defined in [[#data-model]] are specific to [[!ISO14083]] and the [[!GLEC]] Framework.
1688+
1689+
This section specifies the integration of the data types <{ShipmentFootprint}> and <{TOC}> into the Pathfinder Data Model ([[!PACTDX]] Chapter 4).
1690+
1691+
### ServiceFootprint ### {#pcf-mapping-sf}
15331692

15341693
Note: This chaper refers to the PACT Data Model. See [[!PACTDX]] Chapter 4 for further details.
15351694

@@ -1625,12 +1784,10 @@ Note: Chapter [[#appendix-a-sf-example]] contains an example.
16251784
<figcaption>Mapping of PACT Data Model properties to <{ShipmentFootprint}> properties</figcaption>
16261785
</figure>
16271786

1628-
## TOC ## {#pcf-mapping-toc}
1787+
### TOC ### {#pcf-mapping-toc}
16291788

16301789
Issue: this sections is still work in progress
16311790

1632-
1633-
16341791
# Appendix A: Example PCFs with iLEAP Data embedded # {#appendix-a}
16351792

16361793
## ShipmentFootprint example ## {#appendix-a-sf-example}

0 commit comments

Comments
 (0)