revise draft

This commit is contained in:
Grahame Grieve 2022-12-20 08:47:30 +13:00
parent b6d35314f6
commit 96810c984b
4 changed files with 118 additions and 110 deletions

View File

@ -110,6 +110,7 @@ import org.hl7.fhir.r5.model.Bundle.HTTPVerb;
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent;
import org.hl7.fhir.r5.profilemodel.ProfiledElement;
import org.hl7.fhir.r5.profilemodel.ProfiledElementBuilder;
import org.hl7.fhir.r5.renderers.OperationOutcomeRenderer;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
@ -2394,4 +2395,11 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
this.packageTracker = packageTracker;
return this;
}
@Override
public ProfiledElementBuilder getProfiledElementBuilder() {
// TODO Auto-generated method stub
return new ProfiledElementBuilder(this);
}
}

View File

@ -66,6 +66,7 @@ import org.hl7.fhir.r5.model.StructureMap;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.r5.profilemodel.ProfiledElement;
import org.hl7.fhir.r5.profilemodel.ProfiledElementBuilder;
import org.hl7.fhir.r5.terminologies.ValueSetExpander.TerminologyServiceErrorClass;
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
@ -802,84 +803,6 @@ public interface IWorkerContext {
public String getSpecUrl();
/**
* Given a profile, return a tree of elements in the profile model. This builds the profile model
* for the latest version of the nominated profile
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
* Warning: profiles and resources can be recursive; you can't iterate this tree until it you get
* to the leaves because you will never get to a child that doesn't have children
*
*/
public ProfiledElement buildProfileElement(String url);
/**
* Given a profile, return a tree of elements in the profile model. This builds the profile model
* for the nominated version of the nominated profile
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
* Warning: profiles and resources can be recursive; you can't iterate this tree until it you get
* to the leaves because you will never get to a child that doesn't have children
*
*/
public ProfiledElement buildProfileElement(String url, String version);
/**
* Given a profile, return a tree of elements in the profile model with matching instance data.
* This builds the profile model for the latest version of the nominated profile and matches
* the data in the resource against the profile. Data can be added or read from the profile element
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
* Warning: profiles and resources can be recursive; you can't iterate this tree until it you get
* to the leaves because you will never get to a child that doesn't have children
*
*/
public ProfiledElement buildProfileElement(String url, Resource resource);
/**
* Given a profile, return a tree of elements in the profile model with matching instance data.
* This builds the profile model for the nominated version of the nominated profile and matches
* the data in the resource against the profile. Data can be added or read from the profile element
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
*/
public ProfiledElement buildProfileElement(String url, String version, Resource resource);
/**
* Given a profile, construct an empty resource of the type being profiled (to use as input
* to the buildProfileElement method
*
* No version, because the version doesn't change the type of the resource
*/
public Resource makeProfileBase(String url);
public ProfiledElementBuilder getProfiledElementBuilder();
}

View File

@ -68,6 +68,7 @@ import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
import org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode;
import org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent;
import org.hl7.fhir.r5.profilemodel.ProfiledElement;
import org.hl7.fhir.r5.profilemodel.ProfiledElementBuilder;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r5.terminologies.JurisdictionUtilities;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
@ -762,36 +763,5 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
return VersionUtilities.getSpecUrl(getVersion())+"/";
}
@Override
public ProfiledElement buildProfileElement(String url) {
// TODO Auto-generated method stub
return null;
}
@Override
public ProfiledElement buildProfileElement(String url, String version) {
// TODO Auto-generated method stub
return null;
}
@Override
public ProfiledElement buildProfileElement(String url, Resource resource) {
// TODO Auto-generated method stub
return null;
}
@Override
public ProfiledElement buildProfileElement(String url, String version, Resource resource) {
// TODO Auto-generated method stub
return null;
}
@Override
public Resource makeProfileBase(String url) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,107 @@
package org.hl7.fhir.r5.profilemodel;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.model.Resource;
import kotlin.NotImplementedError;
public class ProfiledElementBuilder {
private IWorkerContext context;
public ProfiledElementBuilder(IWorkerContext context) {
super();
this.context = context;
}
/**
* Given a profile, return a tree of elements in the profile model. This builds the profile model
* for the latest version of the nominated profile
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
* Warning: profiles and resources can be recursive; you can't iterate this tree until it you get
* to the leaves because you will never get to a child that doesn't have children
*
*/
public ProfiledElement buildProfileElement(String url) {
throw new NotImplementedError("NOt done yet");
}
/**
* Given a profile, return a tree of elements in the profile model. This builds the profile model
* for the nominated version of the nominated profile
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
* Warning: profiles and resources can be recursive; you can't iterate this tree until it you get
* to the leaves because you will never get to a child that doesn't have children
*
*/
public ProfiledElement buildProfileElement(String url, String version) {
throw new NotImplementedError("NOt done yet");
}
/**
* Given a profile, return a tree of elements in the profile model with matching instance data.
* This builds the profile model for the latest version of the nominated profile and matches
* the data in the resource against the profile. Data can be added or read from the profile element
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
* Warning: profiles and resources can be recursive; you can't iterate this tree until it you get
* to the leaves because you will never get to a child that doesn't have children
*
*/
public ProfiledElement buildProfileElement(String url, Resource resource) {
throw new NotImplementedError("NOt done yet");
}
/**
* Given a profile, return a tree of elements in the profile model with matching instance data.
* This builds the profile model for the nominated version of the nominated profile and matches
* the data in the resource against the profile. Data can be added or read from the profile element
*
* THe tree of elements in the profile model is different to the the base resource:
* - some elements are removed (max = 0)
* - extensions are turned into named elements
* - slices are turned into named elements
* - element properties - doco, cardinality, binding etc is updated for what the profile says
*
* When built with this method, the profile element can't have instance data
*
*/
public ProfiledElement buildProfileElement(String url, String version, Resource resource) {
throw new NotImplementedError("NOt done yet");
}
/**
* Given a profile, construct an empty resource of the type being profiled (to use as input
* to the buildProfileElement method
*
* No version, because the version doesn't change the type of the resource
*/
public Resource makeProfileBase(String url) {
throw new NotImplementedError("NOt done yet");
}
}