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

Protocol field data update #1244

Open
wants to merge 1 commit into
base: release23.11-SNAPSHOT
Choose a base branch
from
Open
Changes from all commits
Commits
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
121 changes: 17 additions & 104 deletions sla/resources/queries/sla/PlandProtocols.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
--Added Linked schema template references

SELECT a.project as ProjectID,
aa.species,
a.account as Alias,
y.grantNumber as OGAGrantNumber,
a.protocol as ParentIACUC,
a.title as Title,
a.name as IACUCCode,
a.startdate as StartDate,
a.enddate as EndDate,
i.FirstName,
i.LastName,
i.Division,
p.external_id,
--Added the breeding info as one field
i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' ' + aa.Breeding_Info + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc
aa.species,
a.account as Alias,
y.grantNumber as OGAGrantNumber,
a.protocol as ParentIACUC,
a.title as Title,
a.name as IACUCCode,
a.startdate as StartDate,
a.enddate as EndDate,
i.FirstName,
i.LastName,
i.Division,
p.external_id,
--Added the breeding info as one field
-- i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' ' + aa.Breeding_Info + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc
--Removed the Breeding info in the protocol field as we are not storing the information when user selects the item from drop down list. Approved by Kati in Tkt #11797
i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc
FROM publicehr.project a
LEFT JOIN publicehr.protocol p ON p.protocol = a.protocol
LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId
LEFT JOIN ehrsla.allowableAnimals_BreedingGroups aa ON a.protocol = aa.protocol
LEFT JOIN ehrsla.allowableAnimals aa ON a.protocol = aa.protocol
LEFT JOIN financepublic.aliases y ON y.alias = a.account
WHERE
-- filter based on the current date compared with the start and end dates
Expand All @@ -43,92 +45,3 @@ WHERE
OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project)))
) IS NOT NULL
)


-- SELECT a.project as ProjectID,
-- aa.species,
-- a.account as Alias,
-- y.grantNumber as OGAGrantNumber,
-- a.protocol as ParentIACUC,
-- a.title as Title,
-- a.name as IACUCCode,
-- a.startdate as StartDate,
-- a.enddate as EndDate,
-- i.FirstName,
-- i.LastName,
-- i.Division,
-- p.external_id,
-- --Added the breeding info as one field
-- i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' ' + aa.Breeding_Info + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc
-- FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a
-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol
-- LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId
-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa ON a.protocol = aa.protocol
-- LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = a.account
-- WHERE
-- -- filter based on the current date compared with the start and end dates
-- (
-- (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR
-- (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR
-- (now() between aa.StartDate AND aa.EndDate)
-- )
-- AND
-- --Check for the project enddate. Added by LK on 1/16/2019
-- (now() between a.StartDate AND a.EndDate)
-- -- and filtered based on dataAccess for the given user
-- AND
-- (
-- (SELECT max(rowid) as expr FROM financepublic.dataAccess da
-- -- current logged in user is the dataAccess user
-- WHERE isMemberOf(da.userid)
-- -- has access to all data
-- AND (da.allData = true
-- -- has access to the specified investigatorId and the specified project (if applicable)
-- OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project)))
-- ) IS NOT NULL
-- )
--
--

--
-- SELECT a.project as ProjectID,
-- aa.species,
-- a.account as Alias,
-- y.grantNumber as OGAGrantNumber,
-- a.protocol as ParentIACUC,
-- a.title as Title,
-- a.name as IACUCCode,
-- a.startdate as StartDate,
-- a.enddate as EndDate,
-- i.FirstName,
-- i.LastName,
-- i.Division,
-- p.external_id,
-- i.LastName + ': ' + a.name + '('+ p.external_id +')' + ' - ' + a.title + ' (Species: ' + aa.species + ')' as PIIacuc
-- FROM Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project a
-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.protocol p ON p.protocol = a.protocol
-- LEFT JOIN onprc_ehr.investigators i ON i.rowId = a.investigatorId
-- LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa ON a.protocol = aa.protocol
-- LEFT JOIN Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer_Public')}.onprc_billing_public.aliases y ON y.alias = a.account
-- WHERE
-- -- filter based on the current date compared with the start and end dates
-- (
-- (aa.StartDate IS NOT NULL AND aa.EndDate IS NULL AND now() > aa.StartDate) OR
-- (aa.StartDate IS NULL AND aa.EndDate IS NOT NULL AND now() < aa.EndDate) OR
-- (now() between aa.StartDate AND aa.EndDate)
-- )
-- AND
-- --Check for the project enddate. Added by LK on 1/16/2019
-- (now() between a.StartDate AND a.EndDate)
-- -- and filtered based on dataAccess for the given user
-- AND
-- (
-- (SELECT max(rowid) as expr FROM onprc_billing.dataAccess da
-- -- current logged in user is the dataAccess user
-- WHERE isMemberOf(da.userid)
-- -- has access to all data
-- AND (da.allData = true
-- -- has access to the specified investigatorId and the specified project (if applicable)
-- OR (da.investigatorId = i.rowId AND (da.project IS NULL OR da.project = a.project)))
-- ) IS NOT NULL
-- )