# TRUNK-4730 - complete list of domain objects missing changed\_by or date\_changed

**URL:** https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419
**Category:** Development
**Tags:** development, bugs, developers, developers-forum
**Created:** [October 25, 2015, 11:12pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419 "2015-10-25T23:12:10Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![cathychen](https://talk.openmrs.org/user_avatar/talk.openmrs.org/cathychen/32/1308_2.png) [@cathychen](https://talk.openmrs.org/u/cathychen)
#### Post date: [October 25, 2015, 11:12pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/1 "2015-10-25T23:12:10Z")

</div>

**Issue: [https://issues.openmrs.org/browse/TRUNK-4730](https://issues.openmrs.org/browse/TRUNK-4730)**

The following classes do not have `changed_by` or `date_changed` fields. Would love if people could confirm whether any of these classes do not need those fields otherwise I will move on to the next step of the issue and add the fields to the database for the relevant classes.

* * *

- ConceptClass
- ConceptName
- ConceptNameTag
- ConceptReferenceSource
- EncounterType
- GlobalProperty
- Patient\_identifierType
- RelationshipType
- UserProperty

---

<div class="post-metadata">

### Author: ![maany](https://talk.openmrs.org/user_avatar/talk.openmrs.org/maany/32/692_2.png) [@maany](https://talk.openmrs.org/u/maany)
#### Post date: [November 5, 2015, 8:46pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/2 "2015-11-05T20:46:10Z")

</div>

@cathychenThanks! This is great 😃@dkayiwa @wyclif could you run through these classes and confirm which need changed\_by or date\_changed fields in the database as @darius is unavailable.

> <https://issues.openmrs.org/browse/TRUNK-4730>

---

<div class="post-metadata">

### Author: ![lluismf](https://talk.openmrs.org/user_avatar/talk.openmrs.org/lluismf/32/770_2.png) [@lluismf](https://talk.openmrs.org/u/lluismf)
#### Post date: [November 5, 2015, 8:57pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/3 "2015-11-05T20:57:05Z")

</div>

Some of them are weak entities (all the concept collections for instance). I don’t think they need audit attributes per se, because its main entity already has.

---

<div class="post-metadata">

### Author: ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)
#### Post date: [November 5, 2015, 9:12pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/4 "2015-11-05T21:12:48Z")

</div>

I have turned the main post into a Wiki one, e.g. I think anyone can edit it in place.

@lluismf, do you have moment to make these comments inline?

---

<div class="post-metadata">

### Author: ![lluismf](https://talk.openmrs.org/user_avatar/talk.openmrs.org/lluismf/32/770_2.png) [@lluismf](https://talk.openmrs.org/u/lluismf)
#### Post date: [November 5, 2015, 11:45pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/5 "2015-11-05T23:45:33Z")

</div>

Sure but where’s the link to the wiki? Do you mean JIRA [https://issues.openmrs.org/browse/TRUNK-4730](https://issues.openmrs.org/browse/TRUNK-4730) ?

---

<div class="post-metadata">

### Author: ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)
#### Post date: [November 6, 2015, 3:28am UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/6 "2015-11-06T03:28:48Z")

</div>

I mean that I turned the initial post in this OpenMRS Talk thread into a wiki post, so I believe that anyone can edit it.

I.e. here:

> [@TRUNK-4730 - complete list of domain objects missing changed\_by or date\_changed](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/1):
>
> Issue: [https://issues.openmrs.org/browse/TRUNK-4730](https://issues.openmrs.org/browse/TRUNK-4730) The following classes do not have changed\_by or date\_changed fields. Would love if people could confirm whether any of these classes do not need those fields otherwise I will move on to the next step of the issue and add the fields to the database for the relevant classes. ConceptClass ConceptName ConceptNameTag ConceptReferenceSource EncounterType GlobalProperty Patient\_identifierType RelationshipType UserProperty

---

<div class="post-metadata">

### Author: ![maany](https://talk.openmrs.org/user_avatar/talk.openmrs.org/maany/32/692_2.png) [@maany](https://talk.openmrs.org/u/maany)
#### Post date: [November 11, 2015, 1:08pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/7 "2015-11-11T13:08:55Z")

</div>

Hey @lluismf, do you think we are good to go with the above list?

---

<div class="post-metadata">

### Author: ![lluismf](https://talk.openmrs.org/user_avatar/talk.openmrs.org/lluismf/32/770_2.png) [@lluismf](https://talk.openmrs.org/u/lluismf)
#### Post date: [November 12, 2015, 3:04pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/8 "2015-11-12T15:04:55Z")

</div>

Hi Mayank

I don’t have enough business knowledge to say it, I just expressed an opinion about weak entities. Technically I’m not even sure that it can be possible to know if a person name has changed, given that the UI sends the whole Person to the business layer. To be really sure if a member of a collection has changed, its attributes shoudl be compared one by one. It seems too complex and the benefit probably not worth it.

---

<div class="post-metadata">

### Author: ![maany](https://talk.openmrs.org/user_avatar/talk.openmrs.org/maany/32/692_2.png) [@maany](https://talk.openmrs.org/u/maany)
#### Post date: [February 1, 2016, 4:25pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/9 "2016-02-01T16:25:54Z")

</div>

bumping this post. This issue is a part of Platform 2,0 beta sprint. It would be awesome if any dev can volunteer to look into this 🙂

---

<div class="post-metadata">

### Author: ![maany](https://talk.openmrs.org/user_avatar/talk.openmrs.org/maany/32/692_2.png) [@maany](https://talk.openmrs.org/u/maany)
#### Post date: [February 11, 2016, 6:36am UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/10 "2016-02-11T06:36:51Z")

</div>

@raff @wyclif @dkayiwa would anyone of you guys have some time this week to go through this? 🙂

---

<div class="post-metadata">

### Author: ![wyclif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wyclif/32/19607_2.png) [@wyclif](https://talk.openmrs.org/u/wyclif)
#### Post date: [February 12, 2016, 4:47pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/11 "2016-02-12T16:47:59Z")

</div>

I think this can be scripted to get the tables missing the columns

---

<div class="post-metadata">

### Author: ![burke](https://talk.openmrs.org/user_avatar/talk.openmrs.org/burke/32/17_2.png) [@burke](https://talk.openmrs.org/u/burke)
#### Post date: [February 29, 2016, 7:02pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/12 "2016-02-29T19:02:25Z")

</div>

I went to [OpenMRS Data Models](http://om.rs/dm), loaded the [1.11 iframe](http://resources.openmrs.org/datamodel/openmrs-data-model-1.11.html) directly, and ran this in the console:

```javascript
jQuery('.table').each( function(k,v) {
  console.log((jQuery(v).find('.column-name:contains("changed_by")').length)+","+v.id)
})

```

That gave me a list of table names preceded with “0” (no `changed_by` column) or “1” (has `changed_by` column). Putting that into [Sublime Text 3](https://www.sublimetext.com/), sorting, and then removing the leading zeroes yielded this list of tables without a `changed_by`:

```nohighlight
active_list
active_list_allergy
active_list_problem
active_list_type
clob_datatype_storage
cohort_member
concept_answer
concept_class
concept_complex
concept_datatype
concept_name
concept_name_tag
concept_name_tag_map
concept_numeric
concept_proposal_tag_map
concept_reference_source
concept_set
concept_state_conversion
concept_stop_word
drug_ingredient
drug_order
encounter_type
field_answer
field_type
form_resource
global_property
hl7_in_archive
hl7_in_error
hl7_in_queue
hl7_source
liquibasechangelog
liquibasechangeloglock
location_tag_map
notification_alert_recipient
notification_template
obs
order_type_class_map
orders
patient_identifier_type
privilege
relationship_type
report_schema_xml
role
role_privilege
role_role
scheduler_task_config_property
test_order
user_property
user_role

```

Glancing through those and applying what I know off the top of my head about how we use these objects (e.g., we don’t track changes to mappings, we don’t edit obs or orders, etc.), yield this list of potential tables missing `changed_by` columns:

- concept\_answer
- concept\_class
- concept\_datatype
- **concept\_name**
- concept\_name\_tag
- concept\_reference\_source
- concept\_set
- drug\_ingredient
- encounter\_type
- field\_answer
- form\_resource
- **global\_property**
- **patient\_identifier\_type**
- **relationship\_type**
- **user\_property**

Most of these are types (`_type`, `_datatype`) or answers (`_answer`), which we may just overwrite/replace (so wouldn’t need `changed_by` columns). The five (5) I marked in **bold** are the most curious to me – i.e., the most likely to benefit from adding `changed_by` columns.

Cheers,

-Burke :burke:

---

<div class="post-metadata">

### Author: ![darius](https://talk.openmrs.org/user_avatar/talk.openmrs.org/darius/32/8082_2.png) [@darius](https://talk.openmrs.org/u/darius)
#### Post date: [March 1, 2016, 9:01am UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/13 "2016-03-01T09:01:49Z")

</div>

Great work @burke! I think you’re being a bit too stingy with our changed\_by columns though. 🙂

Typical metadata classes also should be auditable in this way, so we should also include:

- concept\_class
- concept\_name\_tag
- concept\_reference\_source
- encounter\_type

I would also include:

- form\_resource

---

<div class="post-metadata">

### Author: ![wyclif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wyclif/32/19607_2.png) [@wyclif](https://talk.openmrs.org/u/wyclif)
#### Post date: [March 2, 2016, 3:02pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/14 "2016-03-02T15:02:33Z")

</div>

I agree with Darius suggestions. ConceptReferenceSource is not updatable in the legacy UI but it’s not enforced in the API, so i would assume it should have the changed\_\* columns

---

<div class="post-metadata">

### Author: ![burke](https://talk.openmrs.org/user_avatar/talk.openmrs.org/burke/32/17_2.png) [@burke](https://talk.openmrs.org/u/burke)
#### Post date: [March 2, 2016, 3:43pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/15 "2016-03-02T15:43:08Z")

</div>

I updated the original post to reflect the appropriate list of classes. Feel free to revise if I missed something.

@cathychen are you still interested/able to move this forward?

---

<div class="post-metadata">

### Author: ![teleivo](https://talk.openmrs.org/user_avatar/talk.openmrs.org/teleivo/32/2015_2.png) [@teleivo](https://talk.openmrs.org/u/teleivo)
#### Post date: [August 8, 2016, 2:24pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/16 "2016-08-08T14:24:36Z")

</div>

Hi there!

while working on hibernate mapping through annotations for Order [https://issues.openmrs.org/browse/TRUNK-4903](https://issues.openmrs.org/browse/TRUNK-4903)

I saw that the table `orders` is also missing these two columns (changed\_by, date\_changed).

Not sure if they should be added though.

---

<div class="post-metadata">

### Author: ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)
#### Post date: [August 8, 2016, 3:25pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/17 "2016-08-08T15:25:00Z")

</div>

Do we support changing of an order?

---

<div class="post-metadata">

### Author: ![wyclif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wyclif/32/19607_2.png) [@wyclif](https://talk.openmrs.org/u/wyclif)
#### Post date: [August 8, 2016, 4:25pm UTC](https://talk.openmrs.org/t/trunk-4730-complete-list-of-domain-objects-missing-changed-by-or-date-changed/3419/18 "2016-08-08T16:25:00Z")

</div>

Technically we say orders are immutable from the perspective of an API consumer, but they are actually mutable within the API itself.
