Macro lists
- 1 Description
- 2 Consult macro lists
- 3 Creation of a Macro List
- 4 Edit a Macro list
- 5 Execute a Macro List manually
- 6 Execute a Macro List automatically
- 7 Macro Reports
- 8 Type of Macros
- 8.1 Create a code
- 8.2 Associate shapes according stop areas
- 8.3 Associate shapes according code
- 8.4 Define Stop Areas compass bearing from Shapes
- 8.5 Create Referent Stop Areas
- 8.6 Associate Stop Areas with a Referent
- 8.7 Define postal address
- 8.8 Define Referent attribute from Particular value
- 8.9 Define Journey Pattern duration from passing time
- 8.10 Define Journey Pattern distances from Shapes
- 8.11 Delete all Vehicle Journeys
- 8.12 Update attribute from Referent
- 8.13 Compute Service Counts
- 8.14 Associate Documents
- 8.15 Create Code from UUID
- 8.16 Create Code from Sequence
Description
The use of macros in Chouette allows you to create, modify, associate or delete part of your data in your offer.
A macro is defined within a workbench. It consists of:
a list of sequenced instructions (instructions will be executed in the order you define)
contexts that can themselves contain a list of instructions.
A context allows you to filter the data you want to update.
Your instruction set will be represented as follows:
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 instructions.
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. Instructions 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 organize 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 processing rules https://enroute.atlassian.net/wiki/spaces/PUBLIC/pages/2049015809/R+gles+de+traitement#Gestion-des-R%C3%A8gles-de-traitement (English documentation to come).
A macro list can be launched automatically at the following stages :
after import
before finalization
after finalization
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 instruction “Create a code”, 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 according 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 according 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
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 instruction, 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 instruction.
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 instruction, 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.
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 instruction.
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 instruction 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:
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.
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 finalized 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.