Macro lists

Macro lists

Description

Macros in Chouette allow users to create, edit, associate or delete part of their data in their offer.

A macro is defined within a workbench. It consists of:

  • a list of sequenced macros (macros will be executed in the order you define)

  • contexts that can themselves contain a list of macros.

A context allows you to filter the data you want to update.

Your macro set will be represented as follows:

Blank diagram.png

A macro is available in a bank of macros that will be enriched as the product evolves https://enroute.atlassian.net/wiki/spaces/PUBLIC/pages/2011922433/Macro+lists#Type-of-Macros . This bank of macros can generally be customized to suit your context and goals.

Consult macro lists

You can view the macro lists created by your organisation in “Workbench” - “Macro Lists”.

This way, you can access all the macro lists defined in your Workbench.

For each macro list: name, comments and the time of update are displayed.

.

For each macro list, the star wheel allows you to launch the available actions:

  • show this macro list

  • edit this macro list

  • execute this macro

  • delete this macro list.

Creation of a Macro List

Add a new macro

By clicking on “Add a Macro List”, you access the editing form for a new macro list.

 

First, give a name to your Macro List. You can optionally add an indicative comment.

Then, in the “Macros” section, you can add different macros.

You can use macros with or without context. A context is used to filter the data to be processed by the macro. If no context is selected, the added macro will apply to all data in the target.

To add a macro without a context, simply leave the context field empty and open the macro list directly, select an macro, then press the “Add a new Macro” button.

The form opens, displaying fields with different parameters. Depending on the macro you've chosen, you'll need to fill in the information necessary for its execution.

Whatever macro you select, you will always be able to add a description of the goal of the macro and to add a comment:

You can add as many macros as you like, then click on the “Submit” button to finish creating your Macro list.

Add a context into a Macro List

You can use macro lists with or without context. A context allows you to filter the data to be updated.

To add an macro with a context, click on the first field and select a context from the list.

The available contexts are:

  • Transport mode

  • Saved Search

Then, click on the “Add a new Macro context” button.

 

You can add multiple macros to the same context. Macros placed under a specific context will be filtered according to it. For example, if you define the “Transport mode” context as “Bus”, macros will only process models linked to “Bus” and ignore all others.

Edit a Macro list

You can edit your Macro list at any time by clicking on the “Edit this Macro list” button.

When editing your Macro List, the star wheel allows you to duplicate or delete the selected macro or context.

If your Macro list contains several Macros, the cogwheel allows you to organise the order of your Macros. Thus, Macros in first position will be executed first, and so on.

Execute a Macro List manually

After creating your Macro List, you can execute it. Go to Macro List section and select “Execute this Macro List” on the star wheel.

A form opens, prompting you to name the report and select a target for execution.

After submitting the form, the Macro List is launched and you are redirected to a Macro List Report.

Execute a Macro List automatically

You can automate the launch of macro lists for your organization using https://enroute.atlassian.net/wiki/x/FAALt.

A macro list can be launched automatically at the following stages :

  • after import

  • before merge

  • after merge

Macro Reports

You can view the list of macro reports created by your organization in “Workbench” → “Macro reports”.

There you will find information about the process and the Macro List that was started :

  • the name of the Macro List Report

  • the name of the Macro List

  • the targeted referential, if there’s one selected

  • the status of Macro List execution (ongoing or successful)

In the “Macros” section, you will find a message and a link for each resource processed by the macro with its criticality (success, warning, or error).

Type of Macros

Create a code

With the “Create a code” macro, the user can create a code on the selected model (stop areas, lines, or vehicle journeys) from the value of another attribute (on another code in the same model or another attribute in the model).

When editing the macro, the user can set :

  • The target model: stop areas, lines, or vehicle journeys

  • The attribute or code that is used as source, i.e. from which the new code will be created.

  • The source pattern, when the value of the source code or attribute is used in part.

  • The target code space where the new code will be created.

  • The target pattern, when the source code or attribute must be modified to generate the new code

Associate shapes based on stop areas

The user can add the “Associate Shapes according stop areas” macro to the list.

Before executing this macro, you must make sure that you have imported or created shapes into Chouette.

When the macro is executed, a shape will be associated with a journey pattern if :

  • The journey pattern does not have an associated shape yet

  • All stops in the journey pattern are geographically close to the coordinates of the shape

  • The length of the shape is a short as possible for the stops. If two shapes are similar, Chouette will take the shorter shape in relation to the stop areas.

Associate shapes based on code

The user can add the “Associate Shapes according code” macro to the list.

Before executing this macro, you must make sure that you have imported or created shapes into Chouette.

When the macro is executed, a shape will be associated with a journey pattern if :

  • The journey pattern does not have an associated shape yet

  • The shape code value is equal to the journey pattern name

Create shapes

The user can generate shapes on the journey pattern of a target with the “Create shapes” macro.

When the macro is executed, a shape will be generated for each journey pattern that doesn't have one.

Define Stop Areas compass bearing from Shapes

The user can add the Macro “Define Stop Areas compass bearing from Shapes”.

When a stop area does not have a set compass bearing, it can be updated according to shapes of the journey pattern that serves this stop area.

When the stop area is served by several journey pattern, Chouette use average compass bearing of the shapes associated.

If a stop already has a compass bearing, it will not be change by the macro.

When executing the macro, you must choose a data set as the target. Only stops in this data set will be considered by the macro.

Create Referent Stop Areas

The user can use the macro “Create Referent Stop Area” to automatically create referent stops when there are two or more stops with very close coordinates and compass bearing. The tolerance is 15 m for position and 15 degrees (+/- 7,5°) on compass bearing.

The Referent Stop Area will be used in place of the stop areas it is associated with.

If a referent stop area already exists with the same criteria, it will not be created again by the macro.

The algorithm for creating a referent stop area in Chouette is based on several criteria. A stop will be created as a referent of other stops with :

  • the average position of all the stops grouped together

  • the average compass bearing of all grouped stops

  • the largest name of all the grouped stops

  • the same type of stop areas

Once the macro list is created, you can execute it.

If no target is selected, the macro will take into account all the stops in your referential.

To learn more about how to use Referent Stops, visit the Utilisation des référents page (English documentation to come).

Associate Stop Areas with a Referent

Users can use the “Associate Stop Areas with a referent” Macro to associate their stops with the referents they created and that have similar coordinates and orientations.

 

When executing this macro, there is no need to choose a target. The macro will process all the stop areas owned by your organisation.

Define postal address

Users can use the "Define postal address" macro to define the city and zip code of an object.

This macro can be executed on stop areas, entrances and points of interest:

These two attributes will be calculated according to the geographical coordinates and can be consulted in the stop areas referential:

This Macro requires a model with an existing geolocation.

Define Referent attribute from Particular value

The user can select the "Define Referent attribute from Particular value" macro to define the attribute of a Referent, based on the attributes provided by the particular stop areas.
The macro can be executed on stops or company.

To learn more about Referents, read the pages https://enroute.atlassian.net/wiki/spaces/PUBLICFR/pages/1938128907 (English translation to come) and https://enroute.atlassian.net/wiki/spaces/PUBLIC/pages/2004549633.

image-20250317-142755.png

For example, the user can define the zip code of the Referent stop areas using the zip codes provided by the particular stop areas.

Condition for defining the value:

  • If all the particulars in a given Referent provide the same value (ignoring Individuals with no value), this common value is used to define the Referent’s attribute.

  • If the attribute is already defined in the Referent's model, the current value is left unchanged by the macro.

  • If the Macro doesn't find a common value for Particulars, the Referent attribute remains unchanged.

Examples :

  • Referent Time Zone : Unknown
    Particular 1 Time Zone : Europe/Paris
    Particular 2 Time Zone : Europe/Paris
    ⇒ The Time Zone of the Referent is defined on Europe/Paris.

 

  • Referent Time Zone : Unknown
    Particular 1 Time Zone : Europe/Paris
    Particular 2 Time Zone : Unknown
    ⇒ The Time Zone of the Referent is defined on Europe/Paris.

 

  • Referent Time Zone : Unknown
    Particular 1 Time Zone : Europe/Paris
    Particular 2 Time Zone : Europe/Madrid
    ⇒ The Time Zone of the Referent remains unchanged.

Define Journey Pattern duration from passing time

The user can use the "Define Journey Pattern duration from passing time" macro to update the journey patterns based on the average duration between the arrival and departure times of the vehicle journeys.

When this macro is executed, a dataset must be selected as the target. The calculation will be performed only on the missions in the target dataset.

Define Journey Pattern distances from Shapes

The user can use the "Define Journey Pattern distances from Shapes" macro to update journey patterns according to the distance provided by the associated shapes.

When this Macro is executed, a dataset must be specified as the target.

Once the Macro has been executed, all missions must display distances:

image-20221220-080136.png

Delete all Vehicle Journeys

Users can use the "Delete all Vehicle Journeys" macro to clean up all the trips in a dataset.

When this Macro is executed, a dataset must be specified as the target. All vehicle journeys on this target will be automatically deleted.

All the vehicle journeys will be automatically deleted from this target. A message will be displayed with the number of deleted vehicle journeys:

Update attribute from Referent

Users can use the "Update attribute from Referent" macro to update the attributes of a particular stop area or company.

When this macro list is executed, Chouette will update the target model (stop area, company) by filling the selected attribute with values from the Referent.

If the referent has no values, the particulars are not updated. To rewrite the existing values of an particular's attributes, select the "Override existing value" option.

Compute Service Counts

Users can use the “Compute Service Counts” macro to update the service statistics for his offer, i.e. to calculate the number of Vehicle Journeys per Journey Pattern circulating each day.

Service statistics are automatically calculated at the end of the construction of a merged or aggregated offer.

Once this macro is executed, a new table will appear in your dataset page, marking the managed periods and the lack of offer.

Associate Documents

Users can automatically associate their documents with stop areas and lines. To do this, https://enroute.atlassian.net/wiki/spaces/PUBLIC/pages/2786328577 must first be created in the user's Workbench.

The Associate documents macro is used to associate a stop or a line with a document using its code in the chosen Code Space.

When this macro is executed, if the document and the stop/line have the same code, they will be automatically associated.

In the macro report, you'll find a descriptive message for each object processed.

Create Code from UUID

Users can automatically create a code in a specific format from the UUID of the selected model.

In the “Format” field, include the value %{value} in addition to the format you wish to apply to your code.

When the macro is executed, the codes will be automatically added to the targeted models. In the macro report, you'll find a descriptive message for each object processed.

Create Code from Sequence

Users can automatically create a code on a model from a defined sequence.

First, select an existing sequence in the parameters of the “Create code from sequence” macro:

When the macro is executed, Chouette will create the codes for the chosen target from the selected sequence. In the macro set report, you'll find a descriptive message for each object processed.

image-20240423-154709.png

 

Define Stop Area transport mode

The “Define Stop Area transport mode” macro automatically assigns Stop Areas' transport mode based on the lines.

If a Stop Area is associated to a Line in a data set, when the macro is executed, the Stop Area will automatically have the same transport mode as the line with which it is associated.

Force attribute value

A user can use the "Force attribute value" macro to automatically assign a value to a specific attribute.

Attributes that can be modified include :

  • The referent for lines, stop areas and companies.

  • City name for stops, companies, entry points and points of interest.

  • The transport mode for lines.

When this macro is run, the attribute value is automatically assigned.

After this macro is run, the selected attribute of the target model will be filled with the expected value chosen in the macro.

 

Define Route Name

The user can automatically define route names in a dataset using specific syntaxes. These syntaxes format the route names to be applied to the entire dataset.

  • %{direction} : adds route direction (outbound/return)

  • %{departure.name} : adds the name of the first stop area

  • %{arrival.name} : adds the name of the last stop area

When the macro is run, the routes in the target dataset will be renamed :

Associate Stop Areas with Fare Zones

Users can automatically associate their stop areas with the fare zones that are in their fare referential.

The macro matches a stop to a fare zone using the chosen attribute (country, zip code, city, postal region).

For the association to work, the geographic references of the fare zone must be filled out correctly:

Once the macro is executed, the stop area matching the geographic reference of the fare zone will be automatically associated:

Create Codes from Particulars

The user can copy the codes associated with a particular model to its referent. For example, copy a model from a stop area to its referent stop area.

The available models are :

  • Stop areas

  • Lines

  • Companies

The user can select the code space of the particular as well as the code space of the referent to which this code will be copied.

Adjust Timetable Periods

The user can add or subtract days from all the timetables in a dataset.

To do this, use the “Adjust Timetable periods” macro.

This macro must be run on a target dataset.

After completion, for each timetable processed, you will receive a message with the new timetable period end date.

This macro cannot be run on timetables whose periods are too short compared to the number of days to be subtracted.

 

Define Journey Pattern name or destination display

The user can automatically define Journey Pattern names and destinations in a dataset using specific syntaxes. These syntaxes allow mission names to be formatted and applied to an entire dataset in ready mode.

This pattern can include:

  • %{departure.name}: the name of the departure Stop Area

  • %{arrival.name}: the name of the last Stop Area

image-20250721-084324.png

Once the macro is executed, the Journey Patterns in the dataset will be renamed:

Remove codes

The user can remove all codes of a given Code Space on a target model :

image-20250721-085043.png

Once the macro is executed, the selected codes from the target model will be deleted: