-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from I-TECH-UW/WSG-94-refactor-questionnaire-g…
…enerator WSG-94 refactor questionnaire generator. add questionnaire command
- Loading branch information
Showing
8 changed files
with
216 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,4 +178,5 @@ who_ocl.py | |
# Output for testing files | ||
|
||
test_output/ | ||
tests/data/l2/csv_files/ | ||
tests/data/l2/csv_files/ | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#! /usr/bin/env python | ||
import argparse | ||
|
||
from who_l3_smart_tools.cli.utils import add_common_args | ||
from who_l3_smart_tools.core.questionnaires.questionnaire_generator import ( | ||
QuestionnaireGenerator, | ||
) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description="Generate Questionnaire FSH from L3 Data Dictionary Excel file." | ||
) | ||
add_common_args(parser) | ||
|
||
args = parser.parse_args() | ||
|
||
QuestionnaireGenerator(args.input, args.output).generate_fsh_from_excel() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
def add_common_args(parser): | ||
""" | ||
Add common arguments to the argument parser. | ||
Args: | ||
parser (argparse.ArgumentParser): The argument parser object. | ||
Returns: | ||
None | ||
""" | ||
parser.add_argument( | ||
"-i", | ||
"--input", | ||
required=True, | ||
help="Input Data Dictionary file location", | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--output", | ||
default="./data/output", | ||
help="Output Logical Model FSH file location", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
who_l3_smart_tools/core/questionnaires/templates/questionnaire.fsh.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Instance: {{activity_id}} | ||
InstanceOf: sdc-questionnaire-extr-smap | ||
Title: "{{activity_title}}" | ||
Description: "Questionnaire for {{activity_title_description}}" | ||
Usage: #definition | ||
* meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablequestionnaire" | ||
* meta.profile[+] = "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablequestionnaire" | ||
* subjectType = #Patient | ||
* language = #en | ||
* status = #draft | ||
* experimental = true | ||
|
||
{% for item in questionnaire_items %} | ||
* item[+] | ||
* id = "{{item.data_element_id}}" | ||
* linkId = "{{item.data_element_id}}" | ||
* type = #{{item.data_type}} | ||
* text = "{{item.data_element_label}}" | ||
* required = {{item.required}} | ||
* repeats = false | ||
* readOnly = false | ||
{% if item.has_valueset %} | ||
* answerValueSet = "#{{item.data_element_id}}" | ||
{% endif %} | ||
|
||
{% endfor %} |
Oops, something went wrong.