Improved markdown generation, updated besser example
Browse files- besser_example.json +1 -1
- markdownGenerator.py +273 -35
- sdc_view.py +3 -3
besser_example.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"master_title": "Besser", "master_desc": "
|
|
|
|
| 1 |
+
{"master_title": "Besser", "master_desc": "BESSER (Better Software Faster) is a powerful low-code platform designed to streamline software development. Built on B-UML, our Python-based interpretation of a \"Universal Modeling Language\"\u2014inspired by and simplified from UML\u2014BESSER enables users to specify software applications efficiently. With B-UML, developers can define their application models and leverage built-in code generators to produce executable code for various frameworks, including Django models and SQLAlchemy-compatible database structures.", "governance_govProcesses": ["", ""], "governance_bodies": ["", ""], "usageContext_description": "Besser is inteded to be used by a broad community of app developers without the need of having coding skills.", "usageContext_targetCommunity": [""], "usageContext_adaptation": [""], "participants": ["", ""], "governance_projectType": ["public funded"], "governance_govProcesses_0": "BESSER is funded by the Luxembourg National Research Fund (FNR), the country\u2019s main agency for funding research across all scientific fields.", "governance_govProcesses_1": "The project is led by the recipient of the funds, its Principal Investigator.", "governance_bodies_0_name": "Funding programmes of the Luxembourg National Research Fund", "governance_bodies_0_description": "The Luxembourg National Research Fund (FNR, in French) is the main funding body for research in Luxembourg. The institution invests public funds and private donations into research projects in various branches of sciences and the humanities, with an emphasis on core strategic areas\n", "governance_bodies_0_participant_name": "", "governance_bodies_0_participant_location": "", "governance_bodies_0_participant_workdplace": "Presential", "governance_bodies_0_participant_ethincity": "", "governance_bodies_0_participant_gender": "", "governance_bodies_0_participant_disabilities": "", "governance_bodies_0_participant_sexualOrientation": "", "governance_bodies_0_participant_religion": "", "governance_bodies_0_organization_name": "Luxembourg\u2019s National Research Fund (FNR)", "governance_bodies_0_organization_age": [0, 99], "governance_bodies_0_organization_location": "Esch-sur-Alzette, Luxemburg", "governance_bodies_0_organization_workplace": "Presential", "governance_bodies_0_organization_ethnicities": "", "governance_bodies_0_organization_genders": "", "governance_bodies_0_organization_disabilities": "", "governance_bodies_0_organization_religious": "", "governance_bodies_0_type": ["funders"], "governance_bodies_1_name": "Principal Investigator", "governance_bodies_1_description": "The Principal investigator who is the recipients of the funds lead the project.", "governance_bodies_1_participant_name": "Jordi Cabot", "governance_bodies_1_participant_location": "", "governance_bodies_1_participant_workdplace": "Presential", "governance_bodies_1_participant_ethincity": "", "governance_bodies_1_participant_gender": "", "governance_bodies_1_participant_disabilities": "", "governance_bodies_1_participant_sexualOrientation": "", "governance_bodies_1_participant_religion": "", "governance_bodies_1_organization_name": "", "governance_bodies_1_organization_age": [10, 20], "governance_bodies_1_organization_location": "", "governance_bodies_1_organization_workplace": "Presential", "governance_bodies_1_organization_ethnicities": "", "governance_bodies_1_organization_genders": "", "governance_bodies_1_organization_disabilities": "", "governance_bodies_1_organization_religious": "", "governance_bodies_1_type": ["directors"], "governance_bodies_0_participant_age": 0, "governance_bodies_1_participant_age": 0, "usageContext_countries": ["France", "Luxembourg"], "usageContext_languages": ["French", "English"], "usageContext_targetCommunity_0_name": "Teacher and student of computer science", "usageContext_targetCommunity_0_description": "Teacher and student of computer science", "usageContext_targetCommunity_0_age": [18, 70], "usageContext_targetCommunity_0_location": "Luxembourg University", "usageContext_targetCommunity_0_workplace": "Presential", "usageContext_targetCommunity_0_ethnicities": "", "usageContext_targetCommunity_0_genders": "", "usageContext_targetCommunity_0_disabilities": "", "usageContext_targetCommunity_0_religious": "", "usageContext_targetCommunity_0_countries": ["Luxembourg"], "usageContext_targetCommunity_0_edlevel": ["bachelorEquivalent", "doctorateEquivalent"], "usageContext_targetCommunity_0_skills": ["beginner", "competent"], "usageContext_targetCommunity_0_languages": ["French"], "usageContext_adaptation_0_name": "Computer Science Teachers", "usageContext_adaptation_0_description": "The software have been adapted for its specific use in educational environments", "participants_0_name": "Development team", "participants_0_description": "The development team of Besser is composed of a geographical diversity team based on Luxemboug.", "participants_0_size": 16, "participants_0_age": [24, 45], "participants_0_location": "Esch-sur-Alzette, Luxemburg", "participants_0_workplace": "Presential", "participants_0_ethnicities": "Colombian,Brasilian, Argentinian, French ,Spanish, Pakistani, Serbian, Iranian, Morroco, Italian", "participants_0_genders": "80% male, 20% famela", "participants_0_disabilities": "", "participants_0_religious": "", "participants_0_type": ["Development Team"], "participants_0_countries": ["Colombia", "Spain", "Pakistan", "Iran,IslamicRepublicof", "Argentina", "Brazil", "Serbia"], "participants_0_edlevel": ["masterEquivalent", "doctorateEquivalent"], "participants_0_skills": ["proficient", "advanced"], "participants_0_languages": ["Spanish-Castilian", "Catalan-Valencian", "English", "French"], "participants_1_name": "Usability test team", "participants_1_description": "An usability test team have been conducted with a crowd of users. Tester are student of the computer science degree at the Luxembourg University. Using the backend generator from scratch with the documentation of BESSER (with a given PlantUML, library model)\\n Using ChatGPT4o only giving the PlantUML model and no hand coding", "participants_1_size": 0, "participants_1_age": [22, 24], "participants_1_location": "University of Luxembourg", "participants_1_workplace": "Presential", "participants_1_ethnicities": "", "participants_1_genders": "", "participants_1_disabilities": "", "participants_1_religious": "", "participants_1_type": ["Tester Team"], "participants_1_countries": ["Luxembourg"], "participants_1_skills": ["beginner", "competent"], "participants_1_languages": ["Luxembourgish-Letzeburgesch"]}
|
markdownGenerator.py
CHANGED
|
@@ -1,8 +1,14 @@
|
|
| 1 |
def generate_markdown(state):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
html_str= f"""
|
| 3 |
# The Software diversity card of {state["master"]["title"]}
|
| 4 |
{state["master"]["desc"]}
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
<table>
|
| 8 |
<tr>
|
|
@@ -10,13 +16,12 @@ def generate_markdown(state):
|
|
| 10 |
<th>Description</th>
|
| 11 |
<th>Type</th>
|
| 12 |
<th>Age Range</th>
|
| 13 |
-
<th>Ethnicities</th>
|
| 14 |
-
<th>Genders</th>
|
| 15 |
<th>Team Size</th>
|
| 16 |
<th>Location</th>
|
| 17 |
</tr>"""
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 20 |
for key, participant in state['participants'].items():
|
| 21 |
if participant['name']:
|
| 22 |
description = participant['description'].replace('\\n', '')
|
|
@@ -32,28 +37,27 @@ def generate_markdown(state):
|
|
| 32 |
|
| 33 |
html_str = html_str + f"""
|
| 34 |
<td>{participant['age'][0]}-{participant['age'][1]}</td>
|
| 35 |
-
<td>{participant['ethnicities']}</td>
|
| 36 |
-
<td>{participant['genders']}</td>
|
| 37 |
<td>{participant['size']}</td>
|
| 38 |
<td>{participant['location']}</td>
|
| 39 |
</tr>"""
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
<tr>
|
| 45 |
-
<td><strong>{
|
| 46 |
<td>{description}</td>
|
| 47 |
<td> Targeted Community </td>
|
| 48 |
-
<td>{
|
| 49 |
-
<td>{state['socialContext']['targetCommunity']['ethnicities']}</td>
|
| 50 |
-
<td>{state['socialContext']['targetCommunity']['genders']}</td>
|
| 51 |
<td> many </td>
|
| 52 |
-
<td>{
|
| 53 |
</tr>"""
|
| 54 |
## If bodies add
|
| 55 |
if 'governance' in state:
|
| 56 |
-
if 'bodies' in state['governance']:
|
| 57 |
for key, body in state['governance']["bodies"].items():
|
| 58 |
if body['name']:
|
| 59 |
description = body['description'].replace('\\n', '')
|
|
@@ -65,26 +69,260 @@ def generate_markdown(state):
|
|
| 65 |
html_str = html_str + f"""<td>{body['type'][0]}</td>"""
|
| 66 |
else:
|
| 67 |
html_str = html_str + f"""<td> </td>"""
|
| 68 |
-
if
|
| 69 |
-
|
| 70 |
-
<td>{body['organization']['age'][0]}-{body['organization']['age'][1]}</td>
|
| 71 |
-
<td>{body['organization']['ethnicities']}</td>
|
| 72 |
-
<td>{body['organization']['genders']}</td>
|
| 73 |
-
<td> - </td>
|
| 74 |
-
<td>{body['organization']['location']}</td>
|
| 75 |
-
</tr>"""
|
| 76 |
-
|
| 77 |
-
if body['participant']['name']:
|
| 78 |
html_str = html_str + f"""
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
## End summary
|
| 87 |
html_str = html_str + f" </table>"
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def generate_markdown(state):
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
###############################
|
| 5 |
+
## Start Summary
|
| 6 |
+
###############################
|
| 7 |
html_str= f"""
|
| 8 |
# The Software diversity card of {state["master"]["title"]}
|
| 9 |
{state["master"]["desc"]}
|
| 10 |
+
|
| 11 |
+
## :busts_in_silhouette: Teams Summary
|
| 12 |
|
| 13 |
<table>
|
| 14 |
<tr>
|
|
|
|
| 16 |
<th>Description</th>
|
| 17 |
<th>Type</th>
|
| 18 |
<th>Age Range</th>
|
|
|
|
|
|
|
| 19 |
<th>Team Size</th>
|
| 20 |
<th>Location</th>
|
| 21 |
</tr>"""
|
| 22 |
+
|
| 23 |
+
## Participants
|
| 24 |
+
if 'participants' in state and isinstance(state['participants'], dict):
|
| 25 |
for key, participant in state['participants'].items():
|
| 26 |
if participant['name']:
|
| 27 |
description = participant['description'].replace('\\n', '')
|
|
|
|
| 37 |
|
| 38 |
html_str = html_str + f"""
|
| 39 |
<td>{participant['age'][0]}-{participant['age'][1]}</td>
|
|
|
|
|
|
|
| 40 |
<td>{participant['size']}</td>
|
| 41 |
<td>{participant['location']}</td>
|
| 42 |
</tr>"""
|
| 43 |
+
|
| 44 |
+
## If target Communities add it
|
| 45 |
+
if 'targetCommunity' in state['usageContext'] and isinstance(state['usageContext']['targetCommunity'], dict):
|
| 46 |
+
for key, targetCommunity in state['usageContext']['targetCommunity'].items():
|
| 47 |
+
if targetCommunity['name']:
|
| 48 |
+
description = targetCommunity['description'].replace('\\n', '')
|
| 49 |
+
html_str = html_str + f"""
|
| 50 |
<tr>
|
| 51 |
+
<td><strong>{targetCommunity['name']}</strong></td>
|
| 52 |
<td>{description}</td>
|
| 53 |
<td> Targeted Community </td>
|
| 54 |
+
<td>{targetCommunity['age'][0]}-{targetCommunity['age'][1]}</td>
|
|
|
|
|
|
|
| 55 |
<td> many </td>
|
| 56 |
+
<td>{targetCommunity['location']}</td>
|
| 57 |
</tr>"""
|
| 58 |
## If bodies add
|
| 59 |
if 'governance' in state:
|
| 60 |
+
if 'bodies' in state['governance'] and isinstance(state['governance']['bodies'], dict):
|
| 61 |
for key, body in state['governance']["bodies"].items():
|
| 62 |
if body['name']:
|
| 63 |
description = body['description'].replace('\\n', '')
|
|
|
|
| 69 |
html_str = html_str + f"""<td>{body['type'][0]}</td>"""
|
| 70 |
else:
|
| 71 |
html_str = html_str + f"""<td> </td>"""
|
| 72 |
+
if 'organization' in body:
|
| 73 |
+
if body['organization']['name']:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
html_str = html_str + f"""
|
| 75 |
+
<td>{body['organization']['age'][0]}-{body['organization']['age'][1]}</td>
|
| 76 |
+
<td> - </td>
|
| 77 |
+
<td>{body['organization']['location']}</td>
|
| 78 |
+
</tr>"""
|
| 79 |
+
if 'participant' in body:
|
| 80 |
+
if body['participant']['name']:
|
| 81 |
+
html_str = html_str + f"""
|
| 82 |
+
<td>{body['participant']['age']}</td>
|
| 83 |
+
<td> - </td>
|
| 84 |
+
<td>{body['participant']['location']}</td>
|
| 85 |
+
</tr>"""
|
| 86 |
|
| 87 |
## End summary
|
| 88 |
html_str = html_str + f" </table>"
|
| 89 |
|
| 90 |
+
###############################
|
| 91 |
+
## Start Governance
|
| 92 |
+
###############################
|
| 93 |
+
html_str = html_str + f"""
|
| 94 |
+
|
| 95 |
+
## 🏢 Governance
|
| 96 |
+
|
| 97 |
+
"""
|
| 98 |
+
if 'governance' in state:
|
| 99 |
+
if 'govProcesses' in state['governance'] and isinstance(state['governance']['govProcesses'], dict):
|
| 100 |
+
for key, text in state['governance']["govProcesses"].items():
|
| 101 |
+
html_str = html_str + f"""
|
| 102 |
+
### Governance processes
|
| 103 |
+
|
| 104 |
+
**Process**: {text}
|
| 105 |
+
"""
|
| 106 |
+
if 'projectType' in state['governance']:
|
| 107 |
+
html_str = html_str + f"""
|
| 108 |
+
|
| 109 |
+
**Type:** {pretty_list(state['governance']['projectType'])}
|
| 110 |
+
"""
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
if 'bodies' in state['governance'] and isinstance(state['governance']['bodies'], dict):
|
| 114 |
+
for key, body in state['governance']["bodies"].items():
|
| 115 |
+
if body['name']:
|
| 116 |
+
description = body['description'].replace('\\n', '')
|
| 117 |
+
html_str = html_str + f"""
|
| 118 |
+
|
| 119 |
+
#### **{body['name']}**
|
| 120 |
+
|
| 121 |
+
**Description:** {description}
|
| 122 |
+
|
| 123 |
+
"""
|
| 124 |
+
if 'type' in body:
|
| 125 |
+
html_str = html_str + f"""
|
| 126 |
+
**Type:** {body['type'][0]}
|
| 127 |
+
|
| 128 |
+
"""
|
| 129 |
+
if body['organization']['name']:
|
| 130 |
+
html_str = html_str + f"""
|
| 131 |
+
**Organization:** {body['organization']['name']}
|
| 132 |
+
"""
|
| 133 |
+
if body['organization']['location']:
|
| 134 |
+
html_str = html_str + f"""
|
| 135 |
+
**Location:** {body['organization']['location']}
|
| 136 |
+
|
| 137 |
+
"""
|
| 138 |
+
if body['organization']['age']:
|
| 139 |
+
html_str = html_str + f"""
|
| 140 |
+
**Age range:** {body['organization']['age'][0]}-{body['organization']['age'][1]}
|
| 141 |
+
|
| 142 |
+
"""
|
| 143 |
+
if body['organization']['ethnicities']:
|
| 144 |
+
html_str = html_str + f"""
|
| 145 |
+
**Ethnicities:** {body['organization']['ethnicities']}
|
| 146 |
+
"""
|
| 147 |
+
if body['organization']['genders']:
|
| 148 |
+
html_str = html_str + f"""
|
| 149 |
+
|
| 150 |
+
**Genders:** {body['organization']['genders']}
|
| 151 |
+
|
| 152 |
+
"""
|
| 153 |
+
if 'languages' in body['organization']:
|
| 154 |
+
html_str = html_str + f"""
|
| 155 |
+
**Languages:** {pretty_list(body['organization']['languages'])}
|
| 156 |
+
|
| 157 |
+
"""
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
if body['participant']['name']:
|
| 161 |
+
html_str = html_str + f"""
|
| 162 |
+
**Organization:** {body['participant']['name']}
|
| 163 |
+
"""
|
| 164 |
+
if body['participant']['location']:
|
| 165 |
+
html_str = html_str + f"""
|
| 166 |
+
**Location:** {body['participant']['location']}
|
| 167 |
+
|
| 168 |
+
"""
|
| 169 |
+
if body['participant']['age']:
|
| 170 |
+
html_str = html_str + f"""
|
| 171 |
+
**Age range:** {body['participant']['age']}
|
| 172 |
+
|
| 173 |
+
"""
|
| 174 |
+
if body['participant']['ethincity']:
|
| 175 |
+
html_str = html_str + f"""
|
| 176 |
+
**Ethnicities:** {body['participant']['ethincity']}
|
| 177 |
+
|
| 178 |
+
"""
|
| 179 |
+
if body['participant']['gender']:
|
| 180 |
+
html_str = html_str + f"""
|
| 181 |
+
**Genders:** {body['participant']['gender']}
|
| 182 |
+
|
| 183 |
+
"""
|
| 184 |
+
if 'languages' in body['participant']:
|
| 185 |
+
html_str = html_str + f"""
|
| 186 |
+
** Languages: ** {pretty_list(body['participant']['languages'])}
|
| 187 |
+
|
| 188 |
+
"""
|
| 189 |
+
|
| 190 |
+
###############################
|
| 191 |
+
## Start Usage Context
|
| 192 |
+
###############################
|
| 193 |
+
if 'usageContext' in state:
|
| 194 |
+
html_str = html_str + f"""
|
| 195 |
+
|
| 196 |
+
## :twisted_rightwards_arrows: Usage Context
|
| 197 |
+
|
| 198 |
+
"""
|
| 199 |
+
if 'description' in state['usageContext']:
|
| 200 |
+
html_str = html_str + f"""
|
| 201 |
+
|
| 202 |
+
**Description:** {state['usageContext']['description']}
|
| 203 |
+
|
| 204 |
+
"""
|
| 205 |
+
if 'countries' in state['usageContext']:
|
| 206 |
+
html_str = html_str + f"""
|
| 207 |
+
**Countries:** {pretty_list(state['usageContext']['countries'])}
|
| 208 |
+
|
| 209 |
+
"""
|
| 210 |
+
if 'languages' in state['usageContext']:
|
| 211 |
+
html_str = html_str + f"""
|
| 212 |
+
**Languages:** {pretty_list(state['usageContext']['languages'])}
|
| 213 |
+
|
| 214 |
+
"""
|
| 215 |
+
if 'targetCommunity' in state['usageContext'] and isinstance(state['usageContext']['targetCommunity'], dict):
|
| 216 |
+
for key, targetCommunity in state['usageContext']['targetCommunity'].items():
|
| 217 |
+
|
| 218 |
+
if 'name' in targetCommunity:
|
| 219 |
+
html_str = html_str + f"""
|
| 220 |
+
#### Target Community: {targetCommunity['name']}
|
| 221 |
+
|
| 222 |
+
"""
|
| 223 |
+
if 'description' in targetCommunity:
|
| 224 |
+
html_str = html_str + f"""
|
| 225 |
+
**Description:** {targetCommunity['description']}
|
| 226 |
+
|
| 227 |
+
"""
|
| 228 |
+
if 'age' in targetCommunity:
|
| 229 |
+
html_str = html_str + f"""
|
| 230 |
+
**Age range:** {targetCommunity['age']}
|
| 231 |
+
"""
|
| 232 |
+
if 'location' in targetCommunity:
|
| 233 |
+
html_str = html_str + f"""
|
| 234 |
+
**Location:** {targetCommunity['location']}
|
| 235 |
+
|
| 236 |
+
"""
|
| 237 |
+
if 'adaptation' in state['usageContext'] and isinstance(state['usageContext']['adaptation'], dict):
|
| 238 |
+
for key, adaptation in state['usageContext']['adaptation'].items():
|
| 239 |
+
if 'name' in adaptation:
|
| 240 |
+
html_str = html_str + f"""
|
| 241 |
+
#### Adaptation: **{adaptation['name']}**
|
| 242 |
+
|
| 243 |
+
"""
|
| 244 |
+
if 'description' in adaptation:
|
| 245 |
+
html_str = html_str + f"""
|
| 246 |
+
{adaptation['description']}
|
| 247 |
+
|
| 248 |
+
"""
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
###############################
|
| 252 |
+
## Start Participants
|
| 253 |
+
###############################
|
| 254 |
+
if 'participants' in state:
|
| 255 |
+
html_str = html_str + f"""
|
| 256 |
+
|
| 257 |
+
## :hammer_and_wrench: Participants
|
| 258 |
+
|
| 259 |
+
"""
|
| 260 |
+
## Participants
|
| 261 |
+
if isinstance(state['participants'], dict):
|
| 262 |
+
for key, participant in state['participants'].items():
|
| 263 |
+
if 'name' in participant:
|
| 264 |
+
html_str = html_str + f"""
|
| 265 |
+
### {participant['name']}
|
| 266 |
+
|
| 267 |
+
"""
|
| 268 |
+
if 'description' in participant:
|
| 269 |
+
html_str = html_str + f"""
|
| 270 |
+
**Description:** {participant['description']}
|
| 271 |
+
|
| 272 |
+
"""
|
| 273 |
+
if 'type' in participant:
|
| 274 |
+
html_str = html_str + f"""
|
| 275 |
+
**Type:** {pretty_list(participant['type'])}
|
| 276 |
+
|
| 277 |
+
"""
|
| 278 |
+
if 'size' in participant:
|
| 279 |
+
html_str = html_str + f"""
|
| 280 |
+
**Size:** {participant['size']}
|
| 281 |
+
|
| 282 |
+
"""
|
| 283 |
+
if 'location' in participant:
|
| 284 |
+
html_str = html_str + f"""
|
| 285 |
+
**Location:** {participant['location']}
|
| 286 |
+
|
| 287 |
+
"""
|
| 288 |
+
if 'workplace' in participant:
|
| 289 |
+
html_str = html_str + f"""
|
| 290 |
+
**Workplace:** {participant['workplace']}
|
| 291 |
+
|
| 292 |
+
"""
|
| 293 |
+
if 'ethnicitise' in participant:
|
| 294 |
+
html_str = html_str + f"""
|
| 295 |
+
**Ethnicitise:** {participant['ethnicitise']}
|
| 296 |
+
|
| 297 |
+
"""
|
| 298 |
+
if 'genders' in participant:
|
| 299 |
+
html_str = html_str + f"""
|
| 300 |
+
**Genders:** {participant['genders']}
|
| 301 |
+
|
| 302 |
+
"""
|
| 303 |
+
if 'countries' in participant:
|
| 304 |
+
html_str = html_str + f"""
|
| 305 |
+
**Countries:** {pretty_list(participant['countries'])}
|
| 306 |
+
|
| 307 |
+
"""
|
| 308 |
+
if 'edlevel' in participant:
|
| 309 |
+
html_str = html_str + f"""
|
| 310 |
+
**Educational level:** {pretty_list(participant['edlevel'])}
|
| 311 |
+
|
| 312 |
+
"""
|
| 313 |
+
if 'skills' in participant:
|
| 314 |
+
html_str = html_str + f"""
|
| 315 |
+
**Skills level:** {pretty_list(participant['skills'])}
|
| 316 |
+
|
| 317 |
+
"""
|
| 318 |
+
if 'languages' in participant:
|
| 319 |
+
html_str = html_str + f"""
|
| 320 |
+
**Languages Spoken:** {pretty_list(participant['languages'])}
|
| 321 |
+
|
| 322 |
+
"""
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
return html_str
|
| 326 |
+
|
| 327 |
+
def pretty_list(list):
|
| 328 |
+
return ', '.join(list)
|
sdc_view.py
CHANGED
|
@@ -171,12 +171,12 @@ def render_sdc():
|
|
| 171 |
# Initialize session state for the number input if it doesn't exist
|
| 172 |
agekey = f"{key}_age"
|
| 173 |
if agekey not in st.session_state:
|
| 174 |
-
st.session_state[agekey] = 0 # default value
|
| 175 |
# Display a number input widget
|
| 176 |
st.number_input(
|
| 177 |
label="The age of the participant:",
|
| 178 |
key=agekey,
|
| 179 |
-
on_change=lambda: (st.session_state.form_data.update({
|
| 180 |
)
|
| 181 |
cached_text_input("Location", f"{key}_location", "The title of the card")
|
| 182 |
cached_radio_input("WorkplaceType", ["Presential", "Hybrid", "Remote"], f"{key}_workdplace", "The title of the card")
|
|
@@ -489,7 +489,7 @@ def render_sdc():
|
|
| 489 |
mime="text/markdown"
|
| 490 |
)
|
| 491 |
st.text("Preview:")
|
| 492 |
-
|
| 493 |
with jsonTab:
|
| 494 |
|
| 495 |
# Convert the session state to a JSON string
|
|
|
|
| 171 |
# Initialize session state for the number input if it doesn't exist
|
| 172 |
agekey = f"{key}_age"
|
| 173 |
if agekey not in st.session_state:
|
| 174 |
+
st.session_state.form_data[agekey] = 0 # default value
|
| 175 |
# Display a number input widget
|
| 176 |
st.number_input(
|
| 177 |
label="The age of the participant:",
|
| 178 |
key=agekey,
|
| 179 |
+
on_change=lambda: (st.session_state.form_data.update({agekey: st.session_state[agekey]}), save_to_cache())[1]
|
| 180 |
)
|
| 181 |
cached_text_input("Location", f"{key}_location", "The title of the card")
|
| 182 |
cached_radio_input("WorkplaceType", ["Presential", "Hybrid", "Remote"], f"{key}_workdplace", "The title of the card")
|
|
|
|
| 489 |
mime="text/markdown"
|
| 490 |
)
|
| 491 |
st.text("Preview:")
|
| 492 |
+
st.markdown(generate_markdown(unflattenedJson), unsafe_allow_html=True)
|
| 493 |
with jsonTab:
|
| 494 |
|
| 495 |
# Convert the session state to a JSON string
|