示例#1
0
        public static void SetupData(TestContext context)
        {
            tdb = new MockObjectRepository();
            tdb.InitializeFHIR3Repository();
            igType          = tdb.ImplementationGuideTypes.Single(y => y.Name == Constants.IGTypeNames.FHIR_STU3);
            compositionType = tdb.TemplateTypes.Single(y => y.ImplementationGuideType == igType && y.Name == "Composition");
            extensionType   = tdb.TemplateTypes.Single(y => y.ImplementationGuideType == igType && y.Name == "Extension");

            ig                   = tdb.FindOrCreateImplementationGuide(igType, "STU3 IG Publisher Build Package");
            ig.Identifier        = "http://test.com/ig";
            ig.WebDescription    = "This Implementation Guide (IG) defines a series of FHIR profiles on the Composition resource to represent the various document types in C - CDA.This release does not directly map every C - CDA template to FHIR profiles, rather tries to accomplish the C - CDA use case using Composition resource profiles created under this project(the equivalent of Level 2 CDA documents), and begins by linking to the profiles created under the US Core project for any coded entries that would normally be included in C - CDA sections.To have a simpler, more streamlined standard that reuses existing work and focuses on the 80 % that implementers actually need in production systems, the resources of US Core represents a portion of the 80 % needed for coded entries for coded entries of CCD, Care Plan and Discharge Summary).";
            ig.WebReadmeOverview = "We encourage feedback on these Composition profiles, and the general approach to the project as a whole. We also encourage implementers who wish to see more of the coded data from C - CDA mapped to FHIR to comment on the US Core project and make their requests known there.  Once US Core creates new profiles, this project can reference them.";

            tdb.CreateImplementationGuideSection(ig, "Test Heading", "Test Content", 1, level: 3);

            var CCDAonFHIRParticipantProfile = tdb.CreateTemplate(
                "http://test.com/ig/StructureDefinition/CCDA-on-FHIR-Participant",
                extensionType,
                "C-CDAonFHIRParticipant",
                ig,
                "Extension",
                "Extension",
                "C-CDA on FHIR Participant Extension");

            CCDAonFHIRParticipantProfile.Bookmark = "CCDA-on-FHIR-Participant";

            var CCDAonFHIRAuthorizationProfile = tdb.CreateTemplate(
                "http://test.com/ig/StructureDefinition/CCDA-on-FHIR-Authorization",
                extensionType,
                "C-CDAonFHIRAuthorization",
                ig,
                "Extension",
                "Extension",
                "C-CDA on FHIR Authorization Extension");

            CCDAonFHIRAuthorizationProfile.Bookmark = "CCDA-on-FHIR-Authorization";

            var USCorePatientProfile = tdb.CreateTemplate(
                "http://test.com/ig/StructureDefinition/us-core-patient",
                compositionType,
                "U.S.CorePatient",
                ig,
                "Composition",
                "Composition",
                "Defines basic constraints and extensions on the Patient resource for use with other US Core resources.");

            USCorePatientProfile.Bookmark = "us-core-patient";

            USCorePatientProfile.Author           = new User();
            USCorePatientProfile.Author.FirstName = "Sarah";
            USCorePatientProfile.Author.LastName  = "Gaunt";
            USCorePatientProfile.Author.Email     = "*****@*****.**";

            var USCorePractitionerProfile = tdb.CreateTemplate(
                "http://test.com/ig/StructureDefinition/us-core-practitioner",
                compositionType,
                "U.S.CorePractitioner",
                ig,
                "Composition",
                "Composition",
                "Defines basic constraints and extensions on the Practitioner resource for use with other US Core resources.");

            USCorePractitionerProfile.Bookmark = "us-core-practitioner";

            USCorePractitionerProfile.Author           = new User();
            USCorePractitionerProfile.Author.FirstName = "Eric";
            USCorePractitionerProfile.Author.LastName  = "Parapini";
            USCorePractitionerProfile.Author.Email     = "*****@*****.**";

            var USCoreOrganizationProfile = tdb.CreateTemplate(
                "http://test.com/ig/StructureDefinition/us-core-organization",
                compositionType,
                "U.S.CoreOrganization",
                ig,
                "Composition",
                "Composition",
                "Defines basic constraints and extensions on the Organization resource for use with other US Core resources.");

            USCoreOrganizationProfile.Bookmark = "us-core-organization";

            USCoreOrganizationProfile.Author           = new User();
            USCoreOrganizationProfile.Author.FirstName = "Meenaxi";
            USCoreOrganizationProfile.Author.LastName  = "Gosai";
            USCoreOrganizationProfile.Author.Email     = "*****@*****.**";

            var USRealmHeaderProfile = tdb.CreateTemplate(
                "http://test.com/ig/StructureDefinition/CCDA-on-FHIR-US-Realm-Header",
                compositionType,
                "US.RealmHeader",
                ig,
                "Composition",
                "Composition",
                "This profile defines constraints that represent common administrative and demographic concepts for US Realm clinical documents. Further specification, such as type, are provided in document profiles that conform to this profile.");

            USRealmHeaderProfile.Bookmark = "CCDA-on-FHIR-US-Realm-Header";                // This translates to the StructureDefinition.id, which is important

            USRealmHeaderProfile.Author           = new User();
            USRealmHeaderProfile.Author.FirstName = "Sean";
            USRealmHeaderProfile.Author.LastName  = "McIlvenna";
            USRealmHeaderProfile.Author.Email     = "*****@*****.**";

            // Add basic constraints to the  profile
            tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "identifier", "SHALL", "1..1");
            tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "date", "SHALL", "1..1");
            tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "type", "SHALL", "1..1");
            tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "title", "SHALL", "1..1");
            tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "status", "SHALL", "1..1");
            tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "language", "SHALL", "1..1");


            // Add a reference constraint to a contained profile
            TemplateConstraint t3tc1 = tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, USCorePatientProfile, "subject", "SHALL", "1..1");

            // Add a reference constraint to a contained profile
            TemplateConstraint t3tc2 = tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, USCorePractitionerProfile, "author", "SHALL", "1..1");

            // Add a reference constraint to a contained profile
            TemplateConstraint t3tc3 = tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, USCoreOrganizationProfile, "custodian", "SHALL", "1..1");

            // Constraint with a child (child has code system)
            CodeSystem         t1tc4_cs = tdb.FindOrCreateCodeSystem("FHIR CompositionAttestationMode", "http://hl7.org/fhir/composition-attestation-mode");
            TemplateConstraint t1tc4    = tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "attester", "SHOULD", "0..1");
            TemplateConstraint t1tc4_2  = tdb.AddConstraintToTemplate(USRealmHeaderProfile, t1tc4, null, "mode", "SHALL", "1..1", "CE", "SHALL", "legal", null, codeSystem: t1tc4_cs);

            // Add an extension constraint with a contained profile
            TemplateConstraint t5tc1 = tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, CCDAonFHIRAuthorizationProfile, "extension", "SHALL", "1..1", "Extension");

            // Add a Constraint with a child (child has valueset)
            ValueSet           t1tc6_vs = tdb.FindOrCreateValueSet("v3-ConfidentialityClassification", "http://hl7.org/fhir/ValueSet/v3-ConfidentialityClassification");
            TemplateConstraint t1tc6    = tdb.AddConstraintToTemplate(USRealmHeaderProfile, null, null, "confidentiality", "SHALL", "1..1", "CE", "SHALL", null, null, valueSet: t1tc6_vs);

            extractDirectory = Path.Combine(context.TestDeploymentDir, dstu2ExtractFolder);
        }