001package org.hl7.fhir.convertors.misc;
002
003import java.io.FileOutputStream;
004import java.io.IOException;
005
006import org.hl7.fhir.utilities.filesystem.ManagedFileAccess;
007import org.hl7.fhir.utilities.json.model.JsonObject;
008import org.hl7.fhir.utilities.json.parser.JsonParser;
009
010
011public class JsonProcessor {
012  public static void main(String[] args) throws Exception {
013    new JsonProcessor().process(args[0]);
014  }
015
016  private void process(String source) throws IOException {
017    JsonObject json = JsonParser.parseObjectFromFile(source);
018    process(json);
019    JsonParser.compose(json, ManagedFileAccess.outStream(source), true);
020    
021  }
022
023  private void process(JsonObject json) {
024    process(json, "ActivityDefinition.status");
025    process(json, "CapabilityStatement.status");
026    process(json, "CodeSystem.status");
027    process(json, "CompartmentDefinition.status");
028    process(json, "ConceptMap.status");
029    process(json, "DataElement.status");
030    process(json, "ExpansionProfile.status");
031    process(json, "GraphDefinition.status");
032    process(json, "ImplementationGuide.status");
033    process(json, "Library.status");
034    process(json, "Measure.status");
035    process(json, "MessageDefinition.status");
036    process(json, "OperationDefinition.status");
037    process(json, "PlanDefinition.status");
038    process(json, "Questionnaire.status");
039    process(json, "SearchParameter.status");
040    process(json, "ServiceDefinition.status");
041    process(json, "StructureDefinition.status");
042    process(json, "StructureMap.status");
043    process(json, "TestScript.status");
044    process(json, "ValueSet.status");
045    process(json, "ActivityDefinition.experimental");
046    process(json, "CapabilityStatement.experimental");
047    process(json, "CodeSystem.experimental");
048    process(json, "CompartmentDefinition.experimental");
049    process(json, "ConceptMap.experimental");
050    process(json, "DataElement.experimental");
051    process(json, "ExpansionProfile.experimental");
052    process(json, "GraphDefinition.experimental");
053    process(json, "ImplementationGuide.experimental");
054    process(json, "Library.experimental");
055    process(json, "Measure.experimental");
056    process(json, "MessageDefinition.experimental");
057    process(json, "OperationDefinition.experimental");
058    process(json, "PlanDefinition.experimental");
059    process(json, "Questionnaire.experimental");
060    process(json, "SearchParameter.experimental");
061    process(json, "ServiceDefinition.experimental");
062    process(json, "StructureDefinition.experimental");
063    process(json, "StructureMap.experimental");
064    process(json, "TestScript.experimental");
065    process(json, "ValueSet.experimental");
066    process(json, "Identifier.use");
067    process(json, "Quantity.comparator");
068    process(json, "Address.use");
069    process(json, "ContactPoint.use");
070    process(json, "HumanName.use");
071    process(json, "BackboneElement.modifierExtension");
072    process(json, "DomainResource.modifierExtension");
073    process(json, "Resource.implicitRules");
074    process(json, "Account.status");
075    process(json, "AllergyIntolerance.clinicalStatus");
076    process(json, "AllergyIntolerance.verificationStatus");
077    process(json, "Appointment.status");
078    process(json, "AppointmentResponse.participantStatus");
079    process(json, "Basic.code");
080    process(json, "BodySite.active");
081    process(json, "CarePlan.status");
082    process(json, "CarePlan.intent");
083    process(json, "CarePlan.activity.detail.status");
084    process(json, "CarePlan.activity.detail.prohibited");
085    process(json, "CareTeam.status");
086    process(json, "ChargeItem.status");
087    process(json, "Claim.status");
088    process(json, "ClaimResponse.status");
089    process(json, "ClinicalImpression.status");
090    process(json, "Communication.status");
091    process(json, "Communication.notDone");
092    process(json, "CommunicationRequest.status");
093    process(json, "Composition.status");
094    process(json, "Composition.confidentiality");
095    process(json, "Composition.section.mode");
096    process(json, "ConceptMap.group.element.target.equivalence");
097    process(json, "Condition.clinicalStatus");
098    process(json, "Condition.verificationStatus");
099    process(json, "Consent.status");
100    process(json, "Contract.status");
101    process(json, "Coverage.status");
102    process(json, "DetectedIssue.status");
103    process(json, "Device.status");
104    process(json, "DeviceRequest.status");
105    process(json, "DeviceRequest.intent");
106    process(json, "DeviceUseStatement.status");
107    process(json, "DiagnosticReport.status");
108    process(json, "DocumentManifest.status");
109    process(json, "DocumentReference.status");
110    process(json, "DocumentReference.relatesTo");
111    process(json, "EligibilityRequest.status");
112    process(json, "EligibilityResponse.status");
113    process(json, "Encounter.status");
114    process(json, "Endpoint.status");
115    process(json, "EnrollmentRequest.status");
116    process(json, "EnrollmentResponse.status");
117    process(json, "EpisodeOfCare.status");
118    process(json, "ExplanationOfBenefit.status");
119    process(json, "FamilyMemberHistory.status");
120    process(json, "FamilyMemberHistory.notDone");
121    process(json, "FamilyMemberHistory.estimatedAge");
122    process(json, "Flag.status");
123    process(json, "Goal.status");
124    process(json, "Group.characteristic.exclude");
125    process(json, "GuidanceResponse.status");
126    process(json, "HealthcareService.active");
127    process(json, "Immunization.status");
128    process(json, "Immunization.notGiven");
129    process(json, "List.status");
130    process(json, "List.mode");
131    process(json, "List.entry.deleted");
132    process(json, "Location.status");
133    process(json, "Location.mode");
134    process(json, "MeasureReport.status");
135    process(json, "MedicationAdministration.status");
136    process(json, "MedicationAdministration.notGiven");
137    process(json, "MedicationDispense.status");
138    process(json, "MedicationRequest.status");
139    process(json, "MedicationRequest.intent");
140    process(json, "MedicationRequest.substitution.allowed");
141    process(json, "MedicationStatement.status");
142    process(json, "MedicationStatement.taken");
143    process(json, "NamingSystem.status");
144    process(json, "NutritionOrder.status");
145    process(json, "Observation.status");
146    process(json, "OperationOutcome.issue.severity");
147    process(json, "Organization.active");
148    process(json, "Patient.active");
149    process(json, "Patient.deceased[x]");
150    process(json, "Patient.animal");
151    process(json, "Patient.link");
152    process(json, "PaymentNotice.status");
153    process(json, "PaymentReconciliation.status");
154    process(json, "Person.active");
155    process(json, "Procedure.status");
156    process(json, "Procedure.notDone");
157    process(json, "ProcedureRequest.status");
158    process(json, "ProcedureRequest.intent");
159    process(json, "ProcedureRequest.doNotPerform");
160    process(json, "ProcessRequest.status");
161    process(json, "ProcessResponse.status");
162    process(json, "Questionnaire.item.enableWhen");
163    process(json, "QuestionnaireResponse.status");
164    process(json, "ReferralRequest.status");
165    process(json, "ReferralRequest.intent");
166    process(json, "RelatedPerson.active");
167    process(json, "RequestGroup.status");
168    process(json, "RequestGroup.intent");
169    process(json, "ResearchStudy.status");
170    process(json, "ResearchSubject.status");
171    process(json, "Schedule.active");
172    process(json, "Specimen.status");
173    process(json, "Subscription.status");
174    process(json, "SupplyDelivery.status");
175    process(json, "SupplyRequest.status");
176    process(json, "TestReport.status");
177    process(json, "ValueSet.compose.include.filter");
178    process(json, "VisionPrescription.status");
179  }
180
181  private void process(JsonObject json, String name) {
182    JsonObject j = json.getJsonObject(name);
183    if (j == null) {
184      System.out.println("Can't find "+name);
185    } else {
186      j.add("modifier", true);
187    }
188    
189  }
190}