Skip to content

Commit

Permalink
Better type for ValueSet._system
Browse files Browse the repository at this point in the history
Add link to zulip thread with information about the contained code
system extension.
  • Loading branch information
mint-thompson committed Oct 7, 2024
1 parent dbb94f0 commit e4a8cc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/export/ValueSetExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ export class ValueSetExporter {
.replace(/^([^|]+)/, csMetadata?.url ?? '$1')
.split('|');
composeElement.system = foundSystem[0];
// if the code system is also a contained resource, add the special extension
// if it's not a contained resource, and the system we found is an inline instance, that's a problem
// if the code system is also a contained resource, add the valueset-system extension
// this zulip thread contains a discussion of the issue and an example using this extension:
// https://chat.fhir.org/#narrow/stream/215610-shorthand/topic/Contained.20code.20system.20in.20the.20value.20set/near/424938537
// additionally, if it's not a contained resource, and the system we found is an inline instance, that's a problem
const containedSystem = valueSet.contained?.find((resource: any) => {
return resource?.id === csMetadata.id && resource.resourceType === 'CodeSystem';
});
Expand Down
14 changes: 10 additions & 4 deletions src/fhirtypes/ValueSet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import sanitize from 'sanitize-filename';
import { Meta } from './specialTypes';
import { Narrative, Resource, Identifier, CodeableConcept, Coding, Extension } from './dataTypes';
import {
Narrative,
Resource,
Identifier,
CodeableConcept,
Coding,
Extension,
Element
} from './dataTypes';
import { ContactDetail, UsageContext } from './metaDataTypes';
import { HasName, HasId } from './mixins';
import { applyMixins } from '../utils/Mixin';
Expand Down Expand Up @@ -82,9 +90,7 @@ export type ValueSetCompose = {

export type ValueSetComposeIncludeOrExclude = {
system?: string;
_system?: {
extension?: Extension[];
};
_system?: Element;
version?: string;
valueSet?: string[];
concept?: ValueSetComposeConcept[];
Expand Down

0 comments on commit e4a8cc0

Please sign in to comment.