Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion my_proof/models/db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""SQLAlchemy database models for storing Spotify contribution data"""
"""SQLAlchemy database models for storing nutritional supplement contribution data"""
import datetime

from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float, DateTime, UniqueConstraint, ARRAY
Expand Down
16 changes: 8 additions & 8 deletions my_proof/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ def generate(self) -> ProofResponse:
self.proof_response.ownership * 0.1
)

# Additional (public) properties to include in the proof about the data
self.proof_response.attributes = {
'schema_type': schema_type,
'user_email': input_data.get('email'),
'user_id': input_data.get('userId'),
'profile_name': input_data.get('profile', {}).get('name'),
'verified_with_oauth': google_user is not None
}
# # Additional (public) properties to include in the proof about the data
# self.proof_response.attributes = {
# 'schema_type': schema_type,
# 'user_email': input_data.get('email'),
# 'user_id': input_data.get('userId'),
# 'profile_name': input_data.get('profile', {}).get('name'),
# 'verified_with_oauth': google_user is not None
# }

# Additional metadata about the proof, written onchain
self.proof_response.metadata = {
Expand Down
75 changes: 75 additions & 0 deletions my_proof/schemas/MedicationAdministration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MedicationAdministration Schema",
"type": "object",
"required": ["id", "resourceType", "status", "medicationCodeableConcept", "subject"],
"description": "Describes the event of a patient consuming or otherwise being administered a medication. This may be as simple as swallowing a tablet or it may be a long running infusion. Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.",
"properties": {
"id": {
"type": "string",
"description": "Logical id of this artifact"
},
"resourceType": {
"const": "MedicationAdministration"
},
"status": {
"const": "completed",
"description": "Will generally be set to show that the administration has been completed. For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way."
},
"medication": {
"type": "object",
"required": ["concept"],
"description": "What was administered",
"properties": {
"concept": {
"type": "object",
"required": ["coding", "text"],
"description": "A reference to a concept - e.g. the information is identified by its general class to the degree of precision found in the terminology.",
"properties": {
"coding": {
"type": "array",
"description": "A reference to a code defined by a terminology system.",
"items": {
"type": "object",
"required": ["system", "code"],
"description": "Identity of the terminology system",
"properties": {
"system": {
"const": "http://www.nutridao.com/fhir/supplement"
},
"code": {
"type": "string",
"description": "Symbol in syntax defined by the system"
},
"display": {
"type": "string",
"description": "Representation defined by the system"
}
}
}
},
"text": {
"type": "string",
"description": "Plain text representation of the concept"
}
}
}
}
},
"subject": {
"type": "object",
"required": ["reference"],
"description": "Who received medication",
"properties": {
"reference": {
"type": "string",
"description": "Literal reference, Relative, internal or absolute URL"
},
"display": {
"type": "string",
"description": "Text alternative for the resource reference"
}
}
}
}
}
63 changes: 0 additions & 63 deletions my_proof/schemas/google-profile.json

This file was deleted.

6 changes: 3 additions & 3 deletions my_proof/utils/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

def validate_schema(input_data: Dict[str, Any]) -> Tuple[str, bool]:
"""
Validate input data against the Google profile schema using jsonschema.
Validate input data against the Medication Administration schema using jsonschema.

Args:
input_data: The JSON data to validate

Returns:
tuple[str, bool]: A tuple containing (schema_type, is_valid)
where schema_type is 'google-profile.json'
where schema_type is 'MedicationAdministration.json'
and is_valid indicates if the schema validation passed
"""
try:
schema_type = 'google-profile.json'
schema_type = 'MedicationAdministration.json'

# Load the schema
schema_path = os.path.join(os.path.dirname(__file__), '..', 'schemas', schema_type)
Expand Down