We have two labs sending result to two different obs terms for the same lab. We have updated the link logic mapping so everything goes to same obs term going forward.
Can I update obs table and change just the HDID to move those results to new obs terms?
I have done this with a few of ours. As long as you can find the right ones to move, it should be no problem. As in, if you have other valid values attached to that hdid, you need to identify only the ones you want to assign to the other hdid. We have had a few where we wanted to move all values and some where we needed to be selective. In our case, when being selective on the labs, I queried for the obs attached to documents with the summary line that the labs came in under. I can send you some statements I have used as examples if needed and maybe try it in a test system first.
Thank you quick response @jryan. I would appreciate if you could send me the statements you used.
Here is an example of when the mammogram obs term was changed by GE without anyone realizing and our mammos were coming in via the interface unmapped. When GE imports one unmapped it assigns hdid of -1. Anything with -- before it is a comment (like in the first 2 I put a comment so I knew which hdid to use later). We had interfaced values and indexed values and summary lines are case sensitive so I had to use a mix of cases in my statements but I only provided one example here. The summary line is really important as we wouldn't want ALL unmapped values to be set to the mammo obs term. Let me know if that doesn't make sense or need something else. Thx. Jen
--find the hdid values you need
select * from obshead where name like 'MAMMOGRAM%' --hdid is 71 cpt 77055
select * from obshead where name='ZZ-GE-unk' -- hdid is -1
--a few stmts you can use to check counts to see how many are affected
select count(*) from obs where hdid='-1' and sdid in (select sdid from document where summary like'%MAMMO%')
select count(*) from obs where hdid='-1' and sdid in (select sdid from document where summary like'%mammo%'and db_create_date between '25-OCT-17' and '26-JUL-18')
--stmt to view the obs you plan to update to make sure you have the right ones
select * from obs where hdid='-1' and sdid in (select sdid from document where summary like '%MAMMO%')
--stmt to update the obs from one value to another
update obs set hdid='71' where hdid='-1' and sdid in (select sdid from document where summary like '%MAMMO%')
--if number of rows is correct, commit, if not rollback
commit
Also, I typically try it in test first and back up my obs table before I run the update just in case.