Skip to content
Open
Show file tree
Hide file tree
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
48 changes: 45 additions & 3 deletions Model/lib/wdk/model/records/commentTableQueries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
<column name="stable_id"/>
<column name="headline"/>
<column name="user_name_org"/>
<column name="user_name_org_display"/>
<column name="ai_source_kind"/>
<column name="comment_date"/>
<column name="comment_target_id"/>
<column name="comment_status"/>
Expand Down Expand Up @@ -94,7 +96,28 @@
END AS pmids_link,
gene_counts.geneCount,
&&selectReviewed&&
CONCAT(u.first_name , ' ' , u.last_name , ', ' , u.organization ) as user_name_org
CONCAT(u.first_name , ' ' , u.last_name , ', ' , u.organization ,
CASE
WHEN aiprov.comment_id IS NULL THEN ''
WHEN aiprov.is_edited THEN ' · AI-assisted (edited)'
ELSE ' · AI-assisted (as-is)'
END) as user_name_org,
CASE
WHEN aiprov.comment_id IS NULL
THEN CONCAT(u.first_name , ' ' , u.last_name , ', ' , u.organization )
ELSE CONCAT(u.first_name , ' ' , u.last_name , ', ' , u.organization ,
'<br/><span title="',
CASE
WHEN aiprov.is_edited
THEN 'AI-generated summary of a publication, edited by the author before publishing.'
ELSE 'AI-generated summary of a publication, published unedited after author review.'
END,
'" style="display:inline-block;margin-top:3px;padding:1px 6px;border-radius:8px;background-color:#0a7c8a;color:#fff;font-size:0.85em;font-weight:500;white-space:nowrap;">AI-assisted &middot; ',
CASE WHEN aiprov.is_edited THEN 'edited' ELSE 'as-is' END,
'</span>')
END as user_name_org_display,
-- download-only AI provenance source: 'pubmed' | 'upload' | 'N/A'
COALESCE(car2.source_kind, 'N/A') as ai_source_kind
FROM
@REMOTE_COMMENT_SCHEMA@MappedComment c
INNER JOIN webready.GeneAttributes_p ga ON c.project_name = ga.project_id AND c.stable_id = ga.source_id
Expand All @@ -107,8 +130,23 @@
) files ON c.comment_id = files.comment_id
LEFT JOIN (
SELECT comment_id, string_agg(source_id,',') as pmids
FROM @REMOTE_COMMENT_SCHEMA@CommentReference
WHERE database_name='pubmed'
FROM (
SELECT comment_id, source_id
FROM @REMOTE_COMMENT_SCHEMA@CommentReference
WHERE database_name='pubmed'
UNION
SELECT cap.comment_id, car.pubmed_id AS source_id
FROM @REMOTE_COMMENT_SCHEMA@comment_ai_provenance cap
JOIN @REMOTE_COMMENT_SCHEMA@comment_ai_run car ON cap.run_job_id = car.job_id
WHERE car.source_kind = 'pubmed' AND car.pubmed_id IS NOT NULL
UNION
SELECT cap.comment_id, car.external_ref AS source_id
FROM @REMOTE_COMMENT_SCHEMA@comment_ai_provenance cap
JOIN @REMOTE_COMMENT_SCHEMA@comment_ai_run car ON cap.run_job_id = car.job_id
WHERE car.source_kind = 'upload'
AND car.external_ref_kind = 'pubmed'
AND car.external_ref IS NOT NULL
) merged
GROUP BY comment_id
) refs ON c.comment_id = refs.comment_id
LEFT JOIN (
Expand All @@ -117,6 +155,10 @@
WHERE stable_id IN (SELECT source_id FROM webready.GeneAttributes_p where org_abbrev IN (%%PARTITION_KEYS%%))
GROUP BY comment_id
) gene_counts ON c.comment_id = gene_counts.comment_id
LEFT JOIN @REMOTE_COMMENT_SCHEMA@comment_ai_provenance aiprov
ON c.comment_id = aiprov.comment_id
LEFT JOIN @REMOTE_COMMENT_SCHEMA@comment_ai_run car2
ON aiprov.run_job_id = car2.job_id
LEFT JOIN (
SELECT dr.primary_identifier AS comment_id , ta.gene_source_id
FROM sres.dbref dr
Expand Down
58 changes: 35 additions & 23 deletions Model/lib/wdk/model/records/geneRecord.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1679,22 +1679,26 @@ name" internal="true"/>
displayName="User Comments"
inReportMaker="true"
queryRef="CommentTables.GeneComments">
<!-- opaque primary key: kept internal for the headline link's #fragment and
downloads, but no longer shown as its own column (the headline is the
click-through to the show page) -->
<columnAttribute name="comment_id" internal="true" displayName="Comment ID"/>
<linkAttribute name="comment_id_link"
displayName="Comment ID">
<displayText>
<![CDATA[
$$comment_id$$
]]>
</displayText>
<columnAttribute internal="true" displayName="project_id" name="project_id"/>
<columnAttribute name="stable_id" internal="true"/>
<columnAttribute name="comment_target_id" internal="true"/>
<!-- plain text: hidden on screen, used by report maker / downloads + sorting -->
<columnAttribute name="headline" displayName="Headline" internal="true"/>
<!-- headline as a link (with a trailing » arrow cue) to the modernised show
page; whole cell is clickable and scrolls to this comment.
NB: linkAttribute displayText is HTML-escaped, so no inline markup here -
the arrow must be a literal glyph, not an &#xxxx; entity.
-->
<linkAttribute name="headline_link" displayName="Headline" inReportMaker="false">
<displayText><![CDATA[$$headline$$ »]]></displayText>
<url>
<![CDATA[@WEBAPP_BASE_URL@/user-comments/show?projectId=$$project_id$$&stableId=$$stable_id$$&commentTargetId=$$comment_target_id$$#$$comment_id$$]]>
</url>
</linkAttribute>
<columnAttribute internal="true" displayName="project_id" name="project_id"/>
<columnAttribute name="stable_id" internal="true"/>
<columnAttribute name="comment_target_id" internal="true"/>
<columnAttribute name="headline" displayName="Headline"/>
<columnAttribute name="pmids" internal="true" displayName="PubMed ID(s)"/>
<linkAttribute name="pmids_link"
displayName="PubMed ID(s)">
Expand All @@ -1710,7 +1714,12 @@ name" internal="true"/>
<columnAttribute name="genecount" displayName="# Related Genes"/>
<columnAttribute name="comment_status" displayName="Status"/>
<columnAttribute name="filecount" displayName="# Uploaded Files"/>
<columnAttribute name="user_name_org" displayName="Made by"/>
<!-- plain text: hidden on screen, used by report maker / downloads + sorting -->
<columnAttribute name="user_name_org" displayName="Made by" internal="true"/>
<!-- name + styled AI-assisted pill: shown on screen as "Made by", excluded from downloads -->
<columnAttribute name="user_name_org_display" displayName="Made by" inReportMaker="false"/>
<!-- download-only: AI provenance source kind ('pubmed' | 'upload' | 'N/A') -->
<columnAttribute name="ai_source_kind" displayName="AI Source Type" internal="true"/>
<columnAttribute name="comment_date" displayName="Date"/>

</table>
Expand All @@ -1723,22 +1732,25 @@ name" internal="true"/>
inReportMaker="false"
displayName="Community Annotations"
queryRef="CommentTables.CommunityComments">
<!-- opaque primary key: kept internal for the headline link's #fragment and
downloads, but no longer shown as its own column (the headline is the
click-through to the show page) -->
<columnAttribute name="comment_id" internal="true" displayName="Comment ID"/>
<linkAttribute name="comment_id_link"
displayName="Comment ID">
<displayText>
<![CDATA[
$$comment_id$$
]]>
</displayText>
<columnAttribute internal="true" displayName="project_id" name="project_id"/>
<columnAttribute name="stable_id" internal="true"/>
<columnAttribute name="comment_target_id" internal="true"/>
<!-- plain text: hidden on screen, used by report maker / downloads + sorting -->
<columnAttribute name="headline" displayName="Proposed Product" internal="true"/>
<!-- headline as a link (with a trailing » cue) to the modernised show page;
whole cell is clickable and scrolls to this comment.
NB: linkAttribute displayText is HTML-escaped, so the cue must be a
literal glyph, not an &#xxxx; entity. -->
<linkAttribute name="headline_link" displayName="Proposed Product" inReportMaker="false">
<displayText><![CDATA[$$headline$$ »]]></displayText>
<url>
<![CDATA[@WEBAPP_BASE_URL@/user-comments/show?projectId=$$project_id$$&stableId=$$stable_id$$&commentTargetId=$$comment_target_id$$#$$comment_id$$]]>
</url>
</linkAttribute>
<columnAttribute internal="true" displayName="project_id" name="project_id"/>
<columnAttribute name="stable_id" internal="true"/>
<columnAttribute name="comment_target_id" internal="true"/>
<columnAttribute name="headline" displayName="Proposed Product"/>
<columnAttribute name="pmids" internal="true" displayName="PubMed ID(s)"/>
<linkAttribute name="pmids_link"
displayName="PubMed ID(s)">
Expand Down
Loading