# design rules tricc_oo
## Nodes
## Node Types and Properties
**Start Node**
This node type represents the beginning of a process. It requires a label and can have attributes like process, parent, and form_id.
**Activity Start Node**
Marking the start of an activity, this node type needs both a label and a name. It can have attributes such as parent and instance.
**Note Nodes**
This node type are used for providing information. Note nodes require both a label and a name,.
**Selection Nodes**
There are three types of selection nodes:
- Select One: For single-choice selections
- Select Multiple: For multiple-choice selections
- Select Yes/No: For binary choices
All these nodes require a label, name, and list_name. They can have attributes like required, save, filter, constraint, and constraint_message.
**Numeric Input Nodes**
Decimal and Integer nodes are used for numeric input. They require a label and name, and can have attributes like min, max, constraint, save, constraint_message, and required.
**Text and Date Nodes**
These nodes are for text input and date selection. Both require a label and name.
**Calculation Nodes**
Add, Count, and Calculate nodes are used for various calculations. They require a label and name, and can have save and expression attributes
**Flow Control Nodes**
Rhombus and Wait nodes are used for flow control. They require a reference, name, and label, and can have save and expression attributes.
**Exclusive Node**
This node type doesn't have any mandatory attributes or specific attributes defined.
**Not Available Node**
Used to indicate unavailability, this node requires a label, name, and list_name.
**Link Nodes**
Link Out and Link In nodes are used for creating connections. Link Out requires a reference, label, and name, while Link In only needs a label and name.
**Go To Node**
This node is used for navigation. It requires a link, label, and name, and can have an instance attribute.
**End Nodes**
End and Activity End nodes mark the conclusion of processes or activities.
**Bridge Node**
This node can have a label attribute but doesn't have any mandatory attributes.
**Diagnosis Node**
Used for diagnostic purposes, this node requires a name and label
### Enrichment
Node can be enriched with message and media, simply add the media on the draw.io andlink them with an edge
**Image Node**
Used to add image to a question
**Hint Message Node**
Used to add an hint message to a question, need a label
**Help Message Node**
Used to add an help message to a question, need a label
## Attributes
**expression**
replace the calcualte deducted by inputs
**default**
not supported yet
**save**
will create a calculate with the same name
- obs: observation: save the option as a calcualte obs_[name of the option]
- can be written obs.[othername].[snomedCode]
- diag: diagnostic/classification save the option as a calcualte diag_[name of the option]
- flag: calculate save the option as a calcualte is_[name of the option]
## Edges
The edge are in general labeless unless for :
- after a select multiple: can setup quick rhombus for the number of choice selected, an opperator is required (<>=) in the edge label
- after a yes/no quesiton: 'Yes', 'No', 'Follow' (translation can be added in the code )
- before a calculate to put weight: integer only
# notes
## advanced interpretation of the edges:
Activity instances: if there is more that 1 instance of a single actity then the 1+ activity will be displayed only if the previous one were not, to do that the GoTO node are replaced by a path and a rombhus, the path got to the activitvy and rhombus and the next node (if any) are attached to the rhombus that is use to wait that the activity
the node following an 1+ activity will be display after the activy OR instead of the activity
Select multiple: if followed by a calculate (rhombus included) the calculate will be equal to the number of selected option BUT opt_none
if not a calculate then relevance will be used unless it is "required" then condition will be at least 1 selection
the Rhombus act as an AND between its imputs and its reference BUT it is an OR beween the inputs
(input1 OR input2 OR input3) AND reference
## start nodes
### Main start
the flow required at least 1 main start node, but in case of cdss output strategy , several could be used given that they have a 'process' atrribute
here is the list of the CPG process, this will be the execution oder too:
- **registration**,
- **triage**,
- **emergency-care**,
- **local-urgent-care**,
- **actue-tertiary-care**,
- **history-and-physical**,
- **diagnostic-testing**,
- **determine-diagnosis**,
- **provide-counseling**,
- **dispense-medications**,
- **monitor-and-follow-up-of-patient**,
- **alerts-reminders-education**,
- **discharge-referral-of-patient**,
- **charge-for-service**,
- **record-and-report**
# READ Xressource
https://jgraph.github.io/drawio-tools/tools/convert.html
option can have only incoming edge from images to be placed as option$
# Note
## generation of the expressions
### add calcualte:
- Non or No in an egde will generate a negate node
- save adds a calcualte
- a rhombus will generate a calcualte using the reference (can you the label as a test, either with comparaisin or option selected with [option label])
### for calculate
Then we calculate based on the previous nodes: [get_prev_node_expression]
- if a "fake" calculate (Rhombus, exclusion) then get the underlying expression (should not depend of Calcualte = true) [get_calculation_terms]
- if a Select, manage it as a calculate too (should not depend of Calcualte = true) [get_calculation_terms]
- else get the expression via [get_calculation_terms] [get_prev_node_expression , calculate = False] -> get_node_expression for the prev node
# Running directly
`tricc` is technically a python library, but you can run it directly via the [`build.py` script](./tests/build.py).
## Running with Docker
Alternatively, if you prefer to build/run the project with Docker, you can do the following.
Start by building the Docker image:
```shell
git clone https://github.com/SwissTPH/tricc.git
cd tricc
docker build -t tricc .
```
Once you have the image built you can use it to convert local `.drawio` files by mapping the local directory to the `docker run` command. (Note that `--user` is specified to make sure the current host user has write access to the output files.)
```shell
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc --help
```
This command will convert all `.drawio` files in the current directory:
```shell
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj
```
You can also convert a single file:
```shell
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj/demo.drawio -o /proj
```
Use the `-O` flag to specify the output strategy. For example to generate CHT files:
```shell
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj -O XLSFormCHTStrategy
```
Raw data
{
"_id": null,
"home_page": null,
"name": "tricc-oo",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "xlsform, drawio, authoring",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f2/08/719c4adfb2ccb78b88c81f8579071d50009f6d605d5fabcad64e73128dd1/tricc_oo-1.5.18.tar.gz",
"platform": null,
"description": "# design rules tricc_oo\n\n## Nodes\n\n## Node Types and Properties\n\n**Start Node**\nThis node type represents the beginning of a process. It requires a label and can have attributes like process, parent, and form_id.\n\n**Activity Start Node**\nMarking the start of an activity, this node type needs both a label and a name. It can have attributes such as parent and instance.\n\n**Note Nodes**\nThis node type are used for providing information. Note nodes require both a label and a name,.\n\n**Selection Nodes**\nThere are three types of selection nodes:\n- Select One: For single-choice selections\n- Select Multiple: For multiple-choice selections\n- Select Yes/No: For binary choices\n\nAll these nodes require a label, name, and list_name. They can have attributes like required, save, filter, constraint, and constraint_message.\n\n**Numeric Input Nodes**\nDecimal and Integer nodes are used for numeric input. They require a label and name, and can have attributes like min, max, constraint, save, constraint_message, and required. \n\n**Text and Date Nodes**\nThese nodes are for text input and date selection. Both require a label and name.\n\n**Calculation Nodes**\nAdd, Count, and Calculate nodes are used for various calculations. They require a label and name, and can have save and expression attributes\n\n**Flow Control Nodes**\nRhombus and Wait nodes are used for flow control. They require a reference, name, and label, and can have save and expression attributes. \n\n**Exclusive Node**\nThis node type doesn't have any mandatory attributes or specific attributes defined.\n\n**Not Available Node**\nUsed to indicate unavailability, this node requires a label, name, and list_name.\n\n**Link Nodes**\nLink Out and Link In nodes are used for creating connections. Link Out requires a reference, label, and name, while Link In only needs a label and name. \n\n**Go To Node**\nThis node is used for navigation. It requires a link, label, and name, and can have an instance attribute. \n\n**End Nodes**\nEnd and Activity End nodes mark the conclusion of processes or activities.\n\n**Bridge Node**\nThis node can have a label attribute but doesn't have any mandatory attributes. \n\n**Diagnosis Node**\nUsed for diagnostic purposes, this node requires a name and label\n\n### Enrichment\n\nNode can be enriched with message and media, simply add the media on the draw.io andlink them with an edge\n\n**Image Node**\nUsed to add image to a question\n\n**Hint Message Node**\nUsed to add an hint message to a question, need a label\n\n**Help Message Node**\nUsed to add an help message to a question, need a label\n\n## Attributes\n\n**expression**\nreplace the calcualte deducted by inputs\n\n**default**\nnot supported yet\n\n**save**\nwill create a calculate with the same name\n- obs: observation: save the option as a calcualte obs_[name of the option]\n - can be written obs.[othername].[snomedCode]\n- diag: diagnostic/classification save the option as a calcualte diag_[name of the option]\n- flag: calculate save the option as a calcualte is_[name of the option]\n\n\n## Edges\n\nThe edge are in general labeless unless for :\n - after a select multiple: can setup quick rhombus for the number of choice selected, an opperator is required (<>=) in the edge label\n - after a yes/no quesiton: 'Yes', 'No', 'Follow' (translation can be added in the code )\n - before a calculate to put weight: integer only\n\n\n# notes\n\n## advanced interpretation of the edges:\n\nActivity instances: if there is more that 1 instance of a single actity then the 1+ activity will be displayed only if the previous one were not, to do that the GoTO node are replaced by a path and a rombhus, the path got to the activitvy and rhombus and the next node (if any) are attached to the rhombus that is use to wait that the activity\n\nthe node following an 1+ activity will be display after the activy OR instead of the activity\n\nSelect multiple: if followed by a calculate (rhombus included) the calculate will be equal to the number of selected option BUT opt_none\nif not a calculate then relevance will be used unless it is \"required\" then condition will be at least 1 selection\n\nthe Rhombus act as an AND between its imputs and its reference BUT it is an OR beween the inputs\n(input1 OR input2 OR input3) AND reference\n\n## start nodes\n\n### Main start\n\nthe flow required at least 1 main start node, but in case of cdss output strategy , several could be used given that they have a 'process' atrribute\n\nhere is the list of the CPG process, this will be the execution oder too:\n- **registration**,\n- **triage**,\n- **emergency-care**,\n- **local-urgent-care**,\n- **actue-tertiary-care**,\n- **history-and-physical**,\n- **diagnostic-testing**,\n- **determine-diagnosis**,\n- **provide-counseling**,\n- **dispense-medications**,\n- **monitor-and-follow-up-of-patient**,\n- **alerts-reminders-education**,\n- **discharge-referral-of-patient**,\n- **charge-for-service**,\n- **record-and-report** \n\t\n\t\n# READ Xressource\nhttps://jgraph.github.io/drawio-tools/tools/convert.html\n\noption can have only incoming edge from images to be placed as option$\n\n\n# Note\n\n## generation of the expressions \n\n### add calcualte:\n\n - Non or No in an egde will generate a negate node\n - save adds a calcualte\n - a rhombus will generate a calcualte using the reference (can you the label as a test, either with comparaisin or option selected with [option label])\n\n### for calculate \n \nThen we calculate based on the previous nodes: [get_prev_node_expression]\n - if a \"fake\" calculate (Rhombus, exclusion) then get the underlying expression (should not depend of Calcualte = true) [get_calculation_terms]\n - if a Select, manage it as a calculate too (should not depend of Calcualte = true) [get_calculation_terms]\n - else get the expression via [get_calculation_terms] [get_prev_node_expression , calculate = False] -> get_node_expression for the prev node\n\n# Running directly\n\n`tricc` is technically a python library, but you can run it directly via the [`build.py` script](./tests/build.py).\n\n## Running with Docker\n\nAlternatively, if you prefer to build/run the project with Docker, you can do the following.\n\nStart by building the Docker image:\n\n```shell\ngit clone https://github.com/SwissTPH/tricc.git\ncd tricc\n\ndocker build -t tricc .\n```\n\nOnce you have the image built you can use it to convert local `.drawio` files by mapping the local directory to the `docker run` command. (Note that `--user` is specified to make sure the current host user has write access to the output files.)\n\n```shell\ndocker run --rm -v \"$PWD\":/proj --user $(id -u):$(id -g) tricc --help\n```\n\nThis command will convert all `.drawio` files in the current directory:\n\n```shell\ndocker run --rm -v \"$PWD\":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj\n```\n\nYou can also convert a single file:\n\n```shell\ndocker run --rm -v \"$PWD\":/proj --user $(id -u):$(id -g) tricc -i /proj/demo.drawio -o /proj\n```\n\nUse the `-O` flag to specify the output strategy. For example to generate CHT files:\n\n```shell\ndocker run --rm -v \"$PWD\":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj -O XLSFormCHTStrategy\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Python library that converts CDSS L2 in L3",
"version": "1.5.18",
"project_urls": {
"Homepage": "https://github.com/SwissTPH/tricc",
"Issues": "https://github.com/SwissTPH/tricc/issues"
},
"split_keywords": [
"xlsform",
" drawio",
" authoring"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e383ae2b32dfe3851751af4adf3ae8c56aac446427bdfd3445df7c15694d314f",
"md5": "21aca95ebf9ce9fccc2246edea082c44",
"sha256": "213af107d3826bfda31f6b40afe23cd154518f06e988cbd28841697d1e084221"
},
"downloads": -1,
"filename": "tricc_oo-1.5.18-py3-none-any.whl",
"has_sig": false,
"md5_digest": "21aca95ebf9ce9fccc2246edea082c44",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 155397,
"upload_time": "2025-07-13T10:26:33",
"upload_time_iso_8601": "2025-07-13T10:26:33.256590Z",
"url": "https://files.pythonhosted.org/packages/e3/83/ae2b32dfe3851751af4adf3ae8c56aac446427bdfd3445df7c15694d314f/tricc_oo-1.5.18-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f208719c4adfb2ccb78b88c81f8579071d50009f6d605d5fabcad64e73128dd1",
"md5": "ae21c58867ddbd2d730b8403fc3854f0",
"sha256": "17d3726b39e266127cdd53b896a39cb9f88fd125a61bef6d59557072d37afb88"
},
"downloads": -1,
"filename": "tricc_oo-1.5.18.tar.gz",
"has_sig": false,
"md5_digest": "ae21c58867ddbd2d730b8403fc3854f0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 145782,
"upload_time": "2025-07-13T10:26:35",
"upload_time_iso_8601": "2025-07-13T10:26:35.206719Z",
"url": "https://files.pythonhosted.org/packages/f2/08/719c4adfb2ccb78b88c81f8579071d50009f6d605d5fabcad64e73128dd1/tricc_oo-1.5.18.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-13 10:26:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SwissTPH",
"github_project": "tricc",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "annotated-types",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "build",
"specs": [
[
"==",
"1.2.1"
]
]
},
{
"name": "CacheControl",
"specs": [
[
"==",
"0.14.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.7.4"
]
]
},
{
"name": "cffi",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.2"
]
]
},
{
"name": "cleo",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "crashtest",
"specs": [
[
"==",
"0.4.1"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"42.0.8"
]
]
},
{
"name": "distlib",
"specs": [
[
"==",
"0.3.8"
]
]
},
{
"name": "dulwich",
"specs": [
[
"==",
"0.21.7"
]
]
},
{
"name": "fastjsonschema",
"specs": [
[
"==",
"2.20.0"
]
]
},
{
"name": "filelock",
"specs": [
[
"==",
"3.15.4"
]
]
},
{
"name": "html2text",
"specs": [
[
"==",
"2024.2.26"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.7"
]
]
},
{
"name": "importlib_metadata",
"specs": [
[
"==",
"8.0.0"
]
]
},
{
"name": "installer",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "jaraco.classes",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "jeepney",
"specs": [
[
"==",
"0.8.0"
]
]
},
{
"name": "keyring",
"specs": [
[
"==",
"24.3.1"
]
]
},
{
"name": "lxml",
"specs": [
[
"==",
"5.2.2"
]
]
},
{
"name": "more-itertools",
"specs": [
[
"==",
"10.3.0"
]
]
},
{
"name": "msgpack",
"specs": [
[
"==",
"1.0.8"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.1"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"2.2.2"
]
]
},
{
"name": "pexpect",
"specs": [
[
"==",
"4.9.0"
]
]
},
{
"name": "pkginfo",
"specs": [
[
"==",
"1.11.1"
]
]
},
{
"name": "platformdirs",
"specs": [
[
"==",
"4.2.2"
]
]
},
{
"name": "poetry",
"specs": [
[
"==",
"1.8.3"
]
]
},
{
"name": "poetry-core",
"specs": [
[
"==",
"1.9.0"
]
]
},
{
"name": "poetry-plugin-export",
"specs": [
[
"==",
"1.8.0"
]
]
},
{
"name": "polib",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "ptyprocess",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "pycparser",
"specs": [
[
"==",
"2.22"
]
]
},
{
"name": "pydantic",
"specs": [
[
"==",
"2.8.2"
]
]
},
{
"name": "pydantic_core",
"specs": [
[
"==",
"2.20.1"
]
]
},
{
"name": "pyproject_hooks",
"specs": [
[
"==",
"1.1.0"
]
]
},
{
"name": "python-dateutil",
"specs": [
[
"==",
"2.9.0.post0"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2024.1"
]
]
},
{
"name": "rapidfuzz",
"specs": [
[
"==",
"3.9.4"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "requests-toolbelt",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "SecretStorage",
"specs": [
[
"==",
"3.3.3"
]
]
},
{
"name": "shellingham",
"specs": [
[
"==",
"1.5.4"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "StrEnum",
"specs": [
[
"==",
"0.4.15"
]
]
},
{
"name": "tomli",
"specs": [
[
"==",
"2.0.1"
]
]
},
{
"name": "tomlkit",
"specs": [
[
"==",
"0.13.0"
]
]
},
{
"name": "trove-classifiers",
"specs": [
[
"==",
"2024.7.2"
]
]
},
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.12.2"
]
]
},
{
"name": "tzdata",
"specs": [
[
"==",
"2024.1"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.2"
]
]
},
{
"name": "virtualenv",
"specs": [
[
"==",
"20.26.3"
]
]
},
{
"name": "XlsxWriter",
"specs": [
[
"==",
"3.2.0"
]
]
},
{
"name": "zipp",
"specs": [
[
"==",
"3.19.2"
]
]
}
],
"lcname": "tricc-oo"
}