<commit_before><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:p="http://integration.nci.nih.gov/participant" xmlns:ns0="http://caXchange.nci.nih.gov/messaging"
	xmlns:ns1="urn:hl7-org:v3" xmlns:ns2="http://caXchange.nci.nih.gov/caxchangerequest"
	xmlns:ns3="http://cacis.nci.nih.gov" xmlns:r="http://catissue/race/data"
	xmlns:e="http://catissue/ethnicity/data" xmlns:g="http://catissue/gender/data"
	xmlns:s="http://catissue/activitystatus/data" exclude-result-prefixes="
	ns0 xs ns1 ns2 ns3 ">
	<xsl:output method="xml" indent="yes" />

	<xsl:key name="race-lookup" match="r:race" use="r:vockey" />
	<xsl:variable name="races-top" select="document('race-lookup.xml')/*" />
	<xsl:template match="r:races">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('race-lookup', $curr-key)/r:vocvalue" />
	</xsl:template>

	<xsl:key name="ethnicity-lookup" match="e:ethnicity" use="e:vockey" />
	<xsl:variable name="ethnicities-top" select="document('ethnicity-lookup.xml')/*" />
	<xsl:template match="e:ethnicities">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('ethnicity-lookup', $curr-key)/e:vocvalue" />
	</xsl:template>

	<xsl:key name="gender-lookup" match="g:gender" use="g:vockey" />
	<xsl:variable name="genders-top" select="document('genders-lookup.xml')/*" />
	<xsl:template match="g:genders">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('gender-lookup', $curr-key)/g:vocvalue" />
	</xsl:template>


	<xsl:key name="status-lookup" match="s:status" use="s:vockey" />
	<xsl:variable name="statuses-top"
		select="document('activitystatus-lookup.xml')/*" />
	<xsl:template match="s:activitystatus">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('status-lookup', $curr-key)/s:vocvalue" />
	</xsl:template>

	<xsl:template match="/">
		<ns2:caxchangerequest>
			<ns0:metadata>
				<xsl:copy-of select="//ns2:caxchangerequest/ns0:metadata/node()|@*" />
			</ns0:metadata>
			<ns0:request>
				<ns0:businessMessagePayload>
					<p:participant id="1" version="1"
						xmlns:p="http://integration.nci.nih.gov/participant" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
						xsi:schemaLocation="http://integration.nci.nih.gov/participant Participant.xsd ">
						<xsl:variable name="clinicalDocument"
							select="ns3:caCISRequest/ns3:sourceData/ns2:caxchangerequest/ns0:request/ns0:businessMessagePayload/ns1:ClinicalDocument" />
						<xsl:variable name="patientRole"
							select="$clinicalDocument/ns1:recordTarget/ns1:patientRole" />
						<p:firstName>
							<xsl:value-of select="$patientRole/ns1:patient/ns1:name/ns1:given" />
						</p:firstName>
						<p:lastName>
							<xsl:value-of select="$patientRole/ns1:patient/ns1:name/ns1:family" />
						</p:lastName>
						<p:maidenName></p:maidenName>
						<p:middleName></p:middleName>
						<p:birthDate>
							<xsl:call-template name="show-dateTime">
								<xsl:with-param name="dateTime"
									select="$patientRole/ns1:patient/ns1:birthTime/@value" />
							</xsl:call-template>
						</p:birthDate>
						<p:gender>
							<xsl:call-template name="show-gender">
								<xsl:with-param name="adminGenderCode"
									select="$patientRole/ns1:patient/ns1:administrativeGenderCode" />
							</xsl:call-template>
						</p:gender>
						<p:race>
							<xsl:call-template name="show-race">
								<xsl:with-param name="raceValue"
									select="$patientRole/ns1:patient/ns1:raceCode" />
							</xsl:call-template>
						</p:race>
						<p:ethnicity>
							<xsl:call-template name="show-ethnicity">
								<xsl:with-param name="ethnicGroupCode"
									select="$patientRole/ns1:patient/ns1:ethnicGroupCode" />
							</xsl:call-template>
						</p:ethnicity>
						<p:activityStatus>
							<xsl:call-template name="show-activityStatus">
								<xsl:with-param name="asValue"
									select="$clinicalDocument/ns1:component/ns1:structuredBody/ns1:component/ns1:section/ns1:entry/ns1:observation[ns1:templateId/@root='2.16.840.1.113883.10.20.22.4.2'][ns1:code[@code='263490005'][@codeSystem='2.16.840.1.113883.6.96']]/ns1:value/@code" />
							</xsl:call-template>
						</p:activityStatus>
						<p:registrationDate>
							<xsl:call-template name="show-dateTime">
								<xsl:with-param name="dateTime"
									select="$clinicalDocument/ns1:effectiveTime/@value" />
							</xsl:call-template>
						</p:registrationDate>
						<p:identifiers>
							<p:organizationAssignedIdentifier
								id="1" version="1">
								<p:type>MRN</p:type>
								<p:value>
									<xsl:call-template name="show-id">
										<xsl:with-param name="id"
											select="$patientRole/ns1:id[@assigningAuthorityName !='iSpy2 Study']" />
									</xsl:call-template><commit_msg>XPath updated<commit_after><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:p="http://integration.nci.nih.gov/participant" xmlns:ns0="http://caXchange.nci.nih.gov/messaging"
	xmlns:ns1="urn:hl7-org:v3" xmlns:ns2="http://caXchange.nci.nih.gov/caxchangerequest"
	xmlns:ns3="http://cacis.nci.nih.gov" xmlns:r="http://catissue/race/data"
	xmlns:e="http://catissue/ethnicity/data" xmlns:g="http://catissue/gender/data"
	xmlns:s="http://catissue/activitystatus/data" exclude-result-prefixes="
	ns0 xs ns1 ns2 ns3 ">
	<xsl:output method="xml" indent="yes" />

	<xsl:key name="race-lookup" match="r:race" use="r:vockey" />
	<xsl:variable name="races-top" select="document('race-lookup.xml')/*" />
	<xsl:template match="r:races">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('race-lookup', $curr-key)/r:vocvalue" />
	</xsl:template>

	<xsl:key name="ethnicity-lookup" match="e:ethnicity" use="e:vockey" />
	<xsl:variable name="ethnicities-top" select="document('ethnicity-lookup.xml')/*" />
	<xsl:template match="e:ethnicities">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('ethnicity-lookup', $curr-key)/e:vocvalue" />
	</xsl:template>

	<xsl:key name="gender-lookup" match="g:gender" use="g:vockey" />
	<xsl:variable name="genders-top" select="document('genders-lookup.xml')/*" />
	<xsl:template match="g:genders">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('gender-lookup', $curr-key)/g:vocvalue" />
	</xsl:template>


	<xsl:key name="status-lookup" match="s:status" use="s:vockey" />
	<xsl:variable name="statuses-top"
		select="document('activitystatus-lookup.xml')/*" />
	<xsl:template match="s:activitystatus">
		<xsl:param name="curr-key" />
		<xsl:value-of select="key('status-lookup', $curr-key)/s:vocvalue" />
	</xsl:template>

	<xsl:template match="/">
		<ns2:caxchangerequest>
			<ns0:metadata>
				<xsl:copy-of select="//ns2:caxchangerequest/ns0:metadata/node()|@*" />
			</ns0:metadata>
			<ns0:request>
				<ns0:businessMessagePayload>
					<p:participant id="1" version="1"
						xmlns:p="http://integration.nci.nih.gov/participant" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
						xsi:schemaLocation="http://integration.nci.nih.gov/participant Participant.xsd ">
						<xsl:variable name="clinicalDocument"
							select="ns3:caCISRequest/ns3:sourceData/ns2:caxchangerequest/ns0:request/ns0:businessMessagePayload/ns1:ClinicalDocument" />
						<xsl:variable name="patientRole"
							select="$clinicalDocument/ns1:recordTarget/ns1:patientRole" />
						<p:firstName>
							<xsl:value-of select="$patientRole/ns1:patient/ns1:name/ns1:given" />
						</p:firstName>
						<p:lastName>
							<xsl:value-of select="$patientRole/ns1:patient/ns1:name/ns1:family" />
						</p:lastName>
						<p:maidenName></p:maidenName>
						<p:middleName></p:middleName>
						<p:birthDate>
							<xsl:call-template name="show-dateTime">
								<xsl:with-param name="dateTime"
									select="$patientRole/ns1:patient/ns1:birthTime/@value" />
							</xsl:call-template>
						</p:birthDate>
						<p:gender>
							<xsl:call-template name="show-gender">
								<xsl:with-param name="adminGenderCode"
									select="$patientRole/ns1:patient/ns1:administrativeGenderCode" />
							</xsl:call-template>
						</p:gender>
						<p:race>
							<xsl:call-template name="show-race">
								<xsl:with-param name="raceValue"
									select="$patientRole/ns1:patient/ns1:raceCode" />
							</xsl:call-template>
						</p:race>
						<p:ethnicity>
							<xsl:call-template name="show-ethnicity">
								<xsl:with-param name="ethnicGroupCode"
									select="$patientRole/ns1:patient/ns1:ethnicGroupCode" />
							</xsl:call-template>
						</p:ethnicity>
						<p:activityStatus>
							<xsl:call-template name="show-activityStatus">
								<xsl:with-param name="asValue"
									select="//ns1:observation[ns1:templateId/@root='2.16.840.1.113883.10.20.22.4.2'][ns1:code[@code='263490005'][@codeSystem='2.16.840.1.113883.6.96']]/ns1:value/@code" />
							</xsl:call-template>
						</p:activityStatus>
						<p:registrationDate>
							<xsl:call-template name="show-dateTime">
								<xsl:with-param name="dateTime"
									select="$clinicalDocument/ns1:effectiveTime/@value" />
							</xsl:call-template>
						</p:registrationDate>
						<p:identifiers>
							<p:organizationAssignedIdentifier
								id="1" version="1">
								<p:type>MRN</p:type>
								<p:value>
									<xsl:call-template name="show-id">
										<xsl:with-param name="id"
											select="$patientRole/ns1:id[@assigningAuthorityName !='iSpy2 Study']" />
									</xsl:call-template>
{'fraction_non_alphanumeric': 0.1948011274663326, 'fraction_numerical': 0.02474162229877858, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 2, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 38}, 'pii_count': 2, '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': '4945905', 'n_tokens_mistral': 4543, 'n_tokens_neox': 3469, 'n_words': 358}