<commit_before><cfinclude template = "/includes/_header.cfm">
<cfset title = "Agent Activity">
<cfoutput>
<a href="/agents.cfm?agent_id=#agent_id#" target="_top">Edit Agent</a>
<div class="importantNotification">
	Please note: your login may prevent you from seeing some linked data. The summary data below are accurate.
</div>
<cfquery name="agent" datasource="uam_god">
	select AGENT_ID,
	AGENT_TYPE,
	AGENT_REMARKS,
	PREFERRED_AGENT_NAME,
	getPreferredAgentName(CREATED_BY_AGENT_ID) createdby,
	CREATED_DATE
 	FROM agent where agent_id=#agent_id#
</cfquery>
<cfquery name="name" datasource="uam_god">
	select agent_name_id, agent_name, agent_name_type FROM agent_name where agent_id=#agent_id#
</cfquery>
<h3>
	#agent.PREFERRED_AGENT_NAME# (#agent.agent_type#)
	<div style="font-size:small; margin-left:1em;">created by #agent.createdby#, #agent.CREATED_DATE#</div>
</h3>
<p>
Agent Names:
	<ul>
		<cfloop query="name">
			<li>
				#name.agent_name# (#agent_name_type#)
			</li>
		</cfloop>
	</ul>
	<cfif agent.agent_type is "group">
		<cfquery name="grpagnt" datasource="uam_god">
			select MEMBER_AGENT_ID,getPreferredAgentName(MEMBER_AGENT_ID) name from group_member where GROUP_AGENT_ID=#agent_id#
		</cfquery>
		<p>
			Group Members:
			<ul>
				<cfloop query="grpagnt">
					<li><a href="/agents.cfm?agent_id=#MEMBER_AGENT_ID#">#name#</a></li>
				</cfloop>
			</ul>
		</p>
	</cfif>
</p>
<p>
	Remarks:

	<div>#agent.AGENT_REMARKS#</div>
</p>
	Agent Relationships:
	<cfquery name="agent_relations" datasource="uam_god">
		select AGENT_RELATIONSHIP,agent_name,RELATED_AGENT_ID
		from agent_relations,preferred_agent_name
		where
		agent_relations.RELATED_AGENT_ID=preferred_agent_name.agent_id and
		agent_relations.agent_id=#agent_id#
	</cfquery>
	<ul>
		<cfloop query="agent_relations">
			<li>#AGENT_RELATIONSHIP# <a href="agentActivity.cfm?agent_id=#RELATED_AGENT_ID#">#agent_name#</a></li>
		</cfloop>
	</ul>
	<cfquery name="agent_relations" datasource="uam_god">
		select AGENT_RELATIONSHIP,agent_name,preferred_agent_name.agent_id
		from agent_relations,preferred_agent_name
		where
		agent_relations.agent_id=preferred_agent_name.agent_id and
		RELATED_AGENT_ID=#agent_id#
	</cfquery>
	<ul>
		<cfloop query="agent_relations">
			<li><a href="agentActivity.cfm?agent_id=#agent_id#">#agent_name#</a> is #AGENT_RELATIONSHIP#</li>
		</cfloop>
	</ul>
Groups:
	<cfquery name="group_member" datasource="uam_god">
		select
			agent_name,
			GROUP_AGENT_ID
		from
			group_member, preferred_agent_name
		where
			group_member.GROUP_AGENT_ID=preferred_agent_name.agent_id and
			MEMBER_AGENT_ID=#agent_id#
		order by agent_name
	</cfquery>
	<ul>
		<cfloop query="group_member">
			<li><a href="agentActivity.cfm?agent_id=#GROUP_AGENT_ID#">#agent_name#</a></li>
		</cfloop>
	</ul>
 Address:
	<cfquery name="address" datasource="uam_god">
		select * from address where agent_id=#agent_id#
	</cfquery>
	<ul>
		<cfloop query="address">
			<li>#ADDRESS_TYPE#: #ADDRESS#</li>
		</cfloop>
	</ul>
Collector:
	<cfquery name="collector" datasource="uam_god">
		select
			count(distinct(collector.collection_object_id)) cnt,
			collector.collector_role,
			collection.guid_prefix,
	        collection.collection_id
		from
			collector,
			cataloged_item,
			collection
		where
			collector.collection_object_id = cataloged_item.collection_object_id AND
			cataloged_item.collection_id = collection.collection_id AND
			agent_id=#agent_id#
		group by
			collection.guid_prefix,
	        collection.collection_id,
	        collector.collector_role
	</cfquery>
	<ul>
		<CFLOOP query="collector">
			<li>
				#collector.collector_role#: <a href="/SpecimenResults.cfm?collector_agent_id=#agent_id#&collection_id=#collector.collection_id#&coll_role=#collector.collector_role#">#collector.cnt# #collector.guid_prefix#</a> specimens
			</li>
	  	</CFLOOP>
	</ul>


	Media:
	<cfquery name="media" datasource="uam_god">
		select
			media_relationship,
			count(*) c
		from
			media_relations
		where
			media_relationship like '% agent' and
			related_primary_key=#agent_id#
		group by
			media_relationship
		order by
			media_relationship
	</cfquery>
	<cfquery name="media_assd_relations" datasource="uam_god">
		select media_id from media_relations where CREATED_BY_AGENT_ID=#agent_id#
	</cfquery>
	<cfquery name="media_labels" datasource="uam_god">
		select media_id from media_labels where ASSIGNED_BY_AGENT_ID=#agent_id#<commit_msg>.<commit_after><cfinclude template = "/includes/_header.cfm">
<cfset title = "Agent Activity">
<cfoutput>
<a href="/agents.cfm?agent_id=#agent_id#" target="_top">Edit Agent</a>
<div class="importantNotification">
	Please note: your login may prevent you from seeing some linked data. The summary data below are accurate.
</div>
<cfquery name="agent" datasource="uam_god">
	select AGENT_ID,
	AGENT_TYPE,
	AGENT_REMARKS,
	PREFERRED_AGENT_NAME,
	getPreferredAgentName(CREATED_BY_AGENT_ID) createdby,
	CREATED_DATE
 	FROM agent where agent_id=#agent_id#
</cfquery>
<cfquery name="name" datasource="uam_god">
	select agent_name_id, agent_name, agent_name_type FROM agent_name where agent_id=#agent_id#
</cfquery>
<h3>
	#agent.PREFERRED_AGENT_NAME# (#agent.agent_type#)
	<div style="font-size:small; margin-left:1em;">created by #agent.createdby#, #agent.CREATED_DATE#</div>
</h3>
<p>
Agent Names:
	<ul>
		<cfloop query="name">
			<li>
				#name.agent_name# (#agent_name_type#)
			</li>
		</cfloop>
	</ul>
	<cfif agent.agent_type is "group">
		<cfquery name="grpagnt" datasource="uam_god">
			select MEMBER_AGENT_ID,getPreferredAgentName(MEMBER_AGENT_ID) name from group_member where GROUP_AGENT_ID=#agent_id#
		</cfquery>
		<p>
			Group Members:
			<ul>
				<cfloop query="grpagnt">
					<li><a href="/agents.cfm?agent_id=#MEMBER_AGENT_ID#">#name#</a></li>
				</cfloop>
			</ul>
		</p>
	</cfif>
</p>
<p>
	Remarks:

	<div>#agent.AGENT_REMARKS#</div>
</p>
	Agent Relationships:
	<cfquery name="agent_relations" datasource="uam_god">
		select AGENT_RELATIONSHIP,agent_name,RELATED_AGENT_ID
		from agent_relations,preferred_agent_name
		where
		agent_relations.RELATED_AGENT_ID=preferred_agent_name.agent_id and
		agent_relations.agent_id=#agent_id#
	</cfquery>
	<ul>
		<cfloop query="agent_relations">
			<li>#AGENT_RELATIONSHIP# <a href="agentActivity.cfm?agent_id=#RELATED_AGENT_ID#">#agent_name#</a></li>
		</cfloop>
	</ul>
	<cfquery name="agent_relations" datasource="uam_god">
		select AGENT_RELATIONSHIP,agent_name,preferred_agent_name.agent_id
		from agent_relations,preferred_agent_name
		where
		agent_relations.agent_id=preferred_agent_name.agent_id and
		RELATED_AGENT_ID=#agent_id#
	</cfquery>
	<ul>
		<cfloop query="agent_relations">
			<li><a href="agentActivity.cfm?agent_id=#agent_id#">#agent_name#</a> is #AGENT_RELATIONSHIP#</li>
		</cfloop>
	</ul>
Groups:
	<cfquery name="group_member" datasource="uam_god">
		select
			agent_name,
			GROUP_AGENT_ID
		from
			group_member, preferred_agent_name
		where
			group_member.GROUP_AGENT_ID=preferred_agent_name.agent_id and
			MEMBER_AGENT_ID=#agent_id#
		order by agent_name
	</cfquery>
	<ul>
		<cfloop query="group_member">
			<li><a href="agentActivity.cfm?agent_id=#GROUP_AGENT_ID#">#agent_name#</a></li>
		</cfloop>
	</ul>
 Address:
	<cfquery name="address" datasource="uam_god">
		select * from address where agent_id=#agent_id#
	</cfquery>
	<ul>
		<cfloop query="address">
			<li>#ADDRESS_TYPE#: #ADDRESS#</li>
		</cfloop>
	</ul>
Collector:
	<cfquery name="collector" datasource="uam_god">
		select
			count(distinct(collector.collection_object_id)) cnt,
			collector.collector_role,
			collection.guid_prefix,
	        collection.collection_id
		from
			collector,
			cataloged_item,
			collection
		where
			collector.collection_object_id = cataloged_item.collection_object_id AND
			cataloged_item.collection_id = collection.collection_id AND
			agent_id=#agent_id#
		group by
			collection.guid_prefix,
	        collection.collection_id,
	        collector.collector_role
	</cfquery>
	<cfquery name="scc" dbtype="query">
		select sum(cnt) scc from collector
	</cfquery>
	<ul>
		<li>
			 <a href="/SpecimenResults.cfm?collector_agent_id=#agent_id#">#scc.scc#</a> specimens
		</li>
		<CFLOOP query="collector">
			<li>
				#collector.collector_role#: <a href="/SpecimenResults.cfm?collector_agent_id=#agent_id#&collection_id=#collector.collection_id#&coll_role=#collector.collector_role#">#collector.cnt# #collector.guid_prefix#</a> specimens
			</li>
	  	</CFLOOP>
	</ul>


	Media:
	<cfquery name="media" datasource="uam_god">
		select
			media_relationship,
			count(*) c
		from
			media_relations
		where
			media_relationship like '% agent' and
			related_primary_key=#agent_id#
		group by
			media_relationship
		order by
			media_relationship
	</cfquery>
	<cfquery name="media_assd_relations" datasource="uam_god">
		select media_id from media_relations where CREATED_BY_AGENT_ID=#agent_id#
	</cfquery>
	<cfquery name="media_labels" datasource="uam_god">
		select media_id from media_labels where ASSIGNED_BY_AGENT_ID=#agent_id#
{'fraction_non_alphanumeric': 0.1303769401330377, 'fraction_numerical': 0.0006651884700665188, 'mean_word_length': 5.6233480176211454, 'pattern_counts': {'":': 0, '<': 197, '<?xml version=': 0, '>': 197, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4295545', 'n_tokens_mistral': 3793, 'n_tokens_neox': 3428, 'n_words': 577}