Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workingset updated version #1729

Closed
wants to merge 113 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
a2a61ec
add attibute button html
ZinnurovArtur Mar 4, 2024
8a9657d
some logic in concept creator
ZinnurovArtur Mar 4, 2024
96d2d69
adding the attribute component
ZinnurovArtur Mar 8, 2024
2542464
initialize the component inside creator
ZinnurovArtur Mar 8, 2024
b6dd169
adding to the concept create page
ZinnurovArtur Mar 8, 2024
a3b8be7
adding the input values
ZinnurovArtur Mar 10, 2024
706ed7d
deleted some spaces
ZinnurovArtur Mar 11, 2024
db06dbe
Merge remote-tracking branch 'origin/Development' into artur-workings…
ZinnurovArtur Apr 3, 2024
788ef05
adding icon to the attribute button
ZinnurovArtur Apr 3, 2024
b92513d
using basic style
ZinnurovArtur Apr 3, 2024
1c44ff7
some experiments
ZinnurovArtur Apr 15, 2024
d04d841
some data is returning
ZinnurovArtur Apr 15, 2024
37fc043
adding components for testing
ZinnurovArtur May 20, 2024
39f8710
Merge remote-tracking branch 'origin/Development' into artur-workings…
ZinnurovArtur May 20, 2024
efa421e
deleted title
ZinnurovArtur May 28, 2024
662dc90
adding different dropdown
ZinnurovArtur May 28, 2024
9382dc6
attribute type for input
ZinnurovArtur May 28, 2024
40d6d18
adding the test modal with attributes
ZinnurovArtur Jun 10, 2024
0c1f92c
adding test mockup modal
ZinnurovArtur Jun 10, 2024
ecb2ef5
call the import setting for now
ZinnurovArtur Jun 17, 2024
04b7af5
adding the setting page for attributs
ZinnurovArtur Jun 25, 2024
f9d183b
call modal attribute for now
ZinnurovArtur Jun 26, 2024
0dbc4cd
deleting unused
ZinnurovArtur Jun 27, 2024
58e2bf3
delete unused code
ZinnurovArtur Jul 1, 2024
44bdd8d
deletion some other code
ZinnurovArtur Jul 1, 2024
b19375e
deleted unused
ZinnurovArtur Jul 16, 2024
c41a886
table test addition
ZinnurovArtur Jul 16, 2024
4ce9873
adding package to html
ZinnurovArtur Jul 16, 2024
fc772ca
Merge remote-tracking branch 'origin/Development' into artur-workings…
ZinnurovArtur Aug 5, 2024
dd30ab3
using the different package installer
ZinnurovArtur Aug 5, 2024
5e40fca
gridjs example
ZinnurovArtur Aug 5, 2024
632f2dc
remove unused
ZinnurovArtur Aug 5, 2024
66a51ea
again removed unused
ZinnurovArtur Aug 6, 2024
ec054f1
adjusting the concept data
ZinnurovArtur Aug 6, 2024
2a637b3
deleting unused functions again
ZinnurovArtur Aug 6, 2024
a3e6b04
removed unused and adding the js fetch concepts
ZinnurovArtur Aug 6, 2024
52eee38
adding none list available page
ZinnurovArtur Sep 9, 2024
fdea508
adding the button and attribute creation test
ZinnurovArtur Sep 11, 2024
1ae9133
adding button different place
ZinnurovArtur Sep 11, 2024
c6fe7d1
adding id
ZinnurovArtur Sep 16, 2024
e16ad67
test adding the creation
ZinnurovArtur Sep 16, 2024
3fdd987
adding templates
ZinnurovArtur Sep 16, 2024
ebb6d26
adding some test component of attribute addition
ZinnurovArtur Sep 18, 2024
3420956
adding the attribute value addition
ZinnurovArtur Sep 18, 2024
ecddfc3
removed unused and adding the creation logic
ZinnurovArtur Sep 19, 2024
57aa9a4
Merge remote-tracking branch 'origin/Development' into artur-workings…
ZinnurovArtur Sep 19, 2024
2e1c873
forgot tinymde
ZinnurovArtur Sep 19, 2024
74fba6d
adding column addition
ZinnurovArtur Sep 19, 2024
db84fba
adding ids to the component
ZinnurovArtur Sep 20, 2024
4acec44
formating and adding new checks
ZinnurovArtur Sep 20, 2024
8a01fa8
adding dynamic value retrive
ZinnurovArtur Sep 20, 2024
0592cfd
adding dynamic editor
ZinnurovArtur Sep 20, 2024
db6f9fd
testing edit cell
ZinnurovArtur Sep 20, 2024
2f3ffc1
test if cell is editable
ZinnurovArtur Sep 20, 2024
b6f09b3
adding test function for cell
ZinnurovArtur Sep 23, 2024
3317fc1
deleted the input due to putting this inside of the cell
ZinnurovArtur Sep 23, 2024
1b31226
deleting inputs
ZinnurovArtur Sep 23, 2024
6b79db5
adding the uuid and value assing
ZinnurovArtur Sep 23, 2024
a9457c0
adding the cell editing to show the user progr3ess
ZinnurovArtur Sep 24, 2024
1e72fe3
adding data if no input
ZinnurovArtur Sep 24, 2024
d6fa558
adding type string description
ZinnurovArtur Sep 25, 2024
62594ed
adjusting the cancel button
ZinnurovArtur Sep 25, 2024
bb6c249
update the name and attribute on input
ZinnurovArtur Sep 25, 2024
75e2f23
some adjustments and refactor
ZinnurovArtur Sep 25, 2024
5bfc743
revert span button
ZinnurovArtur Sep 26, 2024
c36faca
adding the attribute test temporarly data
ZinnurovArtur Sep 27, 2024
6350f75
adding the delete icon for accrdion
ZinnurovArtur Sep 30, 2024
abe792f
adding delete button as component and manage the cancel
ZinnurovArtur Sep 30, 2024
f928147
adding delete button to the attribute row
ZinnurovArtur Sep 30, 2024
cea3802
adding logic to the delete button
ZinnurovArtur Sep 30, 2024
bbb6e69
adding check if user only adding attribute
ZinnurovArtur Sep 30, 2024
f65847b
adding map when try to retrive the attributes
ZinnurovArtur Sep 30, 2024
c2823df
removing log
ZinnurovArtur Sep 30, 2024
a629ebe
adding delete toast
ZinnurovArtur Sep 30, 2024
a1a9c2f
fix of attribute name validation
ZinnurovArtur Sep 30, 2024
665abf2
adding the button disabled in case of no concepts
ZinnurovArtur Sep 30, 2024
1caf598
removing console log and fix the deletion
ZinnurovArtur Oct 1, 2024
a731ccd
adding the placeholder functionality
ZinnurovArtur Oct 2, 2024
bbee729
Merge remote-tracking branch 'origin/Development' into artur-workings…
ZinnurovArtur Oct 3, 2024
6e28ac0
Fix the duplicated attribute name
ZinnurovArtur Oct 8, 2024
5c7f304
moved the invoke elements so can be find in builddialgoe
ZinnurovArtur Oct 8, 2024
fda60b7
adding validation to the backend
ZinnurovArtur Oct 8, 2024
e43a8f5
adding better form of hide button
ZinnurovArtur Oct 8, 2024
b96544e
adding some different form of validation and same for creattion
ZinnurovArtur Oct 8, 2024
b3def75
adding attributes to the backend
ZinnurovArtur Oct 8, 2024
a9a5b67
even if empty still proceed
ZinnurovArtur Oct 8, 2024
ab74e03
fix of not showing button
ZinnurovArtur Oct 8, 2024
4ecdda4
fixing the attribute index change
ZinnurovArtur Oct 8, 2024
67bcd27
showing the attributes in the concept data request
ZinnurovArtur Oct 8, 2024
27de5c0
appending attributes to the concept_data
ZinnurovArtur Oct 8, 2024
63f8dc4
check if concept is new
ZinnurovArtur Oct 8, 2024
c1949bd
showing the attriubes to the api
ZinnurovArtur Oct 10, 2024
e54bbac
adding the validation
ZinnurovArtur Oct 28, 2024
af09921
check if string is empty
ZinnurovArtur Oct 28, 2024
c6e6a4f
adding docs
ZinnurovArtur Oct 28, 2024
5ead994
removed console logs
ZinnurovArtur Oct 28, 2024
69a5de6
check if empty and showing the attribute to the codelist
ZinnurovArtur Oct 28, 2024
187a932
adding to the page render concept_attributes
ZinnurovArtur Oct 28, 2024
380ff7a
bug fixes of adding existing concepts or emtpy concepts without attr
ZinnurovArtur Nov 6, 2024
a2357fe
adding checks on the backend
ZinnurovArtur Nov 6, 2024
8f114f9
removed console log
ZinnurovArtur Nov 6, 2024
5e8c4ac
adding another regex check
ZinnurovArtur Nov 19, 2024
c41f15c
removing string validation on the backend
ZinnurovArtur Nov 19, 2024
4d8474d
fixing showing the concept attribute in the detail page
ZinnurovArtur Dec 6, 2024
cb99cbe
removing unpackage for js
ZinnurovArtur Dec 6, 2024
97e91d7
adding grid js scss
ZinnurovArtur Dec 6, 2024
628423d
adding grid.js to the create scss
ZinnurovArtur Dec 6, 2024
5c631d3
adjusting the float values
ZinnurovArtur Dec 6, 2024
0dcae45
scss changes
ZinnurovArtur Dec 9, 2024
d2670f3
Merge remote-tracking branch 'origin/AZ/dev-upstream' into artur-work…
ZinnurovArtur Jan 21, 2025
e665981
removed some comments
ZinnurovArtur Jan 21, 2025
17ee8ab
renamed to accordion and changed id
ZinnurovArtur Jan 21, 2025
813009c
renamded to accordion
ZinnurovArtur Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,10 @@ def build_final_codelist_from_concepts(
if include_headers:
concept_data |= { 'code_attribute_header': concept_entity.code_attribute_header}

if 'attributes' in concept and concept['attributes']:
concept_data |= {'attributes': concept['attributes']}


# Get codes
concept_codes = concept_utils.get_concept_codelist(
concept_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,9 @@ def get_minimal_concept_data(concept):
'coding_system': model_utils.get_coding_system_details(concept.coding_system)
} | concept_data

def get_clinical_concept_data(concept_id, concept_history_id, include_reviewed_codes=False,
def get_clinical_concept_data(concept_id, concept_history_id,include_reviewed_codes=False,
aggregate_component_codes=False, include_component_codes=True,
include_attributes=False, strippable_fields=None,
include_attributes=False, strippable_fields=None,concept_attributes=None,
remove_userdata=False, hide_user_details=False,
derive_access_from=None, requested_entity_id=None,
format_for_api=False, include_source_data=False):
Expand All @@ -853,6 +853,7 @@ def get_clinical_concept_data(concept_id, concept_history_id, include_reviewed_c
include_attributes (boolean): Should we include attributes?
strippable_fields (list): Whether to strip any fields from the Concept model when
building the concept's data result
concept_attributes (list): The workingset list of attributes
remove_userdata (boolean): Whether to remove userdata related fields from the result (assoc. with each Concept)
derive_access_from (RequestContext): Using the RequestContext, determine whether a user can edit a Concept
format_for_api (boolean): Flag to format against legacy API
Expand Down Expand Up @@ -990,6 +991,7 @@ def get_clinical_concept_data(concept_id, concept_history_id, include_reviewed_c
'concept_version_id': concept_history_id,
'coding_system': model_utils.get_coding_system_details(historical_concept.coding_system),
'details': concept_data,
'attributes': concept_attributes,
'components': components_data.get('components') if components_data is not None else [],
}
else:
Expand Down
36 changes: 32 additions & 4 deletions CodeListLibrary_project/clinicalcode/entity_utils/create_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ def get_template_creation_data(request, entity, layout, field, default=None):
if field_type == 'concept':
values = []
for item in data:
workingset_concept_attributes = None
if 'attributes' in item:
workingset_concept_attributes = item['attributes']
value = concept_utils.get_clinical_concept_data(
item['concept_id'],
item['concept_version_id'],
concept_attributes=workingset_concept_attributes,
aggregate_component_codes=False,
requested_entity_id=entity.id,
derive_access_from=request,
Expand Down Expand Up @@ -506,6 +510,28 @@ def validate_concept_form(form, errors):
'components': [ ],
}

# Validate concept attributes based on their type
concept_attributes = []
if form.get('attributes'):
for attribute in form.get('attributes'):
if attribute['value']:
attribute_type = attribute.get('type')
attribute_value = attribute.get('value')
if not gen_utils.is_empty_string(attribute_value):
if attribute_type == 'INT':
try:
attribute_value = str(int(attribute_value))
except ValueError:
errors.append(f'Attribute {attribute["name"]} must be an integer.')
continue
elif attribute_type == 'FLOAT':
try:
attribute['value'] = str(float(attribute_value))
except ValueError:
errors.append(f'Attribute {attribute["name"]} must be a float.')
continue
concept_attributes.append(attribute)

if not is_new_concept and concept_id is not None and concept_history_id is not None:
concept = model_utils.try_get_instance(Concept, id=concept_id)
concept = model_utils.try_get_entity_history(concept, history_id=concept_history_id)
Expand All @@ -514,6 +540,7 @@ def validate_concept_form(form, errors):
return None
field_value['concept']['id'] = concept_id
field_value['concept']['history_id'] = concept_history_id
field_value['concept']['attributes'] = concept_attributes
else:
is_new_concept = True

Expand Down Expand Up @@ -661,6 +688,7 @@ def validate_concept_form(form, errors):
field_value['concept']['name'] = concept_name
field_value['concept']['coding_system'] = concept_coding
field_value['concept']['code_attribute_header'] = attribute_headers
field_value['concept']['attributes'] = concept_attributes
field_value['components'] = components

return field_value
Expand Down Expand Up @@ -1163,7 +1191,7 @@ def build_related_entities(request, field_data, packet, override_dirty=False, en
if override_dirty or concept.get('is_dirty'):
result = try_update_concept(request, item)
if result is not None:
entities.append({'method': 'update', 'entity': result, 'historical': result.history.latest() })
entities.append({'method': 'update', 'entity': result, 'historical': result.history.latest(), 'attributes': concept.get('attributes')})
continue

# If we're not dirty, append the current concept
Expand All @@ -1172,20 +1200,20 @@ def build_related_entities(request, field_data, packet, override_dirty=False, en
result = model_utils.try_get_instance(Concept, id=concept_id)
historical = model_utils.try_get_entity_history(result, history_id=concept_history_id)
if historical is not None:
entities.append({ 'method': 'set', 'entity': result, 'historical': historical })
entities.append({ 'method': 'set', 'entity': result, 'historical': historical, 'attributes': concept.get('attributes') })
continue

# Create new concept & components
result = try_create_concept(request, item, entity=entity)
if result is None:
continue
entities.append({ 'method': 'create', 'entity': result, 'historical': result.history.latest() })
entities.append({ 'method': 'create', 'entity': result, 'historical': result.history.latest(), 'attributes': concept.get('attributes') })

# Build concept list
return True, [
'phenotype_owner',
[obj.get('entity') for obj in entities if obj.get('method') == 'create'],
[{ 'concept_id': obj.get('historical').id, 'concept_version_id': obj.get('historical').history_id } for obj in entities]
[{ 'concept_id': obj.get('historical').id, 'concept_version_id': obj.get('historical').history_id, 'attributes': obj.get('attributes')} for obj in entities]
]

return False, None
Expand Down
Loading
Loading