Skip to content

Commit

Permalink
fix: change FHIR Value Set reference to Code Value
Browse files Browse the repository at this point in the history
  • Loading branch information
akashkrishna619 committed Nov 8, 2023
1 parent 38e730c commit 1f922db
Show file tree
Hide file tree
Showing 33 changed files with 233 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ frappe.ui.form.on('Clinical Procedure', {
};
});

frm.set_query("medical_code", "codification_table", function(doc, cdt, cdn) {
frm.set_query("code_value", "codification_table", function(doc, cdt, cdn) {
let row = frappe.get_doc(cdt, cdn);
if (row.medical_code_standard) {
if (row.code_system) {
return {
filters: {
medical_code_standard: row.medical_code_standard
code_system: row.code_system
}
};
}
Expand Down Expand Up @@ -345,10 +345,10 @@ frappe.ui.form.on('Clinical Procedure', {
if (!r.exc && r.message) {
frm.doc.codification_table = []
$.each(r.message, function(k, val) {
if (val.medical_code) {
if (val.code_value) {
var child = cur_frm.add_child("codification_table");
child.medical_code = val.medical_code
child.medical_code_standard = val.medical_code_standard
child.code_value = val.code_value
child.code_system = val.code_system
child.code = val.code
child.description = val.description
child.system = val.system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ frappe.ui.form.on('Clinical Procedure Template', {
mark_change_in_item(frm);
},

medical_code: function (frm) {
frm.set_query("medical_code", function () {
return {
filters: {
medical_code_standard: frm.doc.medical_code_standard
}
};
});
},

refresh: function (frm) {
frm.fields_dict['items'].grid.set_column_disp('barcode', false);
Expand All @@ -59,12 +50,12 @@ frappe.ui.form.on('Clinical Procedure Template', {
};
});

frm.set_query("medical_code", "codification_table", function(doc, cdt, cdn) {
frm.set_query("code_value", "codification_table", function(doc, cdt, cdn) {
let row = frappe.get_doc(cdt, cdn);
if (row.medical_code_standard) {
if (row.code_system) {
return {
filters: {
medical_code_standard: row.medical_code_standard
code_system: row.code_system
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@
"sample",
"column_break_21",
"sample_details",
"service_order_defaults_section",
"patient_care_type",
"column_break_28",
"staff_role",
"change_in_item",
"codification",
"codification_table"
"codification_table",
"service_request_defaults_tab",
"patient_care_type",
"staff_role"
],
"fields": [
{
Expand Down Expand Up @@ -244,11 +243,6 @@
"fieldtype": "Tab Break",
"label": "Sample Collection"
},
{
"fieldname": "service_order_defaults_section",
"fieldtype": "Section Break",
"label": "Service Request Defaults"
},
{
"fieldname": "patient_care_type",
"fieldtype": "Link",
Expand All @@ -260,10 +254,15 @@
"fieldtype": "Link",
"label": "Staff Role",
"options": "Role"
},
{
"fieldname": "service_request_defaults_tab",
"fieldtype": "Tab Break",
"label": "Service Request Defaults"
}
],
"links": [],
"modified": "2021-12-23 07:45:12.398227",
"modified": "2023-11-06 15:00:26.292044",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedure Template",
Expand Down
6 changes: 3 additions & 3 deletions healthcare/healthcare/doctype/diagnosis/diagnosis.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

frappe.ui.form.on('Diagnosis', {
refresh : function(frm) {
frm.set_query("medical_code", "codification_table", function(doc, cdt, cdn) {
frm.set_query("code_value", "codification_table", function(doc, cdt, cdn) {
let row = frappe.get_doc(cdt, cdn);
if (row.medical_code_standard) {
if (row.code_system) {
return {
filters: {
medical_code_standard: row.medical_code_standard
code_system: row.code_system
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@
"fieldname": "intent",
"fieldtype": "Link",
"label": "Intent",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"fieldname": "priority",
"fieldtype": "Link",
"label": "Priority",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"allow_on_submit": 1,
Expand Down
Empty file.

This file was deleted.

55 changes: 0 additions & 55 deletions healthcare/healthcare/doctype/fhir_value_set/fhir_value_set.json

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
"fieldname": "intent",
"fieldtype": "Link",
"label": "Intent",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"fieldname": "priority",
"fieldtype": "Link",
"label": "Priority",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"fieldname": "patient_care_type",
Expand Down
12 changes: 6 additions & 6 deletions healthcare/healthcare/doctype/lab_test/lab_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ frappe.ui.form.on('Lab Test', {
});
}

frm.set_query("medical_code", "codification_table", function(doc, cdt, cdn) {
frm.set_query("code_value", "codification_table", function(doc, cdt, cdn) {
let row = frappe.get_doc(cdt, cdn);
if (row.medical_code_standard) {
if (row.code_system) {
return {
filters: {
medical_code_standard: row.medical_code_standard
code_system: row.code_system
}
};
}
Expand Down Expand Up @@ -95,10 +95,10 @@ frappe.ui.form.on('Lab Test', {
if (!r.exc && r.message) {
frm.doc.codification_table = []
$.each(r.message, function(k, val) {
if (val.medical_code) {
if (val.code_value) {
var child = cur_frm.add_child("codification_table");
child.medical_code = val.medical_code
child.medical_code_standard = val.medical_code_standard
child.code_value = val.code_value
child.code_system = val.code_system
child.code = val.code
child.description = val.description
child.system = val.system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ frappe.ui.form.on('Lab Test Template', {
}
});

frm.set_query("medical_code", "codification_table", function(doc, cdt, cdn) {
frm.set_query("code_value", "codification_table", function(doc, cdt, cdn) {
let row = frappe.get_doc(cdt, cdn);
if (row.medical_code_standard) {
if (row.code_system) {
return {
filters: {
medical_code_standard: row.medical_code_standard
code_system: row.code_system
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@
"fieldname": "intent",
"fieldtype": "Link",
"label": "Intent",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"fieldname": "priority",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Priority",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"collapsible": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def set_order_details(self):
self.staff_role = medication.staff_role

if not self.intent:
self.intent = frappe.get_cached_value("FHIR Value Set", {"value": "Original Order"}, "name")
self.intent = frappe.db.get_single_value("Healthcare Settings", "default_intent")

if not self.priority:
self.priority = frappe.get_cached_value("FHIR Value Set", {"value": "Routine"}, "name")
self.priority = frappe.db.get_single_value("Healthcare Settings", "default_priority")

def calculate_total_dispensable_quantity(self):
if self.number_of_repeats_allowed:
Expand Down
6 changes: 3 additions & 3 deletions healthcare/healthcare/doctype/observation/observation.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ var get_medical_codes = function(frm) {
if (!r.exc && r.message) {
frm.doc.codification_table = []
$.each(r.message, function(k, val) {
if (val.medical_code) {
if (val.code_value) {
var child = frm.add_child("codification_table");
child.medical_code = val.medical_code
child.medical_code_standard = val.medical_code_standard
child.code_value = val.code_value
child.code_system = val.code_system
child.code = val.code
child.description = val.description
child.system = val.system
Expand Down
2 changes: 1 addition & 1 deletion healthcare/healthcare/doctype/observation/observation.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@
"fieldname": "observation_method",
"fieldtype": "Link",
"label": "Observation Method",
"options": "FHIR Value Set",
"options": "Code Value",
"read_only": 1
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
"fieldname": "intent",
"fieldtype": "Link",
"label": "Intent",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"fieldname": "priority",
"fieldtype": "Link",
"label": "Priority",
"options": "FHIR Value Set"
"options": "Code Value"
}
],
"index_web_pages_for_search": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
"fieldtype": "Link",
"in_list_view": 1,
"label": "Reference Type",
"options": "FHIR Value Set"
"options": "Code Value"
},
{
"depends_on": "eval:[\"Numeric\", \"Range\", \"Quantity\"].includes(doc.permitted_data_type);",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ frappe.ui.form.on("Observation Template", {
frm.set_query("method", function () {
return {
"filters": {
"value_set": "Observation Method",
"code_system": "Observation Method",
}
};
});
frm.set_query("reference_type", "observation_reference_range", function() {
return {
filters: {
"value_set": "Reference Type",
"code_system": "Reference Type",
}
};
})
Expand Down
Loading

0 comments on commit 1f922db

Please sign in to comment.