Skip to content

Commit ac70477

Browse files
committed
dcm4che/dcm4chee-arc-light#37: IHE-ITI-20: Record Audit Event
1 parent a7d0433 commit ac70477

File tree

6 files changed

+242
-157
lines changed

6 files changed

+242
-157
lines changed

dcm4che-audit/src/main/java/org/dcm4che3/audit/AuditMessages.java

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import java.io.OutputStream;
4545
import java.io.Reader;
4646
import java.util.Calendar;
47+
import java.util.HashSet;
48+
import java.util.List;
4749
import java.util.regex.Pattern;
4850

4951
import javax.xml.bind.JAXBContext;
@@ -52,23 +54,10 @@
5254
import javax.xml.bind.Marshaller;
5355
import javax.xml.bind.Unmarshaller;
5456

55-
import org.dcm4che3.audit.Accession;
56-
import org.dcm4che3.audit.ActiveParticipant;
57-
import org.dcm4che3.audit.AuditMessage;
58-
import org.dcm4che3.audit.AuditSourceIdentification;
59-
import org.dcm4che3.audit.EventIdentification;
60-
import org.dcm4che3.audit.Instance;
61-
import org.dcm4che3.audit.MPPS;
62-
import org.dcm4che3.audit.ObjectFactory;
63-
import org.dcm4che3.audit.ParticipantObjectContainsStudy;
64-
import org.dcm4che3.audit.ParticipantObjectDescriptionType;
65-
import org.dcm4che3.audit.ParticipantObjectDetail;
66-
import org.dcm4che3.audit.ParticipantObjectIdentification;
67-
import org.dcm4che3.audit.SOPClass;
68-
6957
/**
7058
* @author Gunter Zeilinger <[email protected]>
7159
* @author Michael Backhaus <[email protected]>
60+
* @author Vrinda Nayak <[email protected]>
7261
*/
7362
public class AuditMessages {
7463

@@ -319,7 +308,7 @@ public void setCodeSystemName(String value) {
319308
}
320309

321310
public static final class AuditSourceTypeCode
322-
extends org.dcm4che3.audit.AuditSourceTypeCode {
311+
extends org.dcm4che3.audit.AuditSourceIdentification {
323312

324313
public static final AuditSourceTypeCode EndUserDisplayDevice =
325314
new AuditSourceTypeCode("1");
@@ -550,7 +539,7 @@ public static final class ParticipantObjectIDTypeCode
550539
public static final ParticipantObjectIDTypeCode MedicalRecordNumber =
551540
new ParticipantObjectIDTypeCode("1");
552541
public static final ParticipantObjectIDTypeCode PatientNumber =
553-
new ParticipantObjectIDTypeCode("2");
542+
new ParticipantObjectIDTypeCode("2", "RFC-3881","Patient Number");
554543
public static final ParticipantObjectIDTypeCode EncounterNumber =
555544
new ParticipantObjectIDTypeCode("3");
556545
public static final ParticipantObjectIDTypeCode EnrolleeNumber =
@@ -564,7 +553,7 @@ public static final class ParticipantObjectIDTypeCode
564553
public static final ParticipantObjectIDTypeCode ReportName =
565554
new ParticipantObjectIDTypeCode("8");
566555
public static final ParticipantObjectIDTypeCode ReportNumber =
567-
new ParticipantObjectIDTypeCode("9");
556+
new ParticipantObjectIDTypeCode("9", "RFC-3881","Report Number");
568557
public static final ParticipantObjectIDTypeCode SearchCriteria =
569558
new ParticipantObjectIDTypeCode("10");
570559
public static final ParticipantObjectIDTypeCode UserIdentifier =
@@ -577,10 +566,6 @@ public static final class ParticipantObjectIDTypeCode
577566
new ParticipantObjectIDTypeCode("110181","DCM","SOP Class UID");
578567
public static final ParticipantObjectIDTypeCode NodeID =
579568
new ParticipantObjectIDTypeCode("110182","DCM","Node ID");
580-
public static final ParticipantObjectIDTypeCode ITI_PatientNumber =
581-
new ParticipantObjectIDTypeCode("2","RFC-3881","Patient Number");
582-
public static final ParticipantObjectIDTypeCode ITI_ReportNumber =
583-
new ParticipantObjectIDTypeCode("9","RFC-3881","Report Number");
584569
public static final ParticipantObjectIDTypeCode ITI_PIXQuery =
585570
new ParticipantObjectIDTypeCode("ITI-9","IHE Transactions","PIX Query");
586571

@@ -660,16 +645,16 @@ public static AuditSourceIdentification createAuditSourceIdentification(
660645
asi.setAuditEnterpriseSiteID(siteID);
661646
asi.setAuditSourceID(sourceID);
662647
for (AuditSourceTypeCode type : types)
663-
asi.getAuditSourceTypeCode().add(type);
648+
asi.getAuditSourceTypeCode().add(type.toString());
664649
return asi;
665650
}
666651

667652
public static ParticipantObjectIdentification createParticipantObjectIdentification(
668653
String id, ParticipantObjectIDTypeCode idType, String name,
669654
byte[] query, String type, String role, String lifeCycle,
670-
String sensitivity, String description,
671-
ParticipantObjectDescriptionType descriptionType,
672-
ParticipantObjectDetail... details) {
655+
String sensitivity, List<String> desc, HashSet<Accession> accessionList, HashSet<MPPS> mppsList,
656+
HashSet<SOPClass> sopClasses, Boolean encrypted, Boolean anonymized,
657+
ParticipantObjectContainsStudy pocs, ParticipantObjectDetail... details) {
673658
ParticipantObjectIdentification poi = new ParticipantObjectIdentification();
674659
poi.setParticipantObjectID(id);
675660
poi.setParticipantObjectIDTypeCode(idType);
@@ -679,20 +664,25 @@ public static ParticipantObjectIdentification createParticipantObjectIdentificat
679664
poi.setParticipantObjectTypeCodeRole(role);
680665
poi.setParticipantObjectDataLifeCycle(lifeCycle);
681666
poi.setParticipantObjectSensitivity(sensitivity);
682-
poi.setParticipantObjectDescription(description);
683-
poi.setParticipantObjectDescriptionType(descriptionType);
667+
if (null != desc)
668+
for (String pod : desc)
669+
poi.getParticipantObjectDescription().add(pod);
670+
if (null != accessionList)
671+
for (Accession acc : accessionList)
672+
poi.getAccession().add(acc);
673+
if (null != mppsList)
674+
for (MPPS mpps : mppsList)
675+
poi.getMPPS().add(mpps);
676+
if (null != sopClasses)
677+
for (SOPClass sopC : sopClasses)
678+
poi.getSOPClass().add(sopC);
679+
poi.setEncrypted(encrypted);
680+
poi.setAnonymized(anonymized);
681+
poi.setParticipantObjectContainsStudy(pocs);
684682
for (ParticipantObjectDetail detail : details)
685683
poi.getParticipantObjectDetail().add(detail);
686684
return poi;
687685
}
688-
689-
public static ParticipantObjectDescriptionType createParticipantObjectDescription(
690-
Boolean encrypted, Boolean anonymized) {
691-
ParticipantObjectDescriptionType podt = new ParticipantObjectDescriptionType();
692-
podt.setEncrypted(encrypted);
693-
podt.setAnonymized(anonymized);
694-
return podt;
695-
}
696686

697687
public static ParticipantObjectDetail createParticipantObjectDetail(
698688
String type, byte[] value) {
@@ -735,6 +725,12 @@ public static Accession createAccession(String accessionNumber) {
735725
return accession;
736726
}
737727

728+
public static StudyIDs createStudyIDs(String studyID) {
729+
StudyIDs sID = new StudyIDs();
730+
sID.setUID(studyID);
731+
return sID;
732+
}
733+
738734
public static String alternativeUserIDForAETitle(String... aets) {
739735
if (aets.length == 0)
740736
return null;

dcm4che-audit/src/main/rnc/audit-message.rnc

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ EventIdentificationType =
4141
# Define AuditSourceTypeCode so that an isolated single digit value is acceptable,
4242
# or a token with other csd attributes so that any controlled terminology can also be used.
4343
AuditSourceIdentificationType =
44-
element AuditSourceTypeCode {
44+
# element AuditSourceTypeCode {
4545
attribute code {
4646
## End-user display device, diagnostic display
4747
"1" |
@@ -60,17 +60,37 @@ AuditSourceIdentificationType =
6060
## ISO level 4-6 operating software
6161
"8" |
6262
## External source, other or unknown type
63-
"9"
64-
} | # other code values are allowed if a CodeSystem is specified by its name or OID
63+
"9"| ## other
64+
token }, ## other values are allowed if a codeSystemName is present
65+
other-csd-attributes?, ## If these are present, they define the meaning of code
66+
# } | # other code values are allowed if a CodeSystem is specified by its name or OID
6567
# CodedValueType
66-
attribute csd-code { xsd:string } |
67-
attribute displayName { xsd:string }? |
68-
attribute originalText { xsd:string } | # declared as required by CP-ITI-731-01 # Note: this corresponds to DICOM "Code Meaning"
69-
attribute codeSystem { OID }? |
70-
attribute codeSystemName { xsd:string } # declared as required by CP-ITI-731-01
71-
}*,
68+
# attribute csd-code { xsd:string } |
69+
# attribute displayName { xsd:string }? |
70+
# attribute originalText { xsd:string } | # declared as required by CP-ITI-731-01 # Note: this corresponds to DICOM "Code Meaning"
71+
# attribute codeSystem { OID }? |
72+
# attribute codeSystemName { xsd:string } # declared as required by CP-ITI-731-01
73+
# }*,
7274
attribute AuditEnterpriseSiteID { xsd:string }?,
73-
attribute AuditSourceID { xsd:string }
75+
attribute AuditSourceID { xsd:string },
76+
element AuditSourceTypeCode { xsd:string }*
77+
78+
# Define AuditSourceTypeCode so that an isolated single digit value is acceptable, or a token with other csd attributes
79+
# so that any controlled terminology can also be used.
80+
#AuditSourceTypeCodeContent =
81+
# attribute csd-code {
82+
# "1" | ## End-user display device, diagnostic device
83+
# "2" | ## Data acquisition device or instrument
84+
# "3" | ## Web Server process or thread
85+
# "4" | ## Application Server process or thread
86+
# "5" | ## Database Server process or thread
87+
# "6" | ## Security server, e.g., a domain controller
88+
# "7" | ## ISO level 1-3 network component
89+
# "8" | ## ISO level 4-6 operating software
90+
# "9" | ## other
91+
# token }, ## other values are allowed if a codeSystemName is present
92+
# other-csd-attributes? ## If these are present, they define the meaning of code
93+
7494

7595
ActiveParticipantType =
7696
element RoleIDCode { CodedValueType }*,
@@ -131,8 +151,8 @@ ParticipantObjectIdentificationType =
131151
(element ParticipantObjectName { xsd:string }
132152
| element ParticipantObjectQuery { xsd:base64Binary })?,
133153
element ParticipantObjectDetail { TypeValuePairType }*,
134-
element ParticipantObjectDescription { xsd:string },
135-
element ParticipantObjectDescriptionType { ParticipantObjectDescriptionType },
154+
element ParticipantObjectDescription { xsd:string }*,
155+
ParticipantObjectDescriptionType,
136156
attribute ParticipantObjectID { xsd:string },
137157
attribute ParticipantObjectTypeCode {
138158
## Person
@@ -253,16 +273,23 @@ ParticipantObjectDescriptionType =
253273

254274
CodedValueType =
255275
attribute csd-code { xsd:string },
256-
CodeSystem,
257-
attribute displayName { xsd:string }?,
258-
attribute originalText { xsd:string }? # Note: this corresponds to DICOM "Code Meaning"
276+
other-csd-attributes
277+
# CodeSystem,
278+
# attribute displayName { xsd:string }?,
279+
# attribute originalText { xsd:string }? # Note: this corresponds to DICOM "Code Meaning"
259280

260281
TypeValuePairType =
261282
attribute type { xsd:string },
262283
attribute value { xsd:base64Binary }
263284

264-
CodeSystem =
265-
attribute codeSystem { OID }?,
266-
attribute codeSystemName { xsd:string }?
285+
#CodeSystem =
286+
# attribute codeSystem { OID }?,
287+
# attribute codeSystemName { xsd:string }?
288+
289+
other-csd-attributes =
290+
attribute codeSystem { OID }?, # OID pattern="[0-2]((\.0)|(\.[1-9][0-9]*))*"
291+
attribute codeSystemName { xsd:string }?, # This makes clear that codeSystemName is either an OID or String
292+
attribute displayName { xsd:string }?,
293+
attribute originalText { xsd:string }? # Note: this corresponds to DICOM "Code Meaning"
267294

268295
OID = xsd:string { pattern = "[0-2]((\.0)|(\.[1-9][0-9]*))*" }

dcm4che-audit/src/main/xjb/bindings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<bindings node="//xs:complexType[@name='ParticipantObjectIdentificationType']">
2222
<class name="ParticipantObjectIdentification" />
2323
</bindings>
24-
<bindings node="//xs:complexType[@name='ParticipantObjectDescriptionType']">
25-
<class name="ParticipantObjectDescriptionType" />
26-
</bindings>
24+
<!--<bindings node="//xs:complexType[@name='ParticipantObjectDescriptionType']">-->
25+
<!--<class name="ParticipantObjectDescriptionType" />-->
26+
<!--</bindings>-->
2727
</bindings>
2828
</bindings>

0 commit comments

Comments
 (0)